-- Define the function to toggle the frames and button position

local function toggleFrames()
	if frame1.Visible == true and apl.Value == true then
		-- If frames are visible, hide them and tween button to closed position
		frame1.Closed.Visible = true
		game:GetService("TweenService"):Create(frame1.Closed, TweenInfo.new(0.2), {BackgroundTransparency = 0}):Play()
		wait(0.2)
		frame1.Visible = false
		sud:Play()
		textButton.Text = ">"
	elseif frame1.Visible == false and apl.Value == true then
		-- If frames are hidden, show them and tween button to open position
		frame1.Visible = true
		game:GetService("TweenService"):Create(frame1.Closed, TweenInfo.new(0.2), {BackgroundTransparency = 1}):Play()
		wait(0.2)
		frame1.Closed.Visible = false
		sud:Play()
		textButton.Text = "<"
	end
end
