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.