Basically i want to make a table tree with the instances of a folder and the result need to be something like this the values in the folder are intValues.
any help?
Basically i want to make a table tree with the instances of a folder and the result need to be something like this the values in the folder are intValues.
any help?
do you mean local Folder = Instance.new(“Folder”)?
no, like this and i want to have the same value and the same name in the table
From what I can tell, you want to take a folder Instance, which has IntValues inside it, and put it into an array. Try this:
contents = {} -- this makes a table that you can write into. put this where you need
for i,v in pairs(folder:GetChildren()) do
contents[i] = v.Value -- v is the IntValue
end
Tables | Roblox Creator Documentation is an excellent resource for finding information regarding tables in Roblox.
I made a module to do this awhile ago if you want to use it, it supports nested folders/tables and whatnot.
The index gets set to the value’s name, the value is set to the value’s value property.
it says attempt to index string with number
Maybe try looping through the folder and adding the value inside a table.
local info = {}
for _, value in pairs(Folder:GetChildren()) do
info[value.Name] = value.Value
end
print(info)
don’t work (ignore this)
error in the output
Seems to be working fine for me, can you show me your code?
local k = InventoryCopy[position]
for _, value in pairs(descendant.Information:GetChildren()) do
k[value.Name] = value.Value
end
local folder = folderPathGoesHere
local TableTree = {}
TableTree["Dog"] = {
Level = folder.Level.Value,
Exp = folder.Exp.Value,
ExpMax = folder.ExpMax.Value
}
print(TableTree["Dog"])
This might be because your k
variable is a string, try setting it to a table.
not a good solution, why is i want to add another stat and another pet don’t have it?
Then you would loop through all the Instances of the folder creating a new dictionary entry with the name, and value.
Thanks now it works!