local function a()for a,G in pairs(Main)do G.Visible=false end end local function G(G)local h=G.Visible a()if h==true then return end if G.Visible==true then G.Visible=false elseif G.Visible==false then G.Visible=true end end for a,h in pairs(SettingsOpener:GetDescendants())do if h:IsA("\071\117\105\066\117\116\116\111\110")then local a=h:FindFirstAncestorWhichIsA("\070\111\108\100\101\114")h.Activated:Connect(function()G(Main[a])end)end end for a,h in pairs(ShopOpener:GetDescendants())do if h:IsA("\071\117\105\066\117\116\116\111\110")then local a=h:FindFirstAncestorWhichIsA("\070\111\108\100\101\114")h.Activated:Connect(function()G(Main[a])end)end end ToggleButton.Activated:Connect(function()G(ToggleButton)for a,G in pairs(Main)do if type(a)=="\117\115\101\114\100\097\116\097"then for a,G in pairs(a:GetDescendants())do if G:IsA("\071\117\105\066\117\116\116\111\110")then local a=G.Visible if a==true then G.Visible=false elseif a==false then G.Visible=true end end end end end local h=ToggleButton.Text if h=="\060"then ToggleButton.Text="\062"elseif h=="\062"then ToggleButton.Text="\060"end a()end)


local function HideAllFrames()
	for i,v in pairs(Main) do
		v.Visible=false
	end
end

local function ToggleVisibility(Element)
	local vis=Element.Visible
	HideAllFrames()
	if vis==true then return end
	if Element.Visible==true then
		Element.Visible=false
	elseif Element.Visible==false then
		Element.Visible=true
	end
end

for i,v in pairs(SettingsOpener:GetDescendants()) do
	if v:IsA("GuiButton") then
		local folder=v:FindFirstAncestorWhichIsA("Folder")
		v.Activated:Connect(function()
			ToggleVisibility(Main[folder])
		end)
	end
end

for i,v in pairs(ShopOpener:GetDescendants()) do
	if v:IsA("GuiButton") then
		local folder=v:FindFirstAncestorWhichIsA("Folder")
		v.Activated:Connect(function()
			ToggleVisibility(Main[folder])
		end)
	end
end

ToggleButton.Activated:Connect(function()
	ToggleVisibility(ToggleButton)
	for i,v in pairs(Main) do
		if type(i)=="userdata" then
			for s,a in pairs(i:GetDescendants()) do
				if a:IsA("GuiButton") then
					local vis=a.Visible
					if vis==true then
						a.Visible=false
					elseif vis==false then
						a.Visible=true
					end
				end
			end
		end
	end
	local caret=ToggleButton.Text
	if caret=="<" then
		ToggleButton.Text=">"
	elseif caret==">" then
		ToggleButton.Text="<"
	end
	HideAllFrames()
end)
