I’ll go straight to the point, i have been learning PathFindingService for some time. This is the script and result of it i’ve done for demonstration:
local service = game:GetService("PathfindingService")
wait(5)
local humanoid = script.Parent:WaitForChild("Humanoid")
local torso = script.Parent:WaitForChild("Torso")
local path = service:CreatePath()
path:ComputeAsync(torso.Position, game.Workspace.endp.Position)
local waypoints = path:GetWaypoints()
for i, waypoint in pairs(waypoints) do
local part = Instance.new("Part")
part.Shape = "Ball"
part.Material = "Neon"
part.Size = Vector3.new(0.5,0.5,0.5)
part.Position = waypoint.Position + Vector3.new(0,2,0)
part.Anchored = true
part.CanCollide = false
part.Parent = game.Workspace
if waypoint.Action == Enum.PathWaypointAction.Jump then
humanoid:ChangeState(Enum.HumanoidStateType.Jumping)
end
humanoid:MoveTo(waypoint.Position)
humanoid.MoveToFinished:Wait()
end
humanoid:MoveTo(game.Workspace.endp.Position)
https://gyazo.com/2c3419c1ce7ec8761a27f17338d1e8a6
Basically what i want to know is how can i make it so when it is done doing the PathFinding, after touching the green part it starts a new pathfinding for another part.
Any help is appreciated, thanks.