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

Need help with FindFirstChild, WaitForChild and etc..?

I see many people using FindFirstChild,FindFirstChildOfClass and etc but I never understood the point of it. Instead of using those I could just add a dot and it would function the same way from what I noticed. So is there a reason why I should use those rather than just a dot?

2 comments

0

the difference is that if the child doesn't exist while using ".", it errors, when using local var = object:FindFirstChildName('name', x) it just returns nil, and WaitForChild waits until the object exists (note, if it doesn't exst it freezes forever) (the x is an optional max time, and returns nil if not found after that time), it's a good to use WaitForChild, as not everything might be loaded/re

0

You can use "FindFirstChildOfClass" and things like that to find the first tool in a character for example. Of course, there are probably better uses for it. (it litterly searches for the first child of the class you provided

1 answer

✓ Accepted answer

The main reason to use these is to find certain things faster OR wait for them to load. Because, for example the Character of players doesnt load instantly for everyone. So sometimes it shows you an error that the character isnt loaded yet, If you use WaitForChild("Character") It will acutally wait an amount of time and then finds it. No error etc. Its just a saver way to wait/find things. Hope that helps :))

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