you would need to loop through all of the models using a pairs loop.
for i,v in pairs() do
end)
that is a pairs loop. looks sorta similar to a for i = x,x,x loop.
"i" is the index. you can change the index to any letter you want.
"v" is the value. you can also change it to any letter you want.
pairs is used in tables and getchildren and some other things.
there is also ipairs that stops when there is a nil value but that won't be used.
in the parentheses, you would put the table or the model where you want to get the children.
and whatever is in the parentheses is what the value is.
for i,v in pairs(NameOfTheModelWithScripts:GetChildren()) do
end)
since we have access to whatever is in the model, we can change the property.
but what if there is another object in the model that isn't a script and doesn't have the disabled property. well, you can use if v:IsA("PutClassName") then
or if v.ClassName == "PutClassName" then
IsA is recommended
"v" inside of one of those if statements would only affect objects with the certain class.
but outside of it, it will affect object with any class. the class name is usually the name that the object starts out when inserting an object (that rule doesn't apply for some objects. such as a shirt. when a shirt is inserted, studio will automatically change its name to "Clothing")
oh and remember when putting the class name, make sure it includes the capitals. it's case sensitive. oh and the classname is a visible property.
for i,v in pairs(NameOfTheModelWithScripts:GetChildren()) do
if v:IsA("ClassNameHere") then
end
end)
4 comments
did the disable wrong :)
lol
oops sorry for downvote
i think get descendatns would be better in this situation, and its better to explain to him what the loop does