How to increment/set CFrame rotation on one axis

Hello. I’m making a submarine which is controlled using alignOrientation. The problem is that I am struggling with CFrames.

In studio the rotation property works like I want it. Y represents rotation and Z represents tilt. X axis should always be 0 like this:

The problem is that I don’t know how to replicate this rotation “behavior” using CFrames because it rotates on the X axis as well and it doesnt set it to 0.

I am using this line of code to set the rotation:

orientation.CFrame = orientation.CFrame * CFrame.Angles(0,math.rad(rotation),math.rad(tilt))

Hope it makes sense :slight_smile:

Try this:

orientation.CFrame = CFrame.Angles(0,math.rad(rotation),0)*orientation.CFrame * CFrame.Angles(0,0,math.rad(tilt))