CFrame help (Face)

I need help… How can I make this part face the camera only on the axis Im rotating it on in this gif? : https://gyazo.com/00e96a547003e197454d06c6de485725

I dont want it to face every axis. Only the axis Im rotating it on in the gif

local _, y, _ = CFrame.new(partToRotate.Position, camera.CFrame.Position):ToOrientation(); -- get rotation CFrame
partToRotate.CFrame = CFrame.new(partToRotate.Position) * CFrame.Angles(0, y, 0); -- rotate on the y axis

I had an extreme issue like this a while back! If I am reading this correctly, you want the part to rotate on one axis correct? Here is a handy function I was shown:

local function turnOnOneAxis(PartToRotate, Target)
	local angle =  CFrame.new(PartToRotate.Position,Vector3.new(target.Position.X, PartToRotate.Position.Y, target.Position.Z))
	
	PartToRotate.CFrame = angle
end

I’m the post creator and i’m just a hair late but this was the solution. Still using it to this day. Thanks mate

1 Like

No problem! I still use this a lot too haha.