I want the zombies to be able to move but for some reason the script straight up stops working after computeasync but it prints “target near” though. I use coroutines since im creating a script that will move all zombies instead of having a script inside each zombie.
if closest then
print("target near")
local path = pathservice:CreatePath()
path:ComputeAsync(zmb.Torso.Position, closest.Torso.Position)
print("Amt of waypoints"..#path:GetWaypoints())
for i,waypoint in pairs(path:GetWaypoints()) do
print("moving")
zmb:FindFirstChildOfClass("Humanoid"):MoveTo(waypoint.Position)
if waypoint.Action == Enum.PathWaypointAction.Jump then
zmb:FindFirstChildOfClass("Humanoid").Jump = true
end
print(path.Status)
repeat
task.wait()
print("waiting")
until (zmb:WaitForChild("Left Leg").Position-waypoint.Position) <= 4
end
end
I assume it doesn’t print anything past it because one of your arguments passed through your parameter for computing is nil, Are you sure your character is R6 or the zombie is R6 if not change it to HumanoidRootPart or change it accordingly
try printing print(closest.Torso.Position) and print(zmb.Torso.Position) I don’t see any other issues with it but use those print statements and let me know if any of them return nil, Highly doubt assuming you put a safety check, but its good debugging start.