-- Get references to the DockShelf and its children

local fldr = script.Parent.Parent.SelEmoji
local btn = script.Parent

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

		-- Set the initial size of the window to be zero
		fldr.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
		fldr.Visible = true
		fldr:TweenSizeAndPosition(
			UDim2.new(0.864, 0, 0.48, 0),
			UDim2.new(0.065,0, 0.259, 0),
			'Out',
			'Quad',
			0.2
		)
	end
end
