So I have been having trouble finding out how far a GUI button has been dragged

Here's what I tried to do

local ImageButton = script.Parent.ImageButton
local UserInputService = game:GetService("UserInputService")

ImageButton.InputBegan:Connect(function(InputObject)
	
	
	print(	UserInputService:GetMouseLocation())	
	
	print(InputObject.Position)
	
end)




UserInputService.InputBegan:Connect(function(InputObject)
	print(InputObject.Position)
end)

All of these print different positions which makes it very difficult to track how far a GUI has been dragged

I was planning on using UserInputService's InputChanged for this

Does anyone know how I can figure out how far a GUI has been dragged?


UserInputService.InputChanged:Connect(function(InputObject)
	-- Planned on Minusing from the InputBegan position to see how far it was but Input Began won't return reliable positions
	
	
end)

Also I know I am being a bit needy

BUT I DO NOT WANT ANY ANSWERS USING 1. A while True Do loop 2. :GetMouseLocation()

:GetMouseLocation() has an big issue with it's offset difference in Mobile and PC meaning

A PC position will be accurate however a Mobile has an

Offset which makes it so that it's innacurate

I don't know why

3 comments

0

Gui Inset prob ask xap :) for more

0

also idk what you meant about how far a "GUI has been dragged?'

0

Anyways I fixed the issue by using GetMouseLocation() but what I was referring to when I said "GUI Has been dragged was" how far the mouse has been dragged since ImageButton.InputBegan's Position