Problem with rotation

I’m using this script to rotate my plane, but when it rotates it also moves its transform on the Z axis, how can i fix this?

if (Input.GetKey(KeyCode.LeftArrow))
    transform.Rotate(Vector3.up * rotspeed * Time.deltaTime);
 
 if (Input.GetKey(KeyCode.RightArrow))
    transform.Rotate(-Vector3.up * rotspeed * Time.deltaTime);

There could be a series of issues of why yours is not working…possibly due to alterations that you made that you might have not realized. Could be settings…either way. rotating on any axis is simple as one line of code. If its not working, its probably something youre overanalyzing. Check this link. It should help.