I understand what's happening but I do not know how to stop it, any help?
This is the script that is located in the NPC, as you can tell, it's non-local. It completely works, the only problem is that it goes to my last location then to me. If you want a visual representation of what's happening, look here.
end local path local torso = script.Parent.Torso local human = script.Parent.Humanoid local players = game.Players local pathfindingService = game:GetService("PathfindingService") pathfindingService.EmptyCutoff = 0.01 local dist = 20 while wait() do for _,v in pairs (game.Workspace:GetChildren()) do if players:FindFirstChild(v.Name) and v.Humanoid then if math.abs((v.Torso.Position - torso.Position).magnitude) <= 5000 then local wend = v.Torso path = pathfindingService:ComputeSmoothPathAsync(script.Parent.Torso.Position,wend.Position,500) Plix = path:GetPointCoordinates() for _,plox in pairs (Plix) do human:MoveTo(plox) human.MoveToFinished:wait() end end end end end