Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

I am having a problem with the path finding service. My code isn't working, help me?

Asked by 5 years ago
01local PFS = game:GetService("PathfindingService")
02local hum = script.Parent:WaitForChild("Humanoid")
03local torso = script.Parent:WaitForChild("Torso")
04local path = PFS:CreatePath()
05path:ComputeAsync(torso.Position, game.Workspace.ha.Position)
06local WayPoints = path:GetWaypoints()
07 
08for i, WP in pairs(WayPoints) do
09 
10    hum:MoveTo(WP.Position)
11    hum.MoveToFinished:Wait(2)
12end

I ran the code and it doesn't show any errors, but it doesn't do what it is supposed to.

Answer this question