Why isn't my AddForce not working?

public class PlayerController : MonoBehaviour
{

public Rigidbody2D rb;
public float speed = 10f;

// Start is called before the first frame update
void Start()
{
    rb = GetComponent<Rigidbody2D>();
}

// Update is called once per frame
void Update()
{
    if (Input.GetKey("W"))
    {
        rb.AddForce(0, speed * Time.deltaTime, 0);
    }

    if (Input.GetKey("S"))
    {
        rb.AddForce(0, -speed * Time.deltaTime, 0);
    }
}

}

Hi

I think the issue might be in the first argument. You have an integer (0), but the first argument of AddForce is a Vector representing the direction and magnitude of the force.

So, instead you might say

if (Input.GetKey(KeyCode.W))
{
    //this would give you a 0,10 vector
    rb.AddForce(Vector2.up * speed * Time.deltaTime);
}

Hope that helps