generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: It Amazes Me How Many People Don't Know This

Previous Thread :: Next Thread 
DrProx is not online. DrProx
Joined: 18 Nov 2009
Total Posts: 1138
08 Sep 2013 01:33 PM
FindFirstChild has a SECOND PARAMETER!

It's a boolean value and when set to true it searches the item specified, and ALL ITS CHILDREN, and its CHILDREN'S CHILDREN, and so on.

By default this is set to false.

Note that it will only return the FIRST instance it finds, so you need to narrow it down where it won't find two or more.
Report Abuse
evolvedpikachu is not online. evolvedpikachu
Joined: 18 Aug 2010
Total Posts: 10696
08 Sep 2013 01:36 PM
I don't use second arg tho.
Report Abuse
Absurdism is not online. Absurdism
Joined: 18 Jul 2013
Total Posts: 2568
08 Sep 2013 01:37 PM
Yeah, it's pretty useful for recursive functions.

repeat
Workspace:findFirstChild('BasePart', true):Destroy()
until not Workspace:findFirstChild('BasePart', true)
Report Abuse
DrProx is not online. DrProx
Joined: 18 Nov 2009
Total Posts: 1138
08 Sep 2013 01:51 PM
@Absurdism

That's always been how I use it. It even helps when you need to batch rename parts. :P

name = "Part1"
repeat
c,d = pcall(function()
workspace:FindFirstChild(name).Name = "PartObject"
end)
until not c
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image