Not detecting child added


In the first clip, I use this. It doesn’t detect child added.

for i,v in pairs(workspace:GetDescendants()) do
	v.ChildAdded:Connect(function(child)
		print(child)
	end)
end

In the second clip (0:20), I use this, however I’m only detecting the workspace child added, so if I add a child in anything not the workspace, it doesn’t detect it.

workspace.ChildAdded:Connect(function(child)
	print(child)
end)

I’m trying to make the first bit of code work.

1 Like

It’s probably because your script is Server-Sided, while your adding instances in the client, which the server doesn’t see.

no its a local script
aweaweaweae

Where is your local script located? It has to be in one of these places to run:

its in starter gui
awewaeawewaewaewaewaewae

oh yeah and I also said that it detects if if I do workspace child added, so yes it does work just not with for loops for some reason but i want to fix that

Ohh, the first one doesn’t work because when you first load in the client, there’s no instances in workspace.

hmmm no, I put a wait(3) before the loop, and by that point the whole map was well loaded.

Ohh, it’s because for .ChildAdded, you aren’t adding anything into the instances already there.
If you want to detect when Descendants of workspace are added, use workspace.DescendantAdded.

2 Likes

Ohhh, I had no idea there was descendent added!