Joeza8901
|
  |
| Joined: 24 Feb 2009 |
| Total Posts: 58 |
|
|
| 20 May 2013 08:40 AM |
hi, I'm learning some basic scripting now and I have no idea what this actually does..
local billboard = WaitForChild(Zone, 'BillboardGui')
I thought that it's the same as
local billboard = Zone.BillboardGui
am I right? |
|
|
| Report Abuse |
|
|
zars15
|
  |
| Joined: 10 Nov 2008 |
| Total Posts: 9999 |
|
|
| 20 May 2013 08:48 AM |
Well you should use WaitForChild only if you know that the object might not be there instantly, but might have a little delay until it appears there.
local billboard = zone:WaitForChild( 'BillboardGui') |
|
|
| Report Abuse |
|
|
|
| 20 May 2013 10:58 AM |
WaitForChild is a great help with respawning characters, because the characters don't respawn instantly. So if your script said char=player.Character and the character hadn't fully respawned, then it would break. So use it to wait for an object to appear. |
|
|
| Report Abuse |
|
|
zars15
|
  |
| Joined: 10 Nov 2008 |
| Total Posts: 9999 |
|
|
| 20 May 2013 11:09 AM |
@jarod
game.Players.PlayerAdded:connect(function(player) player.CharacterAdded:connect(function() print(player.Name.." respawned.") end) end)
--or
humanoid.Died:connect(function() char = game.Players.GetPlayerFromCharacter(humanoid.Parent).CharacterAdded:wait() humanoid = char:WaitForChild("Humanoid") end) |
|
|
| Report Abuse |
|
|
|
| 20 May 2013 11:11 AM |
WaitForChild is a method used to wait for a child to be parented into an Instance, and is very useful if you want to wait for an instance to be there, but not right as the script is running. Once the instance is found, the method then returns that instance, for use.
-bigdaddy92 |
|
|
| Report Abuse |
|
|