2D Orientation Lock

I’m currently in the proccess of creating 2D games and I’m trying to lock orientation of a part on the X axis. I don’t want to use constraints as I also want to modify the locked axis with scripts in some cases.

I tried simply settings the Y and Z axis to 0 but this doesn’t work because if X goes above 90, the Y and Z also need to change in order to go further else it just get stuck.

Part:PivotTo(CFrame.new(Part.Position) * CFrame.fromOrientation(math.rad(Part.Orientation.X), math.rad(0), math.rad(0)))

Would anybody have any advice on how to achieve this?