How to detect when camera moves right and when left?

I want to achieve cool fps hand movement with it. But for it i need to detect when camera is moving
right or left.

Sorry for my English.

1 Like
local run = game:GetService("RunService")
local camera = workspace.CurrentCamera

local lastY = 0

run.RenderStepped:Connect(function()
	local X, Y, Z = camera.CFrame:ToOrientation()
	if math.deg(Y) > lastY then
		print("Camera rotated left.")
	elseif math.deg(Y) < lastY then
		print("Camera rotated right.")
	else
		print("Camera didn't rotate.")
	end
	lastY = math.deg(Y)
end)
1 Like