Same camera script acts weird? Why?

So I have a script that makes the players camera point towards there mouse, in one game it works, in another it spins out of control.

How it should be:

local connect = run.RenderStepped:Connect(function()
	local np =,mouse.Y)
	local center =, camera.ViewportSize.Y/2)
	local difference = np - center
	local outcome =, (difference.X/center.X)*maxDegree)
	camera.CFrame = CFrame.Angles(-outcome.X, -outcome.Y,0) + mainPart.Position
How it is in my other game:

	local mp =, mouse.Y)
	local centre =, camera.ViewportSize.Y/2)
	local difference = mp - centre

	local outcome =*maxDegree, (difference.X/centre.X)*maxDegree)
	camera.CFrame = CFrame.Angles(-outcome.X, -outcome.Y,0) + cameraPart.Position


1 Like

Figured it out. the maxDegree value was supposed to be a math.rad

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