Somehow my script doesn’t work, But there’s no error and also half of the gui’s get invisible and the other half doesn’t and after that I can’t click it again, nothing happens. Where did I make a mistake?? Thank you for reading!
local db = true
script.Parent.MouseButton1Click:Connect(function()
local childr = script.Parent.Parent.Parent.Parent.Parent.Parent.ScreenGui:GetChildren()
for i, v in pairs(childr) do
if db == true then
db = false
if v:IsA("TextLabel") or v:IsA("TextButton") or v:IsA("Frame") then
v.Visible = false
end
script.Parent.Text = "Show"
else
db = true
if v:IsA("TextLabel") or v:IsA("TextButton") or v:IsA("Frame") then
v.Visible = true
end
script.Parent.Text = "Hide"
end
end
end)
These are the gui’s (Only screengui is supposed to be invisible)