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

How do you yield for all the custom descendants of a character?

I'm trying to make it so if someone joins my game, it'll remove this hat https://www.roblox.com/item.aspx?seoname=Flintstones-Car&id=439315202

I've stumbled into a problem though, because I haven't found a definitive way to determine if the hat is in the character, because elements such as the hat and clothes load after the character is instanced.

How do I yield for the hats and everything else to be loaded?

1 answer

I just figured a way out after the fact of posting this, but it may not be most efficient way.

pcall(function()
	local Hat = Player.Character:WaitForChild('Flintstones Car')
	if Hat then
		stupidHat:Destroy()
	end
end)

1 comment

0

No need to pcall, since it will not bug anyway. This is probably one of the only ways, I'll check to see if there are any events/bools in a Player.

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