ChildAdded event not firing

Im trying to control zombies with one script using collectionservice and spawning them in after a short cooldown. The thing is that I parent the zombies into a folder and the function for the tag doesnt work, so i decided to check when a zombie gets added to the function, then call the function. I used a childadded event and the event doesnt get called at all. i tried printing out the connected function as well and nothing prints out. im so confused as to how this is even happening.

CODE:

game.Workspace.Zombies.ChildAdded:Connect(function(child)
	print(child)
	if child:HasTag("Zombies") then
		print("ye")
		for _, zombie in pairs(taggedZombies) do
			follow(zombie)
		end
	end
end)

Nothing gets printed to the console.

Thanks,
dza

Are you adding them on client? For me everything is working fine

it’s in a script in serverscriptservice

Idk. Try read your code again and check if there’s no any error etc.

figured it out, it was cause i had a while loop going from a previous function that didn’t end so the entire code after it did not work at all. i put the while loop in a task.spawn function to fix

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