Why does my camera stutter when I walk backwards?

Hey there! I’m currently having a problem with my camera stuttering when I walk backwards. Is it due to the way I force shiftlock?

Script to force shiftlock with:

runService.RenderStepped:Connect(function(delta)
	dt = delta
	local _, y, _ = cam.CFrame:ToObjectSpace(hrp.CFrame):ToEulerAnglesXYZ()
	
	humanoid.CameraOffset = currentOffset

	uIS.MouseBehavior = Enum.MouseBehavior.LockCenter
	hrp.CFrame = hrp.CFrame*CFrame.Angles(0,-y,0)
end)

Any help is appreciated!

2 Likes

Hi there! I’ll be helping with your script issue.
I need to ask some couple of questions so I can look into it.

Is the script local or server?

1 Like

It’s a localscript located inside of StarterCharacterScripts

1 Like

Can you provide me a full script, please?
There is few errors shown in the script.
image

1 Like
CameraOffset = Vector3.new(2,0,0)

The rest is as it shows. You can leave out the deltatime if you want to. uIS is UserInputService.

1 Like

Thank you but there is one problem.
What is the dt stand for?

1 Like

It stands for DeltaTime. I use it to make sure lerps work on any fps.

1 Like

Also, do you mean of currentOffset?
Because it still showing a blue line.

1 Like

Oh yeah, it’s currentOffset.

characters

1 Like

I have tested the script you provided and I saw the problem.

You can ask me some information about the script while I investigate.
I’ll let you know when I found a cause.

1 Like

I have found a cause and a solution.

Reply me when you’re ready so I can give you the best solution.

2 Likes

I don’t know exactly what’s wrong with your code, but in my game I also have a script like this and this was my solution to it:

	hum.AutoRotate = false
	
	local camX, camY, camZ = cam.CFrame:ToOrientation()
	local hrpX, hrpY, hrpZ = hrp.CFrame:ToOrientation()
	
	local camCFrame = CFrame.new(hrp.CFrame.p) * CFrame.Angles(hrpX, camY, hrpZ)
	
	hrp.CFrame = camCFrame

put this inside a renderStepped :slight_smile:

2 Likes

This script literally just fixed mine, the problem was AutoRotate!

1 Like

Sorry, someone already showed the solution. Thanks for the help!

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