Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How can I get this to wait for children before continuing?

Hello. I made glasses that detect all player’s location, health, stats, etc.

The stats, icons, buttons, etc. are in Gui form and are located in the playergui of the player.

Each time a player dies, their respective Gui tag disappears.

Each time an NPC or Player spawns, I want to add a tag to them as well. So, anytime someone dies, they respawn with a tag.

Im using…

workspace.ChildAdded:Connect(function(child)

if child:FindFirstChild(“Humanoid”) then

— Code to add tag goes here

end)

I keep getting “Humanoid is not a valid member…” How can I make this work for any model added that has a humanoid?

1 answer

I think WaitForChild fixed the problem

workspace.ChildAdded:Connect(function(child)
	 
	if child:WaitForChild(“Humanoid”) then
	 
	— Code to add tag goes here
	 
	end)

This discussion is preserved as it was. New answers, comments, and votes are closed.