Prevent parts from stuttering in motion when position is changed frequently on server side

This is something that has been plaguing me for a while, and I haven’t been able to find any concrete answers. Say, for example, there is a script parented to a part (on the server) with the following code:

local angle_ = 0;
local x_ = script.Parent.Position.X;
local y_ = script.Parent.Position.Y;
local r_ = 5;

game:GetService("RunService").Heartbeat:Connect(function()
	angle_ = (angle_+1)%360;
	script.Parent.Position = Vector3.new(x_+r_*math.cos(math.rad(angle_)),y_-math.abs(r_*math.sin(math.rad(angle_))),0);
end)

This looks fine in studio, but there is some stuttering/lag seen when in the player:

Would there be some kind of workaround to this that would minimize the amount of lag caused, but would still allow me to keep this action in the server? This is the kind of system I am using for player movement in one of my games, and lag has been a very common complaint. I believe this is the reason.

Unfortunately, ping prevents pretty much anything from being super smooth Server → Client. You could try to use TweenService to change this instead, but I really doubt it would help. You’re probably going to have to do it on the client.

If you’re dealing with player character movement, you probably want to do it on the client, then check if it’s within boundaries on the server

When you test in studio the environment uses a locally created server, hence no latency is observed.