Changing Root CFrame takes a full frame to take effect

Inside my game, I’m making a custom camera script. Inside this custom camera script, I need the character to face in the direction that the camera is facing. Whenever I try this, the CFrame updates, but is visually delayed by around at least a frame.

I’ve added this code to it’s own RenderStepped loop, tried :PivotTo, put the code inside a spawn function, changed the RenderPriority and put the code before & after I update the CFrame. I’m completely at a loss of what I can do. Any help is appreciated.

RunService:BindToRenderStep('CameraController', Enum.RenderPriority.Camera.Value - 1, function()
    -- calculate camera CFrame and neck rotation
	
	if Humanoid then
        -- update camera CFrame code

		local _, CamYaw, _ = CurrentCamera.CFrame:ToEulerAnglesYXZ()
		
		if Root and not Humanoid.PlatformStand then
			Root.CFrame = CFrame.new(Root.Position) * CFrame.fromEulerAnglesYXZ(0, CamYaw, 0)
		end
	end
end)
3 Likes

Have you tried putting it in a RenderStepped loop? In one of my games, it worked on an issue I was having with a part of my gun.

Same issue, even tried .Stepped.

1 Like

I ended up connecting the Root CFrame update to whenever the Camera CFrame changes.

1 Like

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