I am trying to make draggable gui with custom module but it seems my gui is doubling the positon
i have to try to change to mouse moved but still same problem
Function for the updating:
local function Drag()
local DragStart = class.Widget:GetRelativeMousePosition() -- vector 2
local StartPosition = Gui.Position -- vector2
local function Update(input)
local DeltaPos = input - DragStart
print(Gui.Position, StartPosition)
Gui.Position = UDim2.fromOffset(Gui.Position.X.Offset + DeltaPos.X, Gui.Position.Y.Offset + DeltaPos.Y) -- offset
Function for the moving & disconnecting:
local connection = Gui.MouseMoved:Connect(function(x,y)
Update(Vector2.new(x,y))
end)
Gui.InputEnded:Once(function()
connection:Disconnect()
end)
Video: