|
| 07 Dec 2015 06:59 PM |
Trying to put all of workspace's objects into a table if they are a part, then print the table.
items = {}
for i, v in pairs(game.Workspace:GetChildren()) do if v:IsA('Part') then table.insert(items, v.Name) print(table.concat(items, ';')) end end |
|
|
| Report Abuse |
|
|
| |
|
| |
|
|
| 07 Dec 2015 07:54 PM |
| Nothing's wrong, it works fine. Is the script disabled? |
|
|
| Report Abuse |
|
|
| |
|
|
| 07 Dec 2015 11:01 PM |
local items = {} function dig(parent) for index,part in pairs(part:GetChildren()) do if part:IsA('Part') then table.insert(items, v.Name) elseif part:IsA('Model') then dig(part) end end print(print(table.concat(items, ';'))) end dig(game.Workspace) -- That should get you every part inside the Workspace, even the ones hidden deep within models.
[Work not tested, not bested.] |
|
|
| Report Abuse |
|
|
hkep
|
  |
| Joined: 19 Jul 2014 |
| Total Posts: 550 |
|
|
| 08 Dec 2015 12:30 AM |
| change "elseif part:IsA('Model') then" to "else" |
|
|
| Report Abuse |
|
|
hkep
|
  |
| Joined: 19 Jul 2014 |
| Total Posts: 550 |
|
|
| 08 Dec 2015 12:32 AM |
local items = {} function dig(parent) for _,part in pairs(part:GetChildren()) do if part:IsA('Part') then -- might want to check for WedgeParts etc.. table.insert(items, part) -- v.Name is supposed to be part else dig(part); end end print(print(table.concat(items, ';'))) end dig(game.Workspace) |
|
|
| Report Abuse |
|
|
chimmihc
|
  |
| Joined: 01 Sep 2014 |
| Total Posts: 17143 |
|
|
| 08 Dec 2015 01:13 AM |
Search = function(cn,p) local Childs = {} local function G(p) for i = 1,#p do if p[i]:IsA(cn) then table.insert(Childs,p[i].Name) end G(p[i]:GetChildren()) -- ignoring parts' children is stupid end end G(p:GetChildren()) print(table.concat(Childs,";")) end
Search("Part",workspace) |
|
|
| Report Abuse |
|
|
AkaLua
|
  |
| Joined: 27 Jul 2012 |
| Total Posts: 526 |
|
|
| 08 Dec 2015 01:51 AM |
items = {}
for i, v in pairs(game.Workspace:GetChildren()) do if v:IsA('BasePart') then table.insert(items, v.Name) end end
for i = 1,#items do print(items[i].Name) end
-____________________________- |
|
|
| Report Abuse |
|
|
vlekje513
|
  |
| Joined: 28 Dec 2010 |
| Total Posts: 9057 |
|
|
| 08 Dec 2015 02:26 AM |
| put the table.concat out of the loop. |
|
|
| Report Abuse |
|
|
|
| 08 Dec 2015 02:33 AM |
dig=function(a,i)if type(a)~='number' then table.foreach(a:children(),function(b)dig(b,i) end) if a:IsA'BasePart' then table.insert(i,a) end end return i end local items=dig(workspace,i) |
|
|
| Report Abuse |
|
|
|
| 08 Dec 2015 04:26 PM |
local items = {} function dig(parent) for index,part in pair(parent:GetChildren()) do if part:IsA('BasePart') then table.insert(items, part.Name) if #part:GetChildren() > 0 then dig(part) end end end
dig(game)
-- Get every part of the ascendant.
[Work not tested, not bested.] |
|
|
| Report Abuse |
|
|