Hello Community! I am attempting to get the children of "every" children on a Parent.
This is the script I experimented on but didn't work lol.
local folder = game:GetService("ReplicatedStorage").Folder:GetChildren()
local children = folder:GetChildren()
Thanks!
I think that what you are looking for is Instance:GetDescendants(). It will allow you to go through every child, and the children of that child and so forth.
local folder = game:GetService("ReplicatedStorage").Folder:GetDecendants()
or
local folder = game:GetService("ReplicatedStorage").Folder:GetChildren() local children = {} for i, v in pairs(folder) do table.insert(children, folder[i]:GetChildren()) end
But the first one will include any of the folder's children's children.
Use the output at all times when scripting, so you will get more detailed info on the error. Just by the code you used, I can guess your error was something like Attempt to call a nil value
local folder = game:GetService("ReplicatedStorage").Folder for _, v in pairs(folder:GetDescendants()) do print(v.Name) -- v equals all of the children and children of children in the folder. end
That will do it.