local X=Frames.OptionsFrame local F=X.BaseFrame local e=X.Frames local D=nil local j=nil local w=false local A=false local function E()for X=1,.6,-0.025 do j.Visible=true j.BackgroundTransparency=X Frames.Back.Transparency=X print(X)j=true A=true task.wait()end end local function R()for X=.6,1,.025 do j.BackgroundTransparency=X Frames.Back.Transparency=X print(X)task.wait()end j.Visible=false w=false task.wait(.4)A=false end for X,Z in pairs(Buttonsframe:GetDescendants())do if Z:IsA("\084\101\120\116\066\117\116\116\111\110")then Z.MouseButton1Click:Connect(function()D=Z.Name.."\070\114\097\109\101"j=e:FindFirstChild(D)if not j.Visible then if not w and not A then for X,F in pairs(F:GetDescendants())do if F:IsA("\084\101\120\116\066\117\116\116\111\110")and Z.Name~=ButtonSelected then F.BackgroundTransparency=.95 F.Selectable=false Z.BackgroundTransparency=.5 end end E()end else for X,F in pairs(F:GetDescendants())do if F:IsA("\084\101\120\116\066\117\116\116\111\110")and Z.Name~=ButtonSelected then F.BackgroundTransparency=.6 F.Selectable=true Z.BackgroundTransparency=.6 end end R()end end)end end

local OptionsFrame = Frames.OptionsFrame
local FrameBase = OptionsFrame.BaseFrame
local OptionsFrames = OptionsFrame.Frames
local OptionFrameName = nil
local OptionFrameToOpen = nil
local OptionFrameIsOpened = false
local OptionDebounce = false

local function OptionOpenGUI()
	for i = 1,0.6,-0.025 do
		OptionFrameToOpen.Visible = true
		OptionFrameToOpen.BackgroundTransparency = i
		Frames.Back.Transparency = i
		print(i)
		OptionFrameToOpen = true
		OptionDebounce = true
		task.wait()
	end
end

local function OptionCloseGUI()
	for i = 0.6,1,0.025 do
		OptionFrameToOpen.BackgroundTransparency = i
		Frames.Back.Transparency = i
		print(i)
		task.wait()
	end
	OptionFrameToOpen.Visible = false
	OptionFrameIsOpened = false
	task.wait(0.4)
	OptionDebounce = false
end

for _, OptionButton in pairs(Buttonsframe:GetDescendants()) do
	if OptionButton:IsA("TextButton") then
		OptionButton.MouseButton1Click:Connect(function()
			OptionFrameName = OptionButton.Name.."Frame"
			OptionFrameToOpen = OptionsFrames:FindFirstChild(OptionFrameName)
			if not OptionFrameToOpen.Visible then
				if not OptionFrameIsOpened and not OptionDebounce then
					for _, OptionButtons in pairs(FrameBase:GetDescendants()) do
						if OptionButtons:IsA("TextButton") and OptionButton.Name ~= ButtonSelected then
							OptionButtons.BackgroundTransparency = 0.95
							OptionButtons.Selectable = false
							OptionButton.BackgroundTransparency = 0.5
						end
					end
					OptionOpenGUI()
				end
			else
				for _, OptionButtons in pairs(FrameBase:GetDescendants()) do
					if OptionButtons:IsA("TextButton") and OptionButton.Name ~= ButtonSelected then
						OptionButtons.BackgroundTransparency = 0.6
						OptionButtons.Selectable = true
						OptionButton.BackgroundTransparency = 0.6
					end
				end
				OptionCloseGUI()
			end
		end)
	end
end
