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()

Previous Thread :: Next Thread 
skopi is not online. skopi
Joined: 29 Mar 2013
Total Posts: 1297
23 Apr 2015 08:02 PM
With :GetChildren(), Could I get every part in the model, including parts in other models in that model?
Report Abuse
TheNewChicken is not online. TheNewChicken
Joined: 18 Mar 2015
Total Posts: 1997
23 Apr 2015 08:03 PM
umg it gets all children yassss

God grant me the wisdom to not punch stupid ppl, for I know I will go to prison.
Report Abuse
treebee63 is not online. treebee63
Joined: 16 Aug 2010
Total Posts: 376
23 Apr 2015 08:31 PM
It gets ONLY the children, no descendants of that children.
Report Abuse
TimeTicks is not online. TimeTicks
Joined: 27 Apr 2011
Total Posts: 27115
23 Apr 2015 08:41 PM
Workspace
--Model
---Part
--Model2
---Part
--Value


for i,v in pairs(game.Workspace:GetChildren()) do
print(v)
end

>
Model
Model2
Value

Only prints its descendants, not its descendant's descendants.
Report Abuse
Viscoelastic is not online. Viscoelastic
Joined: 04 May 2012
Total Posts: 269
23 Apr 2015 08:44 PM
Yes, if you make a recursive function for it.
Report Abuse
128GB is not online. 128GB
Joined: 17 Apr 2014
Total Posts: 8056
24 Apr 2015 01:56 AM
local function getDescendants(instance, filter)
local descendants, output, x = instance:GetChildren(), {}, 1
while (descendants[x]) do
table.insert(output, (((filter and filter(descendants[x])) or (not filter)) and descendants[x] or nil))
for _, child in next, descendants[x]:GetChildren() do
table.insert(descendants, child)
end
x = (x + 1)
end
return output;
end;


for _, descendant in next, getDescendants(instance) do
print(descendant.Name)
end
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