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 » Scripters
Home Search
 

Re: getchildren() apply to all?

Previous Thread :: Next Thread 
gogo6104 is not online. gogo6104
Joined: 10 Feb 2010
Total Posts: 326
10 Sep 2016 02:07 PM
I still don't fully understand how to take use of GetChildren()

How do I make it so the script gets the children of a location and copies an item into each child of that location?

Here's what I did:

location = game.Workspace:GetChildren()
for i,e in pairs do
script.ExampleItem:Clone().Parent = children
end


- Seth (gogo6104) || Developer || GFX Designer
Report Abuse
thedailyblarg is not online. thedailyblarg
Joined: 26 Feb 2012
Total Posts: 5506
10 Sep 2016 02:08 PM
that is completely wrong

http://wiki.roblox.com/index.php?title=Loops

for _,child in pairs(workspace:getChildren()) do
script.ExampleItem:Clone().Parent = child
end
Report Abuse
Mister_Manakin is not online. Mister_Manakin
Joined: 16 Sep 2009
Total Posts: 1935
10 Sep 2016 02:11 PM
I normally use ipairs though, since there's less chance of erroring by trying to copy something into a nil object.
Report Abuse
thedailyblarg is not online. thedailyblarg
Joined: 26 Feb 2012
Total Posts: 5506
10 Sep 2016 02:16 PM
^ there wont be a nil object because all references to the object will still exist even if their parent is removed
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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