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: Using a Directory with a Table

Previous Thread :: Next Thread 
Gogeta is not online. 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
Shagmeister is not online. Shagmeister
Joined: 24 Jul 2014
Total Posts: 266
29 Jun 2015 09:49 AM
for i,v in pairs(Hat:GetChildren())do
v.Name=""
end

have fun, #2k15beib
Report Abuse
Gogeta is not online. 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
FOXmcloud021 is not online. FOXmcloud021
Joined: 14 Apr 2012
Total Posts: 3512
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
FOXmcloud021 is not online. FOXmcloud021
Joined: 14 Apr 2012
Total Posts: 3512
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
FOXmcloud021 is not online. FOXmcloud021
Joined: 14 Apr 2012
Total Posts: 3512
29 Jun 2015 09:56 AM
--Make sure CHARACTER* has been defined as the player's character
Oops


Logic is best
Report Abuse
Gogeta is not online. 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 is not online. 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
warspyking is not online. warspyking
Joined: 15 Nov 2011
Total Posts: 13947
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
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