local path = PathfindingService:CreatePath()
path:ComputeAsync(character.HumanoidRootPart.Position, Destination.Position)
if path.Status ~= Enum.PathStatus.Success then
print("Fail")
end
local waypoints = path:GetWaypoints()
for i, waypoint in pairs(waypoints) do
local part = game.ReplicatedStorage.MapGps:Clone()
part.Position = waypoint.Position
part.Parent = script.Parent.ScreenGui.Map.Minimap
game:GetService("Debris"):AddItem(part,.1)
if i >= zoom/4 then
break
end
end
This is just a basic pathfinding script, however it wont create a path if the target destination is too far from the player, but only if it hasnt found one already. This script runs on a RenderStepped loop and acts as a gps for the player. A player is able to reach the target, there are no obstructions or gaps. If the script is unable to find a path, I am able to walk closer to the destination and it will eventually find a path, and will no longer error, even if I run back to where I started from.
