I am having a problem with the path finding service. My code isn't working, help me?
01 | local PFS = game:GetService( "PathfindingService" ) |
02 | local hum = script.Parent:WaitForChild( "Humanoid" ) |
03 | local torso = script.Parent:WaitForChild( "Torso" ) |
04 | local path = PFS:CreatePath() |
05 | path:ComputeAsync(torso.Position, game.Workspace.ha.Position) |
06 | local WayPoints = path:GetWaypoints() |
08 | for i, WP in pairs (WayPoints) do |
10 | hum:MoveTo(WP.Position) |
11 | hum.MoveToFinished:Wait( 2 ) |
I ran the code and it doesn't show any errors, but it doesn't do what it is supposed to.