i know this question is very simple but im new, how do i find all children, for example
LOL = script.Parent.DaModel.FindAllChildren --idk i just put FindAllChildren because im a noob LOL.visibility = 1
local Model = script.Parent.DaModel local DaModelChildren = DaMode:GetChildren()
Model = game.Model Children = Model:GetChildren()
Edit: Looks like the rblx devs added a function find all children late last year: https://wiki.roblox.com/index.php?title=API:Class/Instance/GetDescendants The function below is the old way of doing it, just use GetDecendants.
Original Answer: Good question, this isn't an obvious thing. To get all of them, I use a recursive function, which is a fancy way of saying that it calls itself over and over.
function getAllChildren(o) local foundObjects = {} for i,v in pairs(o:GetChildren()) do table.insert(foundObjects, v) for j,k in pairs(getAllChildren(v)) do table.insert(foundObjects, k) end end return foundObjects end
I'll just leave the code here, in case anyone else needs it.
There is a function called :GetDescendants()
. http://wiki.roblox.com/index.php?title=API:Class/Instance/GetDescendants. Since I don't support leechers I won't be fixing your code but merely providing an example.
for i,v in pairs (game.Workspace:GetDescendants()) do --Gets the descendants using iPairs print(v) --Prints the descendants end--ends
Please accept answer if this helped! Again, I do not like the leechers that don't accept answers.