Script seems to stop working on and after computeasync

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
1 Like

Does it tell you the amount of waypoints, or is that completely disregarded as well?

it doesnt even tell me the amount of waypoints. It just prints out target near which is before compute async

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

both characters are r6. but ill try humanoidrootpart

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.

alr so i used waitforchild and i forgot to add .character beside the survivor. Im gonna try to put it now and see if its fixed

Alright so yeah it works now since i putted the players character on that part. Thank you for trying to help McGamerNick!

1 Like

You are welcome and good luck on your project!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.