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

How do I make this open the children in the File?

Asked by 6 years ago

Errors: None Problem: Doesn't make the Children Visible

script.Parent.MouseButton1Click:connect(function()
        if script.Parent.Parent.Jobs.TeacherButton.Visible == true then
        script.Parent.Parent.Jobs.TeacherButton.Visible = false
        script.Parent.Parent.Jobs.TextLabel.Visible = false
        end
    local OpenApps = script.Parent.Parent.Apps:GetChildren()
    OpenApps.Visible = true
end)
0
thats because you are trying to set a table to visible? you have to do it indivuay abnotaddable 920 — 6y
0
It does make Visible true. hiimgoodpack 2009 — 6y

1 answer

Log in to vote
1
Answered by 6 years ago

:GetChildren() returns an array for all the children in the instance that the method was called on. when working with arrays, you want to loop through them, the best way is by using a generic for-loop, like so.

script.Parent.MouseButton1Click:connect(function()
    if script.Parent.Parent.Jobs.TeacherButton.Visible == true then
        script.Parent.Parent.Jobs.TeacherButton.Visible = false
        script.Parent.Parent.Jobs.TextLabel.Visible = false
    end
    local OpenApps = script.Parent.Parent.Apps:GetChildren()
    for _, child in pairs(OpenApps) do
        child.Visible = true
    end
end)

Ad

Answer this question