I’m making a Tower Defense game and im using this script to move through the path, but the problem is that is stops 8 seconds in, ive looked through devforum and google and cant find a solution. Please help
my zombie code (server):
local zombie = script.Parent
local waypoints = script.Parent.Parent.Waypoints
for waypoint=1, #waypoints:GetChildren() do
zombie.Humanoid:MoveTo(waypoints[waypoint].Position)
zombie.Humanoid.MoveToFinished:Wait()
end
zombie:Destroy()
Maybe you could do this, but it is probably less optimized than adding new waypoints in middle path.
for waypoint = 1, #waypoints:GetChildren() do
repeat task.wait(0.1)
zombie.Humanoid:MoveTo(waypoints[waypoint].Position)
until (zombie.HumanoidRootPart.Position - waypoints[waypoint].Position).Magnitude <= 3
end