I don't know how to make this pathfinding script to loop and I need some help with it.
local torso = script.Parent.Torso.Position local base = workspace.poopoo1.Position local human = script.Parent.Humanoid local path = game:GetService("PathfindingService") :FindPathAsync(torso,base) local points = path:GetWaypoints() if path.Status == Enum.PathStatus.Success then for i,v in pairs(points) do human:MoveTo(v.Position) human.MoveToFinished:wait() if v.Action == Enum.PathWaypointAction.Jump then human.Jump = true end end end wait(2.5) local torso = script.Parent.Torso.Position local base = workspace.poopoo2.Position local human = script.Parent.Humanoid local path = game:GetService("PathfindingService") :FindPathAsync(torso,base) local points = path:GetWaypoints() if path.Status == Enum.PathStatus.Success then for i,v in pairs(points) do human:MoveTo(v.Position) human.MoveToFinished:wait() if v.Action == Enum.PathWaypointAction.Jump then human.Jump = true end end end wait(2.5) local torso = script.Parent.Torso.Position local base = workspace.poopoo3.Position local human = script.Parent.Humanoid local path = game:GetService("PathfindingService") :FindPathAsync(torso,base) local points = path:GetWaypoints() if path.Status == Enum.PathStatus.Success then for i,v in pairs(points) do human:MoveTo(v.Position) human.MoveToFinished:wait() if v.Action == Enum.PathWaypointAction.Jump then human.Jump = true end end end wait(2.5) local torso = script.Parent.Torso.Position local base = workspace.poopoo4.Position local human = script.Parent.Humanoid local path = game:GetService("PathfindingService") :FindPathAsync(torso,base) local points = path:GetWaypoints() if path.Status == Enum.PathStatus.Success then for i,v in pairs(points) do human:MoveTo(v.Position) human.MoveToFinished:wait() if v.Action == Enum.PathWaypointAction.Jump then human.Jump = true end end end wait(2.5) local torso = script.Parent.Torso.Position local base = workspace.poopoo5.Position local human = script.Parent.Humanoid local path = game:GetService("PathfindingService") :FindPathAsync(torso,base) local points = path:GetWaypoints() if path.Status == Enum.PathStatus.Success then for i,v in pairs(points) do human:MoveTo(v.Position) human.MoveToFinished:wait() if v.Action == Enum.PathWaypointAction.Jump then human.Jump = true end end end wait(2.5) local torso = script.Parent.Torso.Position local base = workspace.poopoo6.Position local human = script.Parent.Humanoid local path = game:GetService("PathfindingService") :FindPathAsync(torso,base) local points = path:GetWaypoints() if path.Status == Enum.PathStatus.Success then for i,v in pairs(points) do human:MoveTo(v.Position) human.MoveToFinished:wait() if v.Action == Enum.PathWaypointAction.Jump then human.Jump = true end end end
local torso = script.Parent.Torso.Position local base = workspace.poopoo1.Position local human = script.Parent.Humanoid local path = game:GetService("PathfindingService") :FindPathAsync(torso,base) local points = path:GetWaypoints() while true do if path.Status == Enum.PathStatus.Success then for i,v in pairs(points) do human:MoveTo(v.Position) human.MoveToFinished:wait() if v.Action == Enum.PathWaypointAction.Jump then human.Jump = true end end end wait(2.5) end
In future, do not bring scripts that are from the toolbox to this forum. This is for original work.