Hi There. I have a working Pathfinding system in place however I was wondering if there was any way to make check points. So it would go to say point A then to B and finally to C?
This is my current code:
local PathfindingService = game:GetService("PathfindingService")
-- Variables for the person, its humanoid, and destination
local person = script.Parent
local humanoid = person.Humanoid
local destination = workspace.Destination1
-- Create the path object
local path = PathfindingService:CreatePath()
-- Compute the path
path:ComputeAsync(person.HumanoidRootPart.Position, destination.Position)
-- Get the path waypoints
local waypoints = path:GetWaypoints()
-- Loop through waypoints
for _, waypoint in pairs(waypoints) do
-- Move person to the next waypoint
humanoid:MoveTo(waypoint.Position)
-- Wait until person has reached the waypoint before continuing
humanoid.MoveToFinished:Wait()
end
Any help would be appreciated. Thanks