phoniex
|
  |
| Joined: 03 Feb 2008 |
| Total Posts: 34985 |
|
|
| 09 Apr 2015 05:01 PM |
Title says all. I've seen both of these functions used a lot, but I'm not really sure what the difference between them is.
~Rock is dead. Long live paper and scissors!~ |
|
|
| Report Abuse |
|
|
|
| 09 Apr 2015 05:13 PM |
FindFirstChild finds the first child in the specified area with that name.
WaitForChild will wait until that specific child name appears, example: it could wait for some kind of ("Instance.new") |
|
|
| Report Abuse |
|
|
phoniex
|
  |
| Joined: 03 Feb 2008 |
| Total Posts: 34985 |
|
|
| 09 Apr 2015 05:16 PM |
@Summmer
That makes sense. Thanks for the help.
~Rock is dead. Long live paper and scissors!~ |
|
|
| Report Abuse |
|
|
|
| 09 Apr 2015 06:51 PM |
FindFirstChild: returns the first child with the name you specified, or nil if it doesn't exist
WaitForChild: yields the script until the instance with the name you specified is found. Be wary though as WaitForChild does not take into account name changes of instances. More info below..
http://wiki.roblox.com/index.php?title=API:Class/Instance/FindFirstChild http://wiki.roblox.com/index.php?title=API:Class/Instance/WaitForChild |
|
|
| Report Abuse |
|
|
|
| 09 Apr 2015 06:54 PM |
For example:
wait(1) local object=script.Parent:WaitForChild("Hello") print("Found the object!")
FindFirstChild:
wait(1) local object=script.Parent:FindFirstChild("Hello") if object then --checking that the object exists, and FindFirstChild didn't return nil. Always check or your script can break. print("Found the object!") |
|
|
| Report Abuse |
|
|