I don't know if this can be done but I tried researching whether it is possible to use the function :GetChildren() to change and set the same property for all parts under a model. How can this be done, if possible?
myModel = script.Parent.Model
myModelParts = myModel:GetChildren()
myModelParts.Anchored = true
myModelParts.Transparency = 0.5
myModelParts.Position = myModelParts.Position+Vector3.new(1,0,1)

6 comments
Good answer! Would like to quickly note in case Rayan isn't aware; this code will error if any children in myModel happen to not have the properties 'Anchored', 'Transparency', and 'Position.' Adding an if statement to check, for example, that the child is a basepart will remedy this issue.
You're right, edited the code to add that. Thanks.
Thanks for a great answer! However, I want to understand what "_, child in pairs()" means? Everything else makes sense to me.
I've also noticed that the for do loop doesn't contain the starting, ending values, and the increment. Maybe you can explain this to clear up the confusion I'm experiencing.
Yep! This loop is called a "generic loop". You can loop through a table by saying
for key, value in pairs(table) do, and key will be the key of the table (aka 1, 2, 3 or if you have custom keys), and value will be the value of that element. So table["Hello"] = 3, the key would be "Hello" and the value would be 3.There iterative loop is using a number and an increment value, but that's usually used when you know exactly how many times you want to loop. For tables, they are usually sizes that we don't know when we're looping through them (for example, :GetChildren()).