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

local function toggleWindow()
	if window.Visible then
		-- Close the window by tweening back to the button position and size
		window:TweenSizeAndPosition(
			UDim2.new(0, 0, 0, 0),
			UDim2.new(0, gClippslyButton.AbsolutePosition.X, 0, gClippslyButton.AbsolutePosition.Y),
			'Out',
			'Quad',
			0.5,
			false,
			function()
				window.Visible = false
			end
		)
	else
		-- Set the initial position of the window to be relative to the button
		local startPos = UDim2.new(0, gClippslyButton.AbsolutePosition.X, 0, gClippslyButton.AbsolutePosition.Y)
		window.Position = startPos

		-- Set the initial size of the window to be zero
		window.Size = UDim2.new(0, 0, 0, 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(0.565, 0, 0.694, 0),
			UDim2.new(0.218, 0, 0.133, 0),
			'Out',
			'Quad',
			0.5
		)
	end
end
