-- Define the function to open or close the window with gene-alike effect

local function toggleWindow(button)
	local windowName = button.Name

	-- Find the corresponding frame in the AppManager using the window name
	local window = gui:FindFirstChild(windowName)
	if window then
		if window.Visible == false then
			-- Close other windows
			for _, child in ipairs(gui:GetChildren()) do
				if child:IsA("Frame") and child.Visible then
				end
			end

			local startPos = UDim2.new(0.0, 0, 0.978, 0)
			window.Position = startPos

			-- Set the initial size of the window to be zero
			window.Size = UDim2.new(1, 0, 0.022, 0)

			-- Show the window and tween its position and size from the button position and size to its original position and size
			window.Visible = true
			window:TweenSizeAndPosition(
				UDim2.new(1, 0, 0.597, 0),
				UDim2.new(0, 0, 0.403, 0),
				'Out',
				'Quad',
				0.2
			)
		end
	end
end
