How can i make this moving player more smooth?

So i want to lock the player to the position, than make the player move but it shakes and is not smooth.
I also tested without the brick infront and it still shakes.

		Character:SetPrimaryPartCFrame(Slot.CFrame + Vector3.new(0,5,0))
		CharacterEvent:FireClient(Player, "PlayAnim")
		wait(0.2)
		for i = 0,0.4,.01 do
		Character:SetPrimaryPartCFrame(Character:GetPrimaryPartCFrame() + Vector3.new(i,0,0))
		wait()
		end

https://gyazo.com/9da4423ea35715cf2ffd474ad7e4648f

1 Like

Well if you wanna make it smooth, really just play with the numbers in the for loop and the animation speed.

But for that shaking, it is assumignly a problem with the camera. And it does seem like you have a part that you changed as the camera’s cframe, but I think that is wrong, so pretty much camera manipulation.

9d87fb19d01a54111cd6a38f780173c4

Which will make this cooler, and maybe fix the shaking. All though I’m not sure if you’d want this maybe you wouldn’t like to do this, but give it a try if you want.

1 Like

For animations and transitions like this, instead of using a loop, try using a RunService connection (more info here). In this instance, consider RunService.RenderStepped, then include your code for updating the position. You will have to change how you increase the X value of the PrimaryPart, but I’m sure you’ll figure that out.