spawn(function()
for _, waypoints in pairs(script.Parent.Waypoints:GetChildren()) do
local path = PFS:CreatePath()
path:ComputeAsync(randomMinion.HumanoidRootPart.Position, waypoints.Position)
local wp = path:GetWaypoints()
for _, wp2 in pairs(wp) do
randomMinion.Humanoid:MoveTo(wp2.Position)
randomMinion.Humanoid.MoveToFinished:Wait(0.0001)
end
end
print(randomMinion.Name.." finished the track")
script.Parent.BuildingEntry.Health.Value -= (math.random(2,5))
randomMinion:Destroy()
end)
end
end
When I am using MoveTo() for my Tower Defense game, the “bad guys” are stuttering. I first suspected that It was a studio issue, but it was also present in the roblox client itself. I also tried only sending 1 “bad guy” but the problem arose again, meaning it is not an issue with roblox studio nor the amount I am sending out. Any suggestions?
If anyone was having trouble with the video (Because i sure was), what is being shown is the NPCs almost teleporting in a way, a couple of studs each time, instead of smoothly moving. And as I stated before, the number of the NPCs seems to have no effect, because only having 1 at a time is the same results…
NOTE: I know the MoveToFinished:Wait has 0.0001, that was something I was debugging with and forgot to remove, but even removing that has the same results
I’m not sure, but did you try moving the wait(.0001 is irrelevant, since wait() is always greater than .0001) to the line after the loop so it isn’t happening every time the loop is run, for every randomMinion?
That’s strange, I’m having the exact same problem as you with my own code and I’m not even waiting. I’m using MoveToFinished but with a function rather than waiting for it to complete.
Still having problems with stuttering, though. Do you know if they begin to stutter again whenever you walk your character really close to them? That seems to be what happens with me. The movement is fine until I’m near the humanoids. Guessing it might be a network ownership issue or something.
It may very well be a network ownership; that was one of the solutions I was considering before I got the solution from Scottifly. If using network ownership doesn’t work, then I would suggest using Humanoid.MoveToFinished:Wait()