local A=(game:GetService("\080\108\097\121\101\114\115")).LocalPlayer:GetMouse()local S=game:GetService("\085\115\101\114\073\110\112\117\116\083\101\114\118\105\099\101")local n="\114\098\120\097\115\115\101\116\058\047\047\116\101\120\116\117\114\101\115\047\067\117\114\115\111\114\115\047\075\101\121\098\111\097\114\100\077\111\117\115\101\047\065\114\114\111\119\070\097\114\067\117\114\115\111\114\046\112\110\103"local X="\104\116\116\112\058\047\047\119\119\119\046\114\111\098\108\111\120\046\099\111\109\047\097\115\115\101\116\047\063\105\100\061\049\048\057\054\053\052\054\050\055\050\049"return function(c,v)local y local w local h local W if not v then v=c end local function K(A)local S=A.Position-h c:TweenPosition(UDim2.new(W.X.Scale,W.X.Offset+S.X,W.Y.Scale,W.Y.Offset+S.Y),"\079\117\116","\081\117\097\100",.1,true)end v.InputBegan:Connect(function(S)if S.UserInputType==Enum.UserInputType.MouseButton1 or S.UserInputType==Enum.UserInputType.Touch then y=true h=S.Position W=c.Position A.Icon=X S.Changed:Connect(function()if S.UserInputState==Enum.UserInputState.End then y=false A.Icon=n end end)end end)v.InputChanged:Connect(function(A)if A.UserInputType==Enum.UserInputType.MouseMovement or A.UserInputType==Enum.UserInputType.Touch then w=A end end)S.InputChanged:Connect(function(A)if A==w and y then K(A)end end)end
local mouse = game:GetService("Players").LocalPlayer:GetMouse();
local UserInputService = game:GetService("UserInputService");
local defaultmouseicon = "rbxasset://textures/Cursors/KeyboardMouse/ArrowFarCursor.png";
local draggingbutton = "http://www.roblox.com/asset/?id=10965462721";

return function(inst,dragpart)
	local dragging
	local dragInput
	local dragStart
	local startPos

	if not dragpart then dragpart = inst end;

	local function update(input)
		local delta = input.Position - dragStart
		--inst.Position = UDim2.new(startPos.X.Scale, startPos.X.Offset + delta.X, startPos.Y.Scale, startPos.Y.Offset + delta.Y)
		inst:TweenPosition(UDim2.new(startPos.X.Scale, startPos.X.Offset + delta.X, startPos.Y.Scale, startPos.Y.Offset + delta.Y), "Out", "Quad", 0.1, true);
	end

	dragpart.InputBegan:Connect(function(input)
		if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
			dragging = true
			dragStart = input.Position
			startPos = inst.Position
			mouse.Icon = draggingbutton;

			input.Changed:Connect(function()
				if input.UserInputState == Enum.UserInputState.End then
					dragging = false
					mouse.Icon = defaultmouseicon;
				end
			end)
		end
	end)

	dragpart.InputChanged:Connect(function(input)
		if input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch then
			dragInput = input
		end
	end)

	UserInputService.InputChanged:Connect(function(input)
		if input == dragInput and dragging then
			update(input)
		end
	end)
end