Im coding a zombie AI and for some reason when I call GetWaypoints() on my computed path it returns an empty table. I check if the path is successful and run it through a pcall too, model is unanchored and not welded to anything and it will path every once in a while but it doesn’t 90% of the time.
On heartbeat I call this function with the nearest players torso
local function followPath(destination)
local success, errorMessage = pcall(function()
path:ComputeAsync(rootPart.Position, destination)
end)
if success and path.Status == Enum.PathStatus.Success then
waypoints = path:GetWaypoints()
local myWaypoints = waypoints
blockedConnection = path.Blocked:Connect(function(blockedWaypointIndex)
if blockedWaypointIndex >= nextWaypointIndex then
followPath(destination)
blockedConnection:Disconnect()
end
end)
if not reachedConnection then
reachedConnection = hum.MoveToFinished:Connect(function(reached)
if reached and nextWaypointIndex < #waypoints then
nextWaypointIndex += 1
hum:MoveTo(waypoints[nextWaypointIndex].Position)
else
reachedConnection:Disconnect()
blockedConnection:Disconnect()
end
end)
end
for currentWaypointIndex = 2,#waypoints do
nextWaypointIndex = currentWaypointIndex
if myWaypoints == waypoints then
hum:MoveTo(waypoints[currentWaypointIndex].Position)
else
break
end
end
end
end