Hello I’m trying to move alot of npc at once and be able to change the direction whend a input comes i dont know how to stop the first command to move to a point the script that i have is these
Toffee:
function moveTo(v,targetpoint)
local function walktroop()
local path = PathS:CreatePath(agentParameters)
local Number = v.Configuration.Number
local LHumanoid = v.Humanoid
local LHumanoidRootPart = v.HumanoidRootPart
local were = SetWere(v,Number)
path:ComputeAsync(LHumanoidRootPart.Position,targetpoint*were)
for k, waypoint in pairs(path:GetWaypoints()) do
if path then
LHumanoid:MoveTo(waypoint.Position)
game.ReplicatedStorage.RemoveEventFolder.SoldierEvents.OnServerEvent:Connect(function()
path:Destroy()
return
end)
LHumanoid.MoveToFinished:Wait()
end
end
path:Destroy()
--moveTo(v,pos * were)
end
coroutine.wrap(walktroop)()
end