local function a(a)local k=false local V local l local function n(n,C)k=true V=a.AbsolutePosition l=Vector2.new(n,C)-V end local function C(V,n)if k then a.Position=UDim2.new(0,V-l.X,0,n-l.Y)end end local function T(a,V)k=false end a.InputBegan:Connect(function(a)if a.UserInputType==Enum.UserInputType.MouseButton1 then n(a.Position.X,a.Position.Y)end end)a.InputChanged:Connect(function(a)if a.UserInputType==Enum.UserInputType.MouseMovement then C(a.Position.X,a.Position.Y)end end)a.InputEnded:Connect(function(a)if a.UserInputType==Enum.UserInputType.MouseButton1 then T(a.Position.X,a.Position.Y)end end)end
-- Function to enable dragging for an image button
local function enableDragging(button)
	local dragging = false
	local dragStartPos
	local offset
	local function onMouseButton1Down(x, y)
		dragging = true
		dragStartPos = button.AbsolutePosition
		offset = Vector2.new(x, y) - dragStartPos
	end
	local function onMouseMove(x, y)
		if dragging then
			button.Position = UDim2.new(0, x - offset.X, 0, y - offset.Y)
		end
	end
	local function onMouseButton1Up(x, y)
		dragging = false
	end
	button.InputBegan:Connect(function(input)
		if input.UserInputType == Enum.UserInputType.MouseButton1 then
			onMouseButton1Down(input.Position.X, input.Position.Y)
		end
	end)
	button.InputChanged:Connect(function(input)
		if input.UserInputType == Enum.UserInputType.MouseMovement then
			onMouseMove(input.Position.X, input.Position.Y)
		end
	end)
	button.InputEnded:Connect(function(input)
		if input.UserInputType == Enum.UserInputType.MouseButton1 then
			onMouseButton1Up(input.Position.X, input.Position.Y)
		end
	end)
end
