Gogeta
|
  |
| Joined: 25 Nov 2006 |
| Total Posts: 583 |
|
|
| 29 Jun 2015 09:48 AM |
I'm trying to use all the names in a directory I've done it like this. local table = game.Lighting.Clothes.Hat:GetChildren() That method does not work. This one does. local table = {"oculus","oculusgreen","oculuspurple"} How could I use all the names of the children of a directory as a table? |
|
|
| Report Abuse |
|
|
|
| 29 Jun 2015 09:49 AM |
for i,v in pairs(Hat:GetChildren())do v.Name="" end
have fun, #2k15beib |
|
|
| Report Abuse |
|
|
Gogeta
|
  |
| Joined: 25 Nov 2006 |
| Total Posts: 583 |
|
|
| 29 Jun 2015 09:51 AM |
| I just want the names in a list. The function of this is to check the character for the hats in the list and destroy them. I don't want to manipulate the directory. |
|
|
| Report Abuse |
|
|
|
| 29 Jun 2015 09:51 AM |
You could also do what Shagmeister did and use table.insert(I think that's what it is) to put v into a new table
Logic is best |
|
|
| Report Abuse |
|
|
|
| 29 Jun 2015 09:55 AM |
for i,v in pairs (character:GetChildren()) do --Make sure children has been defined as the player's character for x,l in pairs (table) do if v.Name == l then v:Destroy() end end end
Logic is best |
|
|
| Report Abuse |
|
|
|
| 29 Jun 2015 09:56 AM |
--Make sure CHARACTER* has been defined as the player's character Oops
Logic is best |
|
|
| Report Abuse |
|
|
Gogeta
|
  |
| Joined: 25 Nov 2006 |
| Total Posts: 583 |
|
|
| 29 Jun 2015 09:59 AM |
local d = c:GetChildren() for i=1, #d do -- local table = {"oculus","oculusgreen"} for _,v in pairs (game.Lighting.Clothes.Hat:GetChildren()) do v.Name = "" if d[i].Name == v then d[i]:Destroy() end end end This is the context in which I'm using and I used your method but it is not working. |
|
|
| Report Abuse |
|
|
Gogeta
|
  |
| Joined: 25 Nov 2006 |
| Total Posts: 583 |
|
|
| 29 Jun 2015 10:02 AM |
local table = game.Lighting.Clothes.Hat:GetChildren() for i,v in pairs (c.GetChildren()) do --Make sure children has been defined as the player's character for x,l in pairs (table) do if v.Name == l then v:Destroy() end end end I use your method as well but it is still not working all the hierarchies are defined. |
|
|
| Report Abuse |
|
|
|
| 29 Jun 2015 10:29 AM |
local names = {}
for i,v in pairs(game.Lighting.Clothes:GetChildren()) do if v:IsA("Hat") then table.insert(names, v) end end |
|
|
| Report Abuse |
|
|