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

DragBegin

This event fires when a player begins dragging the object.

See also

  • GuiObject/DragStopped

Parameters

Name Type Default Description

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


Code Samples


(Deprecated) Print the Position of a GUI When Dragging Begins

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)