Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Modify all group's children at same time?

Asked by 6 years ago

Hey so i’m trying to modify all part childrens of this model but this simple test script does not work…

1parts = workspace.Model:GetChildren()
2 
3 
4 
5parts.Anchored = true

Does anyone know what is the problem?

1 answer

Log in to vote
3
Answered by 6 years ago

You must use a “for” loop. It will loop through each of the group’s children until the goal is met.

1local parts = workspace.Group:GetChildren()
2 
3for i,child in pairs(parts) do
4print("anchoring a part")
5child.Anchored = true
6end
0
Thanks, what is for exactly, and why do people always put i? Igoralexeymarengobr 365 — 6y
0
"For" is for loops. Here's the link if you're interested: https://developer.roblox.com/articles/Roblox-Coding-Basics-Loops Mr_Unlucky 1085 — 6y
Ad

Answer this question