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 |
|
|
|
| 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
|
  |
| 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
|
  |
| 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 |
|
|
|
| 23 Apr 2015 08:44 PM |
| Yes, if you make a recursive function for it. |
|
|
| Report Abuse |
|
|
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 |
|
|