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

How do I use GetChildren? [ANSWERED]

Asked by
Sam4550 42
10 years ago

Basically, when TextButton1 is pressed, the script should setscript.Parent.Parent's children's active property to false. How do I do this? I've got most of the script, I just need to know how to find script.Parent.Parent's children and how to change one of the properties of the children.

Thanks, - Sam4550

1 answer

Log in to vote
1
Answered by 10 years ago

Please provide explanation with your answers. Simply posting code does not spread knowledge of integral scripting processes which helps people understand the logic and reasoning behind your answer.
script.Parent.MouseButton1Click:connect(fucntion()
for i, p in pairs(script.Parent.Parent:GetChildren()) do
p. -- Copy this and then put "p.Visible" or whatnot for whatever properties you want change

end
end)

Basically what I did was connect that the button was clicked. Then I got all of the children in 'script.Parent.Parent'. From there, I used p.Visible or anything, to change the value for all of them.

0
Thanks! Sam4550 42 — 10y
Ad

Answer this question