Making scriptable dragdetector behave like default dragdetector

I want my scriptable drag detector to behave like the default drag.

My Drag Detector:
robloxapp-20250320-1007365.wmv (145.6 KB)

Roblox Drag Detector:
robloxapp-20250320-1008564.wmv (239.4 KB)

Here’s my script so far

for i, slot in pairs(BackpackSlots:GetChildren()) do
	if slot:IsA("Frame") then
		local MouseOffset


		slot.UIDragDetector.DragStart:Connect(function(InputPosition)
			DraggingFrame.BackgroundTransparency = 0
			print(InputPosition)
			DraggingFrame.Position = UDim2.new(0, InputPosition.X, 0, InputPosition.Y)
		end)

		slot.UIDragDetector.DragContinue:Connect(function(InputPosition)
			DraggingFrame.Position = UDim2.new(0, InputPosition.X, 0, InputPosition.Y)
		end)

		slot.UIDragDetector.DragEnd:Connect(function()
			DraggingFrame.BackgroundTransparency = 1
		end)
	end
end

i want my drag frame to kinda orignate from the slot frame, and have a mouse offset.