Player keeps falling on stairs

sorry if this is a simple mistake im really new to unity and i cant figure out how to keep the player from falling on stairs, im trying to make it so its always standing up but no matter what i do it always goes on its side

public class Movement : MonoBehaviour
{
    public float speed = 5.0f;
    public float VertInput;
    public float HoriInput;
    Quaternion newrotation = new Quaternion(-90, 0, 0, 0);
    // Start is called before the first frame update
    void Start()
    {
        speed = 5.0f;
        transform.Translate(-0.75f, 0.0f, 0.0f);
    }

    // Update is called once per frame
    void Update()
    {
        // get inputs for Vert using w and s. get inputs for Hori usinf a and d 
        VertInput = Input.GetAxis("Vertical");
        HoriInput = Input.GetAxis("Horizontal");
        // actually move the player forward by the inputs
        transform.Translate(Vector3.up * Time.deltaTime * speed * VertInput);
        transform.Translate(Vector3.right * Time.deltaTime * speed * HoriInput);
        transform.rotation = newrotation;
    }
}

The solution is very simple, all you have to do is go to your Rigidbody* component and then go under “constraints”, you should see “freeze rotation” and check “X” and “Y”.

*I’m just assuming that you have a Rigidbody, if you don’t, then go to “add components” and search “Rigidbody” for 3D and “Rigidbody2D” for 2D, select it, and finally set “gravity scale” to 0.