I’m trying to close other unnecessary GUIs when a GUI is opened. But it doesn’t work. Is there something I overlooked?
local buttonsGui = script.Parent.Parent.Buttons
local petsButton = buttonsGui.LeftButtonHolder.Pets
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local screenGui = script.Parent
petsButton.MouseButton1Click:Connect(function()
screenGui.Enabled = not screenGui.Enabled
for i , v in pairs(player.PlayerGui:GetChildren()) do
for i,c in pairs(v:GetChildren()) do
if c:IsA("ScreenGui") then
if c.Name == ("CurrencyGUI") then
elseif c.Name == ("Buttons") then
elseif c.Name == ("PetInventory") then
else
c.Enabled = false
end
end
end
end
end)```