Moves on collision

I am making a moving platform, and whenever my player gets on it, it starts flipping around. It also slowly rotates if I just leave it for a while. I want it to stay at the same rotation, but still move and be solid. This is my code for it:

   void FixedUpdate () {
    	if (directionality == 1) {
Vector3 movement = new Vector3 (-1.0f, 0.0f, 0.0f);
    	rigidbody.velocity = movement * speed * Time.deltaTime;
    	}
    		if (directionality == 2) {
    			Vector3 movement = new Vector3 (0.0f, 0.0f, 1.0f);
    			rigidbody.velocity = movement * speed * Time.deltaTime;
    		}
    }

You need to tick Fixed Angle on your Rigidbody component

hii…

If you have rigidbody2D then just tick Fixed Angle and if you have only rigidbody then give constraints for freeze rotation.

Thanks.