Get cameras vertical rotation

I’ve been trying to solve this for an hour and I just cant get it right. I’m trying to assign the cameras vertical rotation to a part, but only that. Not effecting any other propeties of the part.
I tried everything, but I don’t know why it just won’t work.

Can someone please help me out with a quick code?

Well we have to turn the radians (from Eulers Angles) into degrees in order for this to work, insert this in a LocalScript and change variables if you have to

local Camera = workspace.CurrentCamera
local Part = workspace:WaitForChild("Part")

-- It really depends where your part is facing, it should be the X side however
while true do
	local Y = Camera.CFrame:ToEulerAnglesYXZ()
	Part.Orientation =, 0, 0)

Thanks! I’ve modified the script a little:

local Y = cam.CFrame:ToEulerAnglesYXZ()
part.Orientation =,part.Orientation.Y,-math.deg(Y))

It works like a charm! I don’t know why I wasn’t able to find out this sulution.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.