gmatch
|
  |
| Joined: 21 May 2014 |
| Total Posts: 1173 |
|
|
| 16 Oct 2016 04:02 PM |
For example:
> Map > Chairs > Different Chairs How would I get the children of "Different Chairs"?
|
|
|
| Report Abuse |
|
|
gmatch
|
  |
| Joined: 21 May 2014 |
| Total Posts: 1173 |
|
| |
|
|
| 16 Oct 2016 04:11 PM |
Easy.
for i,v in pairs(workspace.Map:GetChildren()) do if v.Name == "Chairs" then for ii,vv in pairs(v:GetChildren()) do -- Code here end end end |
|
|
| Report Abuse |
|
|
gmatch
|
  |
| Joined: 21 May 2014 |
| Total Posts: 1173 |
|
|
| 16 Oct 2016 04:12 PM |
LOL I TOTALLY FORGOT I AND V WERE JUST VARIABLES
rip me, nab move
|
|
|
| Report Abuse |
|
|
|
| 16 Oct 2016 04:33 PM |
this will get stuff that is very nested. The other guys will only get 2 layers mine will get infinite layers.
function getAllChildren(model) local children={} for _,v in next,model:GetChildren()do table.insert(children,v) if(#v:GetChildren()~=0)then local c=getAllChildren(v) for _,n in next,c do table.insert(children,n) end end end return children end
--example usage local allInWorkspace=getAllChildren(workspace) for _,v in next,allInWorkspace do print(v) end
|
|
|
| Report Abuse |
|
|