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 4 years ago
local PFS = game:GetService("PathfindingService")
local hum = script.Parent:WaitForChild("Humanoid")
local torso = script.Parent:WaitForChild("Torso")
local path = PFS:CreatePath()
path:ComputeAsync(torso.Position, game.Workspace.ha.Position)
local WayPoints = path:GetWaypoints()

for i, WP in pairs(WayPoints) do

    hum:MoveTo(WP.Position)
    hum.MoveToFinished:Wait(2)
end


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

Answer this question