Fix Character Rotation

Hey there, I’m having some trouble trying to manuever this. I have this script that set’s the players camera as a helmet camera. While I play test, whenever I try turning left by clicking A to move the player left the whole body instead rotates left constantly. (Vice Versa with D and right)

local character = script.Parent
local head = character:WaitForChild("Head")

local camera = game.Workspace.CurrentCamera

-- Define the offset for the camera (right side of the head)
local offset = Vector3.new(1, 0.35, 0) -- Adjust the values as needed this sets the camera 1 stud to the right of the player's head. Could've done this previously.

local function lockToHead()
	-- Get the head's CFrame
	local headCFrame = head.CFrame

	-- Apply the offset to the head's CFrame
	local cameraCFrame = headCFrame * CFrame.new(offset)

	-- Set the camera's CFrame
	camera.CFrame = cameraCFrame
end

camera.CameraType = Enum.CameraType.Scriptable

game["Run Service"]:BindToRenderStep("CameraLock", Enum.RenderPriority.Camera.Value, lockToHead) 

Here is my code, and I have also provided video footage of what’s going on. Watch 2025-03-15 17-58-43 | Streamable

game["Run Service"]:BindToRenderStep("CameraLock", Enum.RenderPriority.Camera.Value + 1, lockToHead)

From a first person perspective, the CFrame of the camera affects the trajectory of player movement, and so, you would want to update the CFrame of the camera after it has affected player movement by incrementing the render priority.

1 Like

Have you tried setting Humanoid.AutoRotate to false? I have had this problem before and setting auto rotate to false fixed it for me.

1 Like

This somewhat worked, but still didn’t fix the issue, I believe Oplkel’s comment below fixed it. Overall setting Humanoid.AutoRotate to false worked. Thanks Dark been a while since ive talked to you.

1 Like

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