PcoWSkbVqDnWTu_dm2ix
We use cookies on this site to enhance your user experience
Collapse Sidebar

DragBegin

The DragBegin event fires when a player begins dragging the object.

Parameters

Name Type Default Description

A UDim2 value of the position of the GuiObject before any drag operation began.


Code Samples


GuiObject.DragBegin

The below example assumes it’s within a GuiObject such as a TextButton, and that the /GuiObject/Draggable property is set to true. It will print the UDim2 of where the player started dragging the object from.

 script.Parent.DragBegin:connect(function(UD2)
    local XScale, XOffset, YScale, YOffset = UD2.X.Scale, UD2.X.Offset, UD2.Y.Scale, UD2.Y.Offset
    print(("The player started dragging the object at UDim2.new(%f, %d, %f, %d)"):format(XScale, XOffset, YScale, YOffset))
end)