|
| 17 Feb 2013 08:58 AM |
Can someone please demonstrate how the findfirstchild() function works?
|
|
|
| Report Abuse |
|
|
|
| 17 Feb 2013 10:19 AM |
game.Workspace.NAME:FindFirstChild("Right Leg"):Remove() if you do game.Workspace.NAME.Right Leg:Remove() it won't work findfirstchild is when the title has a space or any symbol as below Scripters-Rock Scripters rock Scripters@rock, etc Above would need find first child. |
|
|
| Report Abuse |
|
|
Joalmo
|
  |
| Joined: 28 Jun 2009 |
| Total Posts: 1160 |
|
|
| 17 Feb 2013 10:29 AM |
Gizmotheboo, just because it has a space in it's name, doesn't mean you use FindFirstChild().
If you had a part in Workspace named "Super Noob" you could do this:
game.Workspace["Super Noob"].Name = "Not a noob";
You use FindFirstChild() when you're trying to index something that may not exist, for example, a player's torso. |
|
|
| Report Abuse |
|
|
miz656
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 15336 |
|
|
| 17 Feb 2013 10:31 AM |
Like Joalmo said, except he used a bad example(in my opinion)
if Workspace:FindFirstChild("Model") then --if model is there Workspace.Model:Destroy() end
|
|
|
| Report Abuse |
|
|
|
| 17 Feb 2013 10:39 AM |
| Thats if it is a unlocked model. And the guy below me thats still findfirstchild just without :FindFirstChild |
|
|
| Report Abuse |
|
|
Joalmo
|
  |
| Joined: 28 Jun 2009 |
| Total Posts: 1160 |
|
|
| 17 Feb 2013 10:40 AM |
| > yeah it's FindFirstChild without FindFirstChild hurhur |
|
|
| Report Abuse |
|
|
kubuto2
|
  |
| Joined: 16 Jul 2008 |
| Total Posts: 1275 |
|
|
| 17 Feb 2013 11:21 AM |
What does findFirstChild do?
It searched the objects children for the object you are trying to locate.
How do I use it?
You want to use it in a if then statement. Mainly because you are searching for if the object exist.
Ex:
if Workspace:findFirstChild("Message") then -- checks if object exists Workspace:Destroy() -- Destroy's the object if it does exist end -- ends the if then statement |
|
|
| Report Abuse |
|
|