Im currently making a system where customers will come into your restaurant and will take a seat. However in this game, you can build your restaurant however you would like.
So, before loading and spawning in the customer NPC’s, i would like it to run a check to see if it is possible that from where they spawn to go and walk to a seat. And if the pathfind is not possible, it will warn the plot owner.
local success, errorMessage = pcall(function()
path:ComputeAsync(character.PrimaryPart.Position, destination)
end)
It will only return success as true if the pathing returns a valid path.
You can then navigate or alert:
if success and path.Status == Enum.PathStatus.Success then
-- For each waypoint, create a part to visualize the path
for _, waypoint in path:GetWaypoints() do
<blah> move etc...
end
else
-- Send an alert to the player
end