I was watching this tutorial online on how to use Pathfinding Service but for some reason it’s not working…
local PFS = game:GetService("PathfindingService")
local Humanoid = script.Parent.Humanoid
local RootPart = script.Parent:FindFirstChild("HumanoidRootPart") or script.Parent:FindFirstChild("Torso")
local Destination = workspace.Part.Position
local Path = PFS:CreatePath()
Path:ComputeAsync(RootPart.Position, Destination)
local Waypoints = Path:GetWaypoints()
for key,waypoint in pairs(Waypoints) do
Humanoid:MoveTo(waypoint.Position)
if waypoint.Action == Enum.PathWaypointAction.Jump then
Humanoid:ChangeState(Enum.HumanoidStateType.Jumping)
end
Humanoid.MoveToFinished:Wait()
end