Part Doesn't Really Rotate on the Camera's Y-Axis

I got bored and decided to make a broom that you can ride on. But when I tried to make the broom rotate based on the camera’s y-axis, it just doesn’t seem to work. I tried to find topics related to this but couldn’t find any.

RemoteEvent.OnServerEvent:connect(function(Player, Data)
	local CameraCFrame = Data.Camera
	local X,Y,Z = CameraCFrame:ToEulerAnglesXYZ()
	Gyro.CFrame = CFrame.Angles(0,Y,0)

Hey there, rotation pivots around every axis. The Y is actually turning left and right while X would be up and down.

1 Like

Yeah I know Y is left and right, but Y seems to invert itself when I try to move my camera at a certain point.


Taking a closer look at your video, it looks like it doesn’t spin fast enough to keep up, and then sees that it’s just shorter to turn around and spin the other way to the point.

1 Like

Here’s me doing it really slow then.


Are those values you’re printing in math.deg?
Otherwise that’s a lot of radians when pi is 360 degrees.

Yeah it’s printing out in math.deg().


Hm, this is some really strange behavior then. It looks like once it gets to around -75 it goes back up. I’ll have to leave it up to someone else to figure this out, sorry I couldn’t help.

I managed to fix my problem by replacing :ToEulerAnglesXYZ() with :ToOrientation(), not sure why but it works now.