New: Nitro Boost our Discord server and receive full donation perks here on the website! Join the Scripting Helpers Discord Server to learn more! You can also Support on Patreon as always.
Still have questions? Join our Discord server and get real time help.
Log in to vote

Modify all group's children at same time?

Asked by 1 year ago

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

parts = workspace.Model:GetChildren()

parts.Anchored = true

Does anyone know what is the problem?

1 answer

Log in to vote
Answered by 1 year ago

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

local parts = workspace.Group:GetChildren()

for i,child in pairs(parts) do
print("anchoring a part")
child.Anchored = true
Thanks, what is for exactly, and why do people always put i? Igoralexeymarengobr 330 — 1y
"For" is for loops. Here's the link if you're interested: Mr_Unlucky 1085 — 1y

Answer this question