How to get the all children of all children off a folder?

Yeah so heres my problem i want to get the properties of all children of all children of a folder.
Folder-AllChildren-AllChildrenoftheChildren.Name

What do you mean? Can you clarify? Do you mean all descendants or only all children of each child? Which properties? All of them? Or just the name?

1 Like

So i have a folder
in the folder are many children and i want to get all of them
in each children are many childrens to and those i want to get too
and those i want to get the properties of those children in the children

Might as well do GetDescendants()

If I were to add more children to the bottommost layer of children would you want to get those too? If so consider using Folder:GetDescendants() which will return an array of all children, and their children, and those childrens’ children, and so on. If you only want to get the children of the children then the following code should work.

local Children2 = Folder:GetChildren()
for _, c in pairs(Children2) do
   Children2[#Children2 + 1] = unpack(c:GetChildren())
end

As for the properties, I still don’t understand what you mean.

Alr let me test it, thank you. Property like:

MyPart.Name

What reason exactly do you need the names for?

Name was only an example. i have IntValues and i need all values for saving them

Please share your explorer structure.

I feel like there’s a better way to store data than nested IntValues. Have you considered a table?

yyy

Ik my scripting style is pretty odd

You just need to loop through every child of a folder:

for i,child in folder:GetChildren() do
    print("children of",child.Name,"are:")
    for i2,child2 in child:GetChildren() do
        print(child2.Name)
    end
end

You should avoid data structures that store information with large amounts of instances. Even if they look appealing, they are very inefficient and a large waste of memory. A simple table-ified equivalent below is an example of what you should do.

PlrValues = {[Plr1] = {[6] = Int}, …}