Hello. My problem is whenever I jump the NPC loses the path, I reckon this is something to do with height obviously but I don’t know how to fix it i’ve tried to brainstorm to no avail!
Here’s a gif (the NPC get’s stuck because no path obviously)
Whenever I jump the NPC stutters because the path is lost. (tried it with ROBLOX’s wiki pathfinding and with my own).
What I think is to check if the waypoints exist when it’s lost and move the humanoid to the last waypoint.
I don’t know if it’s the solution though. help please
local success, errorMessage = pcall(function()
path:ComputeAsync(Root.CFrame.Position, position) -- position is character's HRP position, and root is the NPC
end)
if not success or path.Status ~= Enum.PathStatus.Success then
print(path.Status) -- the print
return
end
local waypoints = path:GetWaypoints()
if path and waypoints or checkw(waypoints) then
if checkw(waypoints) ~= nil and checkw(waypoints).Action == Enum.PathWaypointAction.Walk then
Humanoid:MoveTo( checkw(waypoints).Position )
Humanoid.Jump = false
end
end