-- drag

do
	local delta, old_mouse_position = UDim2.fromOffset(0, 0), nil

	user_input_service.InputBegan:Connect(function(input, processing)
		if (in_container and (not drag_connection or not drag_connection.Connected) and not processing and input.UserInputType == Enum.UserInputType.MouseButton1) then
			old_mouse_position = UDim2.fromOffset(mouse.X, mouse.Y)

			drag_connection = run_service.RenderStepped:Connect(function()
				delta = old_mouse_position - UDim2.fromOffset(mouse.X, mouse.Y)

				container.Position = container.Position - delta
				old_mouse_position = UDim2.fromOffset(mouse.X, mouse.Y)
			end)
		end
	end)

	user_input_service.InputEnded:Connect(function(input)
		if (drag_connection and drag_connection.Connected and input.UserInputType == Enum.UserInputType.MouseButton1) then
			drag_connection:Disconnect()
		end
	end)
end
