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

Making all children visible false?

Asked by 5 years ago

Hello I've written this script

1script.Parent.MouseButton1Click:Connect(function()
2    local Children = script.Parent.Parent:GetChildren()
3Children.Visible = false
4end)

but it doesn't make the children visible false?

0
It is, but can't you change instance's properties? LegoUnicornRoblox 37 — 5y

2 answers

Log in to vote
0
Answered by 5 years ago

You want to iterate through with a for loop

1script.Parent.MouseButton1Click:Connect(function()
2    local model = script.Parent.Parent:GetChildren()
3    for i,v in pairs(model)do
4        v.Visible = false
5    end
6end)
Ad
Log in to vote
0
Answered by 5 years ago

Thank you AlbertoMiAmigo,

I've fixed it though just by listing the children

1script.Parent.MouseButton1Click:Connect(function()
2        local Children = script.Parent.Parent.Content and script.Parent.Parent.MoreContent
3    Children.Visible = false
4    end)

Answer this question