2d game character falling over

Heya, guys.
I am trying to create a simple 2d game, with a flying thing that you push upwards and rotate the direction of “upwards”.
The problem I am having is that the gameobject keeps falling over through z-axis, a thing you never want in a 2d game, as it cant get back on its feet anymore.
Is there a way to totally disable movement through z axis?

What I have so far:
{
public float PlayerSpeed;

// Update is called once per frame
void Update () 
{
	//amount to move
	float amtToMove = Input.GetAxisRaw("Horizontal") * PlayerSpeed * Time.deltaTime;
	float amtToFly = Input.GetAxisRaw("Vertical") * PlayerSpeed * Time.deltaTime;
	
	//move the player
	transform.Rotate(0 , 0 , Input.GetAxis("Horizontal") * PlayerSpeed);
	transform.Translate(Vector3.up * amtToFly);

}

}

If you are using a Rigidbody, you can also try freezing the Rotation on the Constraints of the Rigidbody itself.

If your spaceship (I assume it's such a thing) has a rigidbody attached, you have to disable Gravity. Look at the "Rigidbody" voice trough the Inspector and remove the check sign from "Use Gravity". Do you find yourself in this case?