So my script is in a button with a clickdetector in the button as well. I have multiple GUIs in screen and what I want my script to do is, if at least one child of screen has the Visible property set as true, I want it to change all children of screen to Visible.false. Currently this script only works when there's just one child in screen. Here's what it should do: it serves as a power button for a monitor SurfaceGui that checks if any child of SurfaceGui is visible. If at least one child is Visible, it changes the Visible property of every child of SurfaceGui to false. else, it makes Monitor visible and makes the textBox (a child of Monitor) rotate between "Booting...", "Booting..", and "Booting." three times before saying "Welcome." Here's the code:
local screen = script.Parent.Parent.Monitor.SurfaceGui
local label = screen.Monitor.TextLabel
function onClicked(playerWhoClicked)
for i, child in pairs(screen:GetChildren()) do
if child.Visible == true then
for i, child in pairs(screen:GetChildren()) do
child.Visible = false
end
else
screen.Monitor.Visible = true
label.Visible = true
for i = 1, 3 do
label.Text = "Booting."
wait(.5)
label.Text = "Booting.."
wait(.5)
label.Text = "Booting..."
wait(.5)
if i == 3 then
label.Text = "Welcome"
wait(1)
label.Visible = false
i = 1
end
end
end
end
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
You can completely change the script if necessary, as long as there are instructions on what to rename and such. I think the problem is that if one child is visible, but another isn't visible, it's running both the Booting screen and making all children invisible. As always I accept the first working answer, thanks in advance.

2 comments
Works like a charm, thanks!
No problem!