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 4 years ago

Hello I've written this script

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

but it doesn't make the children visible false?

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

2 answers

Log in to vote
0
Answered by 4 years ago

You want to iterate through with a for loop

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

Thank you AlbertoMiAmigo,

I've fixed it though just by listing the children

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

Answer this question