So I am writing this pathfinding script for a humanoid, and whenever this code runs, the humanoid doesn't move. Is there a fix for this?
local ps = game:GetService("PathfindingService")
local final = gotopart --Part that the ai is moving to.
local ai = script.Parent
local aihum = ai:FindFirstChild("Humanoid")
local path = ps:FindPathAsync(ai.HumanoidRootPart.Position, final.Position)
local waypoints = path:GetWaypoints()
for i,v in pairs(waypoints) do
aihum:MoveTo(v.Position)
aihum.MoveToFinished:Wait()
if v.Action == Enum.PathWaypointAction.Jump then
aihum.Jump = true
end
end
I edited the script to be more user-friendly to the site.
