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: how do I...

Previous Thread :: Next Thread 
funnymouse7 is not online. funnymouse7
Joined: 17 Mar 2011
Total Posts: 1741
17 Feb 2013 08:58 AM
Can someone please demonstrate how the findfirstchild() function works?
Report Abuse
Gizmotheboo is not online. Gizmotheboo
Joined: 06 Oct 2010
Total Posts: 92
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 is not online. 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 is not online. 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
Gizmotheboo is not online. Gizmotheboo
Joined: 06 Oct 2010
Total Posts: 92
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 is not online. Joalmo
Joined: 28 Jun 2009
Total Posts: 1160
17 Feb 2013 10:40 AM
> yeah it's FindFirstChild without FindFirstChild hurhur
Report Abuse
kubuto2 is not online. 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
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