First Person Camera on car Clamped

I want to make it so when the player enter the car he looks forwards and then can only turn 45 degrees to the sides. Here’s the code I have currently but for some reason the camera is facing backwards.

RunService:BindToRenderStep("UpdateLoop", Enum.RenderPriority.Camera.Value, function()
	if isDriving then
		if not deb then
			local rX, rY, rZ = DriveSeat.CFrame:ToOrientation()
			camera.CFrame = CFrame.lookAt(char.Head.CFrame.Position, DriveSeat.Parent.Body.Front.Position)
			deb = true
			print(camera.CFrame:ToEulerAnglesXYZ())
		end
		local rX, rY, rZ = camera.CFrame:ToOrientation()
		local limY = math.clamp(math.deg(rY), -45, 45)
		camera.CFrame = CFrame.new(camera.CFrame.Position) * CFrame.Angles(rX, math.rad(limY), rZ)
		print(camera.CFrame:ToEulerAnglesXYZ())
	else 
		if not script.Parent.Crouching.isCrouching.Value then
			humanoid.CameraOffset = Vector3.new(0, -0.5, -1.5)
		end
	end
end)
1 Like

Bumping this, to see if anyone knows about it.