Why does the UIDragDetector give a different input position compared to the User Input Service?

image

DragDetectorVsUserInputService.rbxl (65.0 KB)

Localscript code:

local UserInputService = game:GetService("UserInputService")
local Players = game:GetService("Players")
local LocalPlayer = Players.LocalPlayer
local PlayerGui = LocalPlayer:WaitForChild("PlayerGui")

local dragDetectorTable = {}

for _, button:TextButton in script.Parent.PartButtons.PartButtonsBar:GetChildren() do

	table.insert(dragDetectorTable, button:FindFirstChildOfClass("UIDragDetector"))

end

UserInputService.InputBegan:Connect(function(input, gameProcessed)
	if input.UserInputType == Enum.UserInputType.Touch or input.UserInputType == Enum.UserInputType.MouseButton1 then
		
		print(input.Position, "-- User Input Service")
		
		--print(PlayerGui:GetGuiObjectsAtPosition(input.Position.X, input.Position.Y))

	end

end)

for _, uiDragDetector:UIDragDetector in pairs(dragDetectorTable) do

	uiDragDetector.DragStart:Connect(function(inputPosition)
		
		print(inputPosition, "-- Drag Detector")
		
		--print(PlayerGui:GetGuiObjectsAtPosition(inputPosition.X, inputPosition.Y))

	end)
	
end

Ignore Gui Inset is set to true btw

Thanks!