Camera Jittering when moving?

Hello fellow developers!

The question I am going to ask has been asked before by me and no one has responded, so I am requesting anyone to please help me out since I have been facing this issue for a few weeks now and have not come to any solutions.

I am working on a third person gun system, but when I move backwards or sideways, this happens:
https://drive.google.com/file/d/1dMnOc3n0Uqe9A6orIrocf7y2Yrt8j9L1/view?usp=sharing

Here is the code that changes the direction of the HumanoidRootPart:

Connection = RunService.Stepped:Connect(function()
			UserInputService.MouseBehavior = Enum.MouseBehavior.LockCenter
			local Direction = Vector3.new((Camera.CFrame + Camera.CFrame.LookVector * 100 + Camera.CFrame.RightVector * 27).Position.X, HumanoidRootPart.Position.Y, (Camera.CFrame + Camera.CFrame.LookVector * 100 + Camera.CFrame.RightVector * 27).Position.Z)

			HumanoidRootPart.CFrame = CFrame.new(HumanoidRootPart.CFrame.Position, Direction)
			script.TorsoPositioning:FireServer(Waist, C0, math.rad((Camera.CFrame + Camera.CFrame.LookVector * 50).Position.Y - HumanoidRootPart.Position.Y) * 1.4)
		end)

I tried using RenderStepped, but that just made everything worse. Heartbeat does the same :frowning:

I would really appreciate it if someone could help!

3 Likes

Please help me out! It would be much appreciated!

Fixed it using RunService.RenderStepped:Wait()!

Connection = RunService.Heartbeat:Connect(function()
			UserInputService.MouseBehavior = Enum.MouseBehavior.LockCenter
			local Direction = Vector3.new((Camera.CFrame + Camera.CFrame.LookVector * 100 + Camera.CFrame.RightVector * 27).Position.X, HumanoidRootPart.Position.Y, (Camera.CFrame + Camera.CFrame.LookVector * 100 + Camera.CFrame.RightVector * 27).Position.Z)

			HumanoidRootPart.CFrame = CFrame.new(HumanoidRootPart.CFrame.Position, Direction)
            RunService.RenderStepped:Wait()
			script.TorsoPositioning:FireServer(Waist, C0, math.rad((Camera.CFrame + Camera.CFrame.LookVector * 50).Position.Y - HumanoidRootPart.Position.Y) * 1.4)
		end)
1 Like