I have a Part with a BodyGyro and a BodyVelocity for each unit. On the server side, I have this FollowPlayerScript for each unit.
(There's nothing wrong with this script, its just slow)
while player.Character do
local char = player.Character;
repeat wait()
destination = char.HumanoidRootPart.Position
unit.BodyGyro.CFrame = blah blah
unit.BodyVelocity.Velocity = blah blah move;
until (main.Position - destination).magnitude < 6
stop(destination);
wait(.2);
end
I'm experiencing a lot of lag and inaccuracies when I get about 20 units. Is using 'repeat until' bad for performance? Should I be doing a RenderStepped instead?
Whats the best practices for mass unit movement? I really don't want to be moving the units on the client.
EDIT:
I'm going to make a coroutine instead of lots of scripts. Hopefully this helps
local thread = coroutine.create(function()
while true do
wait(.1)
end
end)
coroutine.resume(thread)

1 comment
https://blog.roblox.com/2012/05/using-wait-wisely/