Source: Roblox Creator Hub · CC BY 4.0 · View source · Code samples: MIT Imported 2026-10-03. Formatting adapted for this site.
UIDragDetector
Inherits from: UIComponent → UIBase → Instance → Object
The UIDragDetector instance facilitates and encourages interaction with 2D user interface elements in an experience, such as sliders and spinners. Key features include:
Place a
UIDragDetectorunder anyGuiObjectinstance to make it draggable via all inputs without a single line of code.Choose from several
DragStyleoptions, define how the object responds to motion viaResponseStyle, and optionally apply axis, movement limits, or drag boundaries.Scripts can respond to manipulation of dragged objects to drive logic responses, such as adjusting settings.
UIDragDetectorswork in Studio as long as you're not using the Select, Move, Scale, or Rotate tools, nor certain plugins or Studio's UI editor tools.
Inherits from: UIComponent
Memory category: Instances
Properties
| Name | Type / Returns | Description |
|---|---|---|
| UIDragDetector.ActivatedCursorIcon | ContentId | Sets the cursor icon to display when the mouse is activated over the parent of this UIDragDetector. |
| UIDragDetector.ActivatedCursorIconContent | Content | Sets the cursor icon to display when the mouse is activated over the parent of this UIDragDetector. Only supports asset URIs |
| UIDragDetector.BoundingBehavior | UIDragDetectorBoundingBehavior | Determines bounding behavior of the dragged UI object when the detector's BoundingUI is set. |
| UIDragDetector.BoundingUI | GuiBase2d | Instance whose bounding area defines the drag boundaries for the parent GuiObject. |
| UIDragDetector.CursorIcon | ContentId | Sets the cursor icon to display when the mouse is hovered over the parent of this UIDragDetector. |
| UIDragDetector.CursorIconContent | Content | Sets the cursor icon to display when the mouse is hovered over the parent of this UIDragDetector. Only asset URIs are supported. |
| UIDragDetector.DragAxis | Vector2 | The drag axis for the UIDragDetector instance when DragStyle is set to UIDragDetectorDragStyle.TranslateLine. |
| UIDragDetector.DragRelativity | UIDragDetectorDragRelativity | Sets the paradigm which defines the relativity of inputs/outputs from a custom drag function. |
| UIDragDetector.DragRotation | float | The rotation performed by the current drag. |
| UIDragDetector.DragSpace | UIDragDetectorDragSpace | Sets the paradigm which defines the space of inputs/outputs from a custom drag function. |
| UIDragDetector.DragStyle | UIDragDetectorDragStyle | The paradigm used to generate proposed motion. |
| UIDragDetector.DragUDim2 | UDim2 | The translation performed by the current drag expressed in a UDim2 value. |
| UIDragDetector.Enabled | boolean | Whether the UIDragDetector responds to user input. |
| UIDragDetector.MaxDragAngle | float | Along with MinDragAngle, impedes the detector's attempts to generate rotational motion. |
| UIDragDetector.MaxDragTranslation | UDim2 | Along with MinDragTranslation, impedes the detector's attempts to generate linear/planar motion. |
| UIDragDetector.MinDragAngle | float | Along with MaxDragAngle, impedes the detector's attempts to generate rotational motion. |
| UIDragDetector.MinDragTranslation | UDim2 | Along with MaxDragTranslation, impedes the detector's attempts to generate linear/planar motion. |
| UIDragDetector.ReferenceUIInstance | GuiObject | A GuiObject instance whose local space and absolute center position is the reference space and origin for the detector. |
| UIDragDetector.ResponseStyle | UIDragDetectorResponseStyle | The paradigm used to define the response to proposed motion. |
| UIDragDetector.SelectionModeDragSpeed | UDim2 | Maximum drag speed for translation. |
| UIDragDetector.SelectionModeRotateSpeed | float | Maximum angle per second the UIDragDetector can rotate at. |
| UIDragDetector.UIDragSpeedAxisMapping | UIDragSpeedAxisMapping | UIDragSpeedAxisMapping value that determines the X/Y dimension dragging speeds. |
Inherited from Instance
| Name | Type / Returns | Description |
|---|---|---|
| Instance.Archivable | boolean | Determines if an Instance and its descendants can be cloned using Instance:Clone(), and can be saved/published. |
| Instance.archivable | boolean | |
| Instance.Capabilities | SecurityCapabilities | The set of capabilities allowed to be used for scripts inside this container. |
| Instance.IsInSandbox | boolean | Indicates whether the instance is inside a sandboxed container. |
| Instance.Name | string | A non-unique identifier of the Instance. |
| Instance.Parent | Instance | Determines the hierarchical parent of the Instance. |
| Instance.PredictionMode | PredictionMode | Reflects the client-side prediction mode applied to the instance under server-authoritative physics. |
| Instance.RobloxLocked | boolean | A deprecated property that used to protect CoreGui objects. |
| Instance.Sandboxed | boolean | When enabled, the instance can only access abilities in its Capabilities list. |
| Instance.UniqueId | UniqueId | A unique identifier for the instance. |
Inherited from Object
| Name | Type / Returns | Description |
|---|---|---|
| Object.ClassName | string | A read-only string representing the class this Object belongs to. |
| Object.className | string |
UIDragDetector.ActivatedCursorIcon
Sets the cursor icon to display when the mouse is activated over the parent of this UIDragDetector. If this property is left blank, the detector will use the default icon.
To change the activated cursor icon, set this property to the asset ID of the image you'd like to use.
| Field | Value |
|---|---|
| type | ContentId |
| security | {"read":"None","write":"None"} |
| thread safety | ReadSafe |
| category | Image |
| serialization | {"can_load":true,"can_save":true} |
| capabilities | ["UI"] |
UIDragDetector.ActivatedCursorIconContent
Sets the cursor icon to display when the mouse is activated over the parent of this UIDragDetector. If this property is left blank, the detector will use the default icon.
To change the activated cursor icon, set this property to the asset ID of the image you'd like to use. Only asset URIs are supported for this property.
| Field | Value |
|---|---|
| type | Content |
| security | {"read":"None","write":"None"} |
| thread safety | ReadSafe |
| category | Image |
| serialization | {"can_load":true,"can_save":true} |
| capabilities | ["UI"] |
UIDragDetector.BoundingBehavior
Determines bounding behavior of the dragged UI object when the detector's BoundingUI is set. See UIDragDetectorBoundingBehavior for details on each setting's behavior.
| Field | Value |
|---|---|
| type | UIDragDetectorBoundingBehavior |
| security | {"read":"None","write":"None"} |
| thread safety | ReadSafe |
| category | Behavior |
| serialization | {"can_load":true,"can_save":true} |
| capabilities | ["UI"] |
UIDragDetector.BoundingUI
When set, the UIDragDetector instance will not allow the bounds of the parent GuiObject to be dragged outside the bounds of the BoundingUI instance.
Note that if a portion of the parent GuiObject is outside the BoundingUI bounds, the initial input position at drag start and its relative position during drag will be used for bounding detection until the entirety of the dragged object is within the bounds, after which the object will be constrained inside the bounds.
| Field | Value |
|---|---|
| type | GuiBase2d |
| security | {"read":"None","write":"None"} |
| thread safety | ReadSafe |
| category | Behavior |
| serialization | {"can_load":true,"can_save":true} |
| capabilities | ["UI"] |
UIDragDetector.CursorIcon
Sets the cursor icon to display when the mouse is hovered over the parent of this UIDragDetector. If this property is left blank, the detector will use the default icon.
To change the cursor icon, set this property to the asset ID of the image you'd like to use.
| Field | Value |
|---|---|
| type | ContentId |
| security | {"read":"None","write":"None"} |
| thread safety | ReadSafe |
| category | Image |
| serialization | {"can_load":true,"can_save":true} |
| capabilities | ["UI"] |
UIDragDetector.CursorIconContent
Sets the cursor icon to display when the mouse is hovered over the parent of this UIDragDetector. If this property is left blank, the detector will use the default icon.
To change the cursor icon, set this property to the asset ID of the image you'd like to use. Only asset URIs are supported for this property.
| Field | Value |
|---|---|
| type | Content |
| security | {"read":"None","write":"None"} |
| thread safety | ReadSafe |
| category | Image |
| serialization | {"can_load":true,"can_save":true} |
| capabilities | ["UI"] |
UIDragDetector.DragAxis
Vector2 value that defines the axis of movement for the dragged object when DragStyle is set to UIDragDetectorDragStyle.TranslateLine. The axis is defined in the local space of the UIDragDetector unless ReferenceUIInstance is defined, in which case the axis is defined in that instance's local space.
| Field | Value |
|---|---|
| type | Vector2 |
| security | {"read":"None","write":"None"} |
| thread safety | ReadSafe |
| category | Drag Directions |
| serialization | {"can_load":true,"can_save":true} |
| capabilities | ["UI"] |
UIDragDetector.DragRelativity
Only applies if a custom drag function is registered through SetDragStyleFunction() or AddConstraintFunction(). Sets the paradigm which defines the relativity of the registered function's inputs/outputs.
For example, returning a UDim2.fromOffset(1, 0) from a registered function with this property set to UIDragDetectorDragRelativity.Absolute will move the detector's parent to (1, 0) in the designated DragSpace, while returning the same UDim2 with this property set to UIDragDetectorDragRelativity.Relative will move the detector's parent by (1, 0) in the designated DragSpace.
| Field | Value |
|---|---|
| type | UIDragDetectorDragRelativity |
| security | {"read":"None","write":"None"} |
| thread safety | ReadSafe |
| category | Behavior |
| serialization | {"can_load":true,"can_save":true} |
| capabilities | ["UI"] |
UIDragDetector.DragRotation
The rotation performed by the current drag. This value is defined in degrees relative to the local space of the UIDragDetector unless ReferenceUIInstance is defined, in which case the rotation is defined in the local space of that instance and from its positive X axis.
This property can be changed while there is no active drag to rotate the dragged object.
| Field | Value |
|---|---|
| type | float |
| security | {"read":"None","write":"None"} |
| thread safety | ReadSafe |
| category | Dragged Amount |
| serialization | {"can_load":true,"can_save":true} |
| capabilities | ["UI"] |
UIDragDetector.DragSpace
Only applies if a custom drag function is registered through SetDragStyleFunction() or AddConstraintFunction(). Sets the paradigm which defines the space of the registered function's inputs/outputs.
For example, if the detector's parent GuiObject is a child of a parent GuiObject that's rotated:
Returning a
UDim2.fromOffset(1, 0)from a registered function with this property set toUIDragDetectorDragSpace.Parentwill move the detector's parentGuiObjectto the right by 1 pixel in the local space affected by its parent's rotation.Returning a
UDim2.fromOffset(1, 0)from a registered function with this property set toUIDragDetectorDragSpace.LayerCollectorwill move the detector's parentGuiObjectto the right by 1 pixel in the space of theLayerCollector.
| Field | Value |
|---|---|
| type | UIDragDetectorDragSpace |
| security | {"read":"None","write":"None"} |
| thread safety | ReadSafe |
| category | Behavior |
| serialization | {"can_load":true,"can_save":true} |
| capabilities | ["UI"] |
UIDragDetector.DragStyle
The paradigm used to generate proposed motion, given a stream of input position vectors. See UIDragDetectorDragStyle for options.
| Field | Value |
|---|---|
| type | UIDragDetectorDragStyle |
| security | {"read":"None","write":"None"} |
| thread safety | ReadSafe |
| category | Behavior |
| serialization | {"can_load":true,"can_save":true} |
| capabilities | ["UI"] |
UIDragDetector.DragUDim2
The translation performed by the current drag expressed in a UDim2 value. Translation is done through Offset or Scale value changes depending on the DragRelativity value, and it is relative to the detector's local space unless a ReferenceUIInstance is defined.
This property can be changed while there is no active drag to move the dragged object.
| Field | Value |
|---|---|
| type | UDim2 |
| security | {"read":"None","write":"None"} |
| thread safety | ReadSafe |
| category | Dragged Amount |
| serialization | {"can_load":true,"can_save":true} |
| capabilities | ["UI"] |
UIDragDetector.Enabled
If true, the UIDragDetector responds to user input; if false, it does not.
| Field | Value |
|---|---|
| type | boolean |
| security | {"read":"None","write":"None"} |
| thread safety | ReadSafe |
| category | Behavior |
| serialization | {"can_load":true,"can_save":true} |
| capabilities | ["UI"] |
UIDragDetector.MaxDragAngle
If this property is greater than MinDragAngle, rotation will be clamped within the range of MinDragAngle and MaxDragAngle. Positive values impede clockwise rotation while negative values impede counterclockwise rotation.
This is not a constraint; it merely impedes the detector's attempts to generate motion in order to remain within limits. See AddConstraintFunction() to add custom constraint to a drag.
Only relevant if DragStyle is UIDragDetectorDragStyle.Rotate.
| Field | Value |
|---|---|
| type | float |
| security | {"read":"None","write":"None"} |
| thread safety | ReadSafe |
| category | Drag Limits |
| serialization | {"can_load":true,"can_save":true} |
| capabilities | ["UI"] |
UIDragDetector.MaxDragTranslation
If the corresponding Offset and/or Scale values are greater than those of MinDragTranslation in all dimensions, linear/planar translation will be clamped within the range of MinDragTranslation and MaxDragTranslation.
This is not a constraint; it merely impedes the detector's attempts to generate motion in order to remain within limits. See AddConstraintFunction() to add custom constraint to a drag.
Only relevant if DragStyle is UIDragDetectorDragStyle.TranslateLine or UIDragDetectorDragStyle.TranslatePlane.
| Field | Value |
|---|---|
| type | UDim2 |
| security | {"read":"None","write":"None"} |
| thread safety | ReadSafe |
| category | Drag Limits |
| serialization | {"can_load":true,"can_save":true} |
| capabilities | ["UI"] |
UIDragDetector.MinDragAngle
If this property is less than MaxDragAngle, rotation will be clamped within the range of MinDragAngle and MaxDragAngle. Positive values impede clockwise rotation while negative values impede counterclockwise rotation.
This is not a constraint; it merely impedes the detector's attempts to generate motion in order to remain within limits. See AddConstraintFunction() to add custom constraint to a drag.
Only relevant if DragStyle is UIDragDetectorDragStyle.Rotate.
| Field | Value |
|---|---|
| type | float |
| security | {"read":"None","write":"None"} |
| thread safety | ReadSafe |
| category | Drag Limits |
| serialization | {"can_load":true,"can_save":true} |
| capabilities | ["UI"] |
UIDragDetector.MinDragTranslation
If the corresponding Offset and/or Scale values are less than those of MaxDragTranslation in all dimensions, linear/planar translation will be clamped within the range of MinDragTranslation and MaxDragTranslation.
This is not a constraint; it merely impedes the detector's attempts to generate motion in order to remain within limits. See AddConstraintFunction() to add custom constraint to a drag.
Only relevant if DragStyle is UIDragDetectorDragStyle.TranslateLine or UIDragDetectorDragStyle.TranslatePlane.
| Field | Value |
|---|---|
| type | UDim2 |
| security | {"read":"None","write":"None"} |
| thread safety | ReadSafe |
| category | Drag Limits |
| serialization | {"can_load":true,"can_save":true} |
| capabilities | ["UI"] |
UIDragDetector.ReferenceUIInstance
A GuiObject instance whose local space and absolute center position is the reference space and origin for the detector. Setting this reference affects properties such as DragUDim2, DragRotation, and the behavior of DragAxis.
| Field | Value |
|---|---|
| type | GuiObject |
| security | {"read":"None","write":"None"} |
| thread safety | ReadSafe |
| category | Behavior |
| serialization | {"can_load":true,"can_save":true} |
| capabilities | ["UI"] |
UIDragDetector.ResponseStyle
Once the proposed motion has been computed and potentially constrained, this paradigm is used to deterimine how to move (or not move) the GuiObject affected by the UIDragDetector. See UIDragDetectorResponseStyle for options.
| Field | Value |
|---|---|
| type | UIDragDetectorResponseStyle |
| security | {"read":"None","write":"None"} |
| thread safety | ReadSafe |
| category | Behavior |
| serialization | {"can_load":true,"can_save":true} |
| capabilities | ["UI"] |
UIDragDetector.SelectionModeDragSpeed
Defines the maximum drag speed for translation as a combination of Scale and Offset of the first ancestor ScreenGui or SurfaceGui the UIDragDetector belongs to. This value must be positive and any value below 0 will be clamped to 0.
| Field | Value |
|---|---|
| type | UDim2 |
| security | {"read":"None","write":"None"} |
| thread safety | ReadSafe |
| category | Behavior |
| serialization | {"can_load":true,"can_save":true} |
| capabilities | ["UI"] |
UIDragDetector.SelectionModeRotateSpeed
Defines the maximum angle per second at which the UIDragDetector can rotate. This value must be positive and any value below 0 will be clamped to 0.
| Field | Value |
|---|---|
| type | float |
| security | {"read":"None","write":"None"} |
| thread safety | ReadSafe |
| category | Behavior |
| serialization | {"can_load":true,"can_save":true} |
| capabilities | ["UI"] |
UIDragDetector.UIDragSpeedAxisMapping
UIDragSpeedAxisMapping value that determines the X/Y dimension dragging speeds.
| Field | Value |
|---|---|
| type | UIDragSpeedAxisMapping |
| security | {"read":"None","write":"None"} |
| thread safety | ReadSafe |
| category | Behavior |
| serialization | {"can_load":true,"can_save":true} |
| capabilities | ["UI"] |
Methods
| Name | Type / Returns | Description |
|---|---|---|
| UIDragDetector:AddConstraintFunction | RBXScriptConnection | Adds a function to modify or constrain proposed motion. |
| UIDragDetector:GetReferencePosition | UDim2 | Returns the reference UDim2 position of the current drag's reference origin. |
| UIDragDetector:GetReferenceRotation | float | Returns the reference rotation of the current drag's reference element. |
| UIDragDetector:SetDragStyleFunction | () | Passes a function to be used if and only if DragStyle is set to UIDragDetectorDragStyle.Scriptable. |
Inherited from Instance
| Name | Type / Returns | Description |
|---|---|---|
| Instance:AddTag | () | Applies a tag to the instance. |
| Instance:children | Instances | Returns an array of the object's children. |
| Instance:ClearAllChildren | () | This method destroys all of an instance's children. |
| Instance:Clone | Instance | Create a copy of an instance and all its descendants, ignoring instances that are not Archivable. |
| Instance:clone | Instance | |
| Instance:Destroy | () | Sets the Instance.Parent property to nil, locks the Instance.Parent property, disconnects all connections, and calls Destroy() on all children. |
| Instance:destroy | () | |
| Instance:FindFirstAncestor | Instance? | Returns the first ancestor of the Instance whose Instance.Name is equal to the given name. |
| Instance:FindFirstAncestorOfClass | Instance? | Returns the first ancestor of the Instance whose Object.ClassName is equal to the given className. |
| Instance:FindFirstAncestorWhichIsA | Instance? | Returns the first ancestor of the Instance for whom Object:IsA() returns true for the given className. |
| Instance:FindFirstChild | Instance? | Returns the first child of the Instance found with the given name. |
| Instance:findFirstChild | Instance | |
| Instance:FindFirstChildOfClass | Instance? | Returns the first child of the Instance whose ClassName is equal to the given class name. |
| Instance:FindFirstChildWhichIsA | Instance? | Returns the first child of the Instance for whom Object:IsA() returns true for the given className. |
| Instance:FindFirstDescendant | Instance? | Returns the first descendant found with the given Instance.Name. |
| Instance:GetActor | Actor? | Returns the Actor associated with the Instance, if any. |
| Instance:GetAttribute | Variant | Returns the value which has been assigned to the given attribute name. |
| Instance:GetAttributeChangedSignal | RBXScriptSignal | Returns an event that fires when the given attribute changes. |
| Instance:GetAttributes | Dictionary | Returns a dictionary of the instance's attributes. |
| Instance:GetChildren | Instances | Returns an array containing all of the instance's children. |
| Instance:getChildren | Instances | |
| Instance:GetDebugId | string | Returns a coded string of the debug ID used internally by Roblox. |
| Instance:GetDescendants | Instances | Returns an array containing all of the descendants of the instance. |
| Instance:GetFullName | string | Returns a string describing the instance's ancestry. |
| Instance:GetStyled | Variant | Returns the styled or explicitly modified value of the specified property, or else the default property value if it hasn't been styled/modified. |
| Instance:GetStyledPropertyChangedSignal | RBXScriptSignal | Returns an event that fires when the given style property changes on the instance. |
| Instance:GetTags | Array | Gets an array of all tags applied to the instance. |
| Instance:HasTag | boolean | Check whether the instance has a given tag. |
| Instance:IsAncestorOf | boolean | Returns true if an Instance is an ancestor of the given descendant. |
| Instance:IsDescendantOf | boolean | Returns true if an Instance is a descendant of the given ancestor. |
| Instance:isDescendantOf | boolean | |
| Instance:IsPropertyModified | boolean | Returns true if the value stored in the specified property is not equal to the code-instantiated default. |
| Instance:QueryDescendants | Instances | Returns an array containing all descendants of the instance that match the selector string. |
| Instance:Remove | () | Sets the object's Parent to nil, and does the same for all its descendants. |
| Instance:remove | () | |
| Instance:RemoveTag | () | Removes a tag from the instance. |
| Instance:ResetPropertyToDefault | () | Resets a property to its default value. |
| Instance:SetAttribute | () | Sets the attribute with the given name to the given value. |
| Instance:WaitForChild | Instance | Returns the child of the Instance with the given name. If the child does not exist, it will yield the current thread until it does. |
Inherited from Object
| Name | Type / Returns | Description |
|---|---|---|
| Object:GetPropertyChangedSignal | RBXScriptSignal | Get an event that fires when a given property of the object changes. |
| Object:IsA | boolean | Returns true if an object's class matches or inherits from a given class. |
| Object:isA | boolean |
UIDragDetector:AddConstraintFunction
Adds a function to modify or constrain proposed motion. The function takes an input UDim2 (position) and float (rotation) of proposed motion and returns a UDim2 and float of modified or unmodified motion. You can add multiple functions which will be called in order by priority, passing the results along in a chain.
The input is expressed in the space defined by the DragSpace property, either as a delta or the final desired position/rotation based on the DragRelativity property. The output should be expressed in the same space and relativity, unless overridden by returning a specified UIDragDetectorDragRelativity and UIDragDetectorDragSpace as the third and fourth return values.
To remove an added constraint function, call Disconnect() on the returned connection object.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| priority | int | The order of priority for functions added via this method. Higher values take precedence over lower values. | |
| function | Function | Function for modifying or constraining proposed motion. This function takes in input UDim2 and float of proposed motion and returns a UDim2 and float of modified or unmodified motion. It can optionally return an UIDragDetectorDragRelativity and UIDragDetectorDragSpace as the third and fourth return values as output overrides. |
Returns
| Type | Description |
|---|---|
| RBXScriptConnection | Use this connection object to remove the constraint function. |
| Field | Value |
|---|---|
| security | None |
| thread safety | Unsafe |
| capabilities | ["UI"] |
UIDragDetector:GetReferencePosition
When no ReferenceUIInstance is set, this function returns the UDim2 position of the dragged object's immediate parent GuiObject (if one exists), or else the UDim2 position of the dragged object.
When a ReferenceUIInstance is set, this function returns the UDim2 position of that reference instance.
Returns
| Type | Description |
|---|---|
| UDim2 | UDim2 position of the current drag's reference element. |
| Field | Value |
|---|---|
| security | None |
| thread safety | Unsafe |
| capabilities | ["UI"] |
UIDragDetector:GetReferenceRotation
When no ReferenceUIInstance is set, this function returns the rotation of the dragged object's immediate parent GuiObject (if one exists), or else the rotation of the dragged object.
When a ReferenceUIInstance is set, this function returns the rotation of that reference instance.
Returns
| Type | Description |
|---|---|
| float | Rotation of the current drag's reference element. |
| Field | Value |
|---|---|
| security | None |
| thread safety | Unsafe |
| capabilities | ["UI"] |
UIDragDetector:SetDragStyleFunction
Passes a function to be used if and only if DragStyle is set to UIDragDetectorDragStyle.Scriptable. The given function receives the signal's screen space input position with type Vector2, and it returns a UDim2 (position) and float (rotation) containing the desired motion of the drag. The space of the return values and the relativity of the motion are determined by the DragSpace and DragRelativity properties, unless overridden by returning a specified UIDragDetectorDragRelativity and UIDragDetectorDragSpace as the third and fourth return values.
If the function returns nil, the object will not be moved. This is useful if the script has not yet collected all the information it needs to give the correct answer, or in temporary cases where you want the object to stay where it is.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| function | Function | Function for monitoring DragContinue signals. This function receives the signal's screen space input position and returns a UDim2 and float containing the desired motion of the drag in the desired space and relativity. If this function returns nil, the object will not be moved. |
Returns
| Type | Description |
|---|---|
| () |
| Field | Value |
|---|---|
| security | None |
| thread safety | Unsafe |
| capabilities | ["UI"] |
Events
| Name | Type / Returns | Description |
|---|---|---|
| UIDragDetector.DragContinue | Fires when a user continues dragging the UI element after DragStart has been initiated. | |
| UIDragDetector.DragEnd | Fires when a user stops dragging the UI element. | |
| UIDragDetector.DragStart | Fires when a user starts dragging the UI element. |
Inherited from Instance
| Name | Type / Returns | Description |
|---|---|---|
| Instance.AncestryChanged | Fires when the Instance.Parent property of this object or one of its ancestors is changed. | |
| Instance.AttributeChanged | Fires whenever an attribute is changed on the Instance. | |
| Instance.ChildAdded | Fires after an object is parented to this Instance. | |
| Instance.childAdded | ||
| Instance.ChildRemoved | Fires after a child is removed from this Instance. | |
| Instance.DescendantAdded | Fires after a descendant is added to the Instance. | |
| Instance.DescendantRemoving | Fires immediately before a descendant of the Instance is removed. | |
| Instance.Destroying | Fires immediately before (or is deferred until after) the instance is destroyed via Instance:Destroy(). | |
| Instance.StyledPropertiesChanged | Fires whenever any style property is changed on the instance, including when a property is set to nil. |
Inherited from Object
| Name | Type / Returns | Description |
|---|---|---|
| Object.Changed | Fires immediately after a property of the object changes, with some limitations. |
UIDragDetector.DragContinue
Fires when a user continues dragging the UI element after DragStart has been initiated.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| inputPosition | Vector2 | Vector2 representing the current input position. |
| Field | Value |
|---|---|
| security | None |
| capabilities | ["UI"] |
UIDragDetector.DragEnd
Fires when a user stops dragging the UI element.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| inputPosition | Vector2 | Vector2 representing the current input position. |
| Field | Value |
|---|---|
| security | None |
| capabilities | ["UI"] |
UIDragDetector.DragStart
Fires when a user starts dragging the UI element.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| inputPosition | Vector2 | Vector2 representing the current input position. |
| Field | Value |
|---|---|
| security | None |
| capabilities | ["UI"] |