wait(.5) local player = script.Parent local target = game.Workspace.Finish.Position local points = game.Workspace.Points:GetChildren() for i,v in pairs (points) do player.Humanoid:MoveTo(v.Position) repeat distance = (v.Position - player.Torso.Position).magnitude wait() until distance < 1 end
why wont the npc move? i want the npc to move from 1 point to next until it gets to its destination please help.
You're confused so I'll just make you a script and comment some explanations. This is a script & there is only 1 of them inside of the model of the NPC.
wait(.5) local player = script.Parent local target = game.Workspace.Finish.Position local PFind = game:GetService("PathfindingService") -- Get the service so we can make a Path quicker local Path = PFind:ComputeRawPathAsync(player:WaitForChild("Torso"), target, 500) -- 1st argument should be the pos of your NPC, then where it will go, then the max length of the path (In studs) if Path.Status == Enum.PathStatus.Success then -- We need to make sure the path was actually made without error; so check for Success for _ , Vector3 in pairs(Path:GetPointCoordinates()) do -- :GetPointCoordinates() will give you a table of vector3 values in order from closest to farthest of start point (Being the NPC torso) player:WaitForChild("Humanoid"):MoveTo(Vector3) -- Make this NPC move to a point repeat wait() local magnitude = (player.Torso.Position - Vector3).magnitude until magnitude < 3 -- this repeat until loop will stop this script from trying to move the NPC to a new point until a certain distance is met end end
If this DOES NOT WORK, please comment bellow with the exact error, I have not tested this because I didn't have an NPC made to try it. If this works and you have questions, ask any questions and I will answer, also, don't forget to accept my answer if this works!