return function(v,M)local b=require(script.Parent.Parent.Bundles.services)local N=M or 10 local S=b.UserInputService local r=b.RunService local i=v local a,F,I,X local function W(v,M,b)return v+(M-v)*b end local x=Instance.new("\066\105\110\100\097\098\108\101\069\118\101\110\116")local function l(v)if not X then return end if not a and I then i.Position=UDim2.new(X.X.Scale,W(i.Position.X.Offset,I.X.Offset,v*N),X.Y.Scale,W(i.Position.Y.Offset,I.Y.Offset,v*N))return end local M=F-S:GetMouseLocation()local b=X.X.Offset-M.X local r=X.Y.Offset-M.Y I=UDim2.new(X.X.Scale,b,X.Y.Scale,r)i.Position=UDim2.new(X.X.Scale,W(i.Position.X.Offset,b,v*N),X.Y.Scale,W(i.Position.Y.Offset,r,v*N))end i.InputBegan:Connect(function(v)if v.UserInputType==Enum.UserInputType.MouseButton1 or v.UserInputType==Enum.UserInputType.Touch then a=true X=i.Position F=S:GetMouseLocation()v.Changed:Connect(function()if v.UserInputState==Enum.UserInputState.End then x:Fire()a=false end end)end end)local Q=r.Heartbeat:Connect(l)return Q,x.Event end
return function(o,s)
	local services = require(script.Parent.Parent.Bundles.services)
	local DRAG_SPEED = s or 10
	local UserInputService = services.UserInputService
	local runService = services.RunService
	local gui = o
	local dragging, lastMousePos, lastGoalPos, startPos
	local function Lerp(a, b, m)
		return a + (b - a) * m
	end

	local onEnd = Instance.new("BindableEvent")

	local function Update(dt)
		if not (startPos) then return end;

		if not (dragging) and (lastGoalPos) then
			gui.Position = UDim2.new(startPos.X.Scale, Lerp(gui.Position.X.Offset, lastGoalPos.X.Offset, dt * DRAG_SPEED), startPos.Y.Scale, Lerp(gui.Position.Y.Offset, lastGoalPos.Y.Offset, dt * DRAG_SPEED))
			return
		end

		local delta = (lastMousePos - UserInputService:GetMouseLocation())

		local xGoal = (startPos.X.Offset - delta.X)
		local yGoal = (startPos.Y.Offset - delta.Y)

		lastGoalPos = UDim2.new(startPos.X.Scale, xGoal, startPos.Y.Scale, yGoal)

		gui.Position = UDim2.new(startPos.X.Scale, Lerp(gui.Position.X.Offset, xGoal, dt * DRAG_SPEED), startPos.Y.Scale, Lerp(gui.Position.Y.Offset, yGoal, dt * DRAG_SPEED))
	end

	gui.InputBegan:Connect(function(input)
		if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
			dragging = true
			startPos = gui.Position
			lastMousePos = UserInputService:GetMouseLocation()
			input.Changed:Connect(function()
				if input.UserInputState == Enum.UserInputState.End then
					onEnd:Fire()
					dragging = false
				end
			end)
		end
	end)
	local connection = runService.Heartbeat:Connect(Update)
	return connection, onEnd.Event
end
