Hello! Ive been trying to use pathfinding service to make my NPC’s walk, however, when its asked to jump at a certain waypoint, it wont work. Please help!
Script:
local PFS = game:GetService("PathfindingService")
local debugging = false
local hum = script.Parent:WaitForChild("Humanoid")
local tor = script.Parent:WaitForChild("Torso")
local function createPath(pathway)
local path = PFS:CreatePath()
path:ComputeAsync(tor.Position, pathway)
local waypoints = path:GetWaypoints()
for i, waypoint in pairs(waypoints) do
if waypoint.Action == Enum.PathWaypointAction.Jump then
hum:ChangeState(Enum.HumanoidStateType.Jumping)
end
hum:MoveTo(waypoint.Position)
hum.MoveToFinished:Wait(2)
end
end