Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Need help with making PathFinding to the closest part?

Asked by
Rumln 0
3 years ago

title says it all i already have most the script wrote down

local pfs = game:GetService("PathfindingService")

local human = game.Players.LocalPlayer:WaitForChild("Humanoid")
local torso = game.Players.LocalPlayer:WaitForChild("Torso")

local path = pfs:CreatePath()
path:ComputeAsync(torso.Position, waiting for end part)
local waypoints = path:GetWaypoints()

if path.Status == Enum.PathStatus.Success then

end
for i,waypoint in pairs(waypoints) do
    if waypoint.Action == Enum.PathWaypointAction.Jump then
        human:ChangeState(Enum.HumanoidStateType.Jumping)
    end
    human:MoveTo(waypoint.Position)
    human.MoveToFinished:Wait(2)

end
human:MoveTo(game.Workspace.put ending part here)

again its not done but i need too know how to make it goto the nearest part

Answer this question