I have a zombie script that works pretty well for the most part, but everyone once in a while they get stuck. I thought it was an issue with my script for a while until I drew out the waypoints to see exactly what was going on and it was trying to go through a wall. Is this worth reporting as a bug or is something in my script wrong or are my walls too thin or something? Any help would be appreciated!
path:ComputeAsync(rootPart.Position, targetRoot.Position)
if path.Status == Enum.PathStatus.Success then
task.spawn(function()
local loopEnded = false
local cancel = nil
cancel = loopFinished.Event:Connect(function()
cancel:Disconnect()
loopEnded = true
end)
local waypoints = path:GetWaypoints()
for i = 1, #waypoints do
humanoid.Jump = waypoints[i].Action == Enum.PathWaypointAction.Jump
humanoid:MoveTo(waypoints[i].Position)
movingFinished.Event:Wait()
if loopEnded then break end
end
humanoid:MoveTo(rootPart.Position, rootPart)
end)
task.wait(1)
else
humanoid:MoveTo(targetRoot.Position, targetRoot)
humanoid.Jump = true
end