Skip to content
Roblox API Reference

UIDragDetector

Instance which facilitates and encourages interaction with UI elements in an experience.
Memory category
Instances
Own members
30
Inherited members
75
Subclasses
0
Siblings
11

Properties46

Inherited fromObject2

Property categoryData

Inherited fromInstance21

Property categoryBehavior

Property categoryData

Property categoryPermissions

Defined byUIDragDetector23

Property categoryBehavior

Property categoryDrag Directions

Property categoryDrag Limits

  • UIDragDetector.MaxDragAngle: number = 0
    Along with MinDragAngle, impedes the detector's attempts to generate rotational motion.
    • Read capabilities: UI
  • UIDragDetector.MaxDragTranslation: UDim2 = UDim2.new(0, 0, 0, 0)
    Along with MinDragTranslation, impedes the detector's attempts to generate linear/planar motion.
    • Read capabilities: UI
  • UIDragDetector.MinDragAngle: number = 0
    Along with MaxDragAngle, impedes the detector's attempts to generate rotational motion.
    • Read capabilities: UI
  • UIDragDetector.MinDragTranslation: UDim2 = UDim2.new(0, 0, 0, 0)
    Along with MaxDragTranslation, impedes the detector's attempts to generate linear/planar motion.
    • Read capabilities: UI

Property categoryDragged Amount

  • UIDragDetector.DragRotation: number = 0
    The rotation performed by the current drag.
    • Read capabilities: UI
  • UIDragDetector.DragUDim2: UDim2 = UDim2.new(0, 0, 0, 0)
    The translation performed by the current drag expressed in a UDim2 value.
    • Read capabilities: UI

Property categoryImage

  • UIDragDetector.ActivatedCursorIcon: string = ""
    Sets the cursor icon to display when the mouse is activated over the parent of this UIDragDetector.
    • Read capabilities: UI
  • UIDragDetector.ActivatedCursorIconContent: Content
    Sets the cursor icon to display when the mouse is activated over the parent of this UIDragDetector. Only supports asset URIs
    • Read capabilities: UI
  • UIDragDetector.CursorIcon: string = ""
    Sets the cursor icon to display when the mouse is hovered over the parent of this UIDragDetector.
    • Read capabilities: UI
  • 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.
    • Read capabilities: UI

Methods46

Inherited fromObject3
  • Get an event that fires when a given property of the object changes.
    Parameters
    ParameterDescription
    property: string
    The property to connect to.
    Returns
    TypeDescription
    RBXScriptSignal
    A signal that fires whenever the property changes.
  • Object:IsA(className: string): boolean
    Returns true if an object's class matches or inherits from a given class.
    • Custom Lua state
    • Thread safe
    Parameters
    ParameterDescription
    className: string
    The class against which the Object's class will be checked. Case-sensitive.
    Returns
    TypeDescription
    boolean
    Describes whether the Object's class matched or is a subclass of the given class.
  • Object:isA(className: string): boolean
    Deprecated: This deprecated function is a variant of Object:IsA() which should be used instead.
    • Deprecated
    • Custom Lua state
    Parameters
    Parameter
    className: string
    Returns
    Type
    boolean

    Use IsA instead.

Inherited fromInstance39
Defined byUIDragDetector4
  • UIDragDetector:AddConstraintFunction(priority: number,function: (...any) -> ...any,): RBXScriptConnection
    Adds a function to modify or constrain proposed motion.
    • Capabilities: UI
    Parameters
    ParameterDescription
    priority: number
    The order of priority for functions added via this method. Higher values take precedence over lower values.
    function: (...any) -> ...any
    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
    TypeDescription
    RBXScriptConnection
    Use this connection object to remove the constraint function.
  • UIDragDetector:GetReferencePosition(): UDim2
    Returns the reference UDim2 position of the current drag's reference origin.
    • Capabilities: UI
    Returns
    TypeDescription
    UDim2
    UDim2 position of the current drag's reference element.
  • UIDragDetector:GetReferenceRotation(): number
    Returns the reference rotation of the current drag's reference element.
    • Capabilities: UI
    Returns
    TypeDescription
    number
    Rotation of the current drag's reference element.
  • UIDragDetector:SetDragStyleFunction(function: (...any) -> ...any)
    Passes a function to be used if and only if DragStyle is set to UIDragDetectorDragStyle.Scriptable.
    • Capabilities: UI
    Parameters
    ParameterDescription
    function: (...any) -> ...any
    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.

Events13

Inherited fromObject1
Inherited fromInstance9
Defined byUIDragDetector3
  • UIDragDetector.DragContinue: RBXScriptSignal<(inputPosition: Vector2)>
    Fires when a user continues dragging the UI element after DragStart has been initiated.
    • Capabilities: UI
    Parameters
    Parameter
    inputPosition: Vector2
  • UIDragDetector.DragEnd: RBXScriptSignal<(inputPosition: Vector2)>
    Fires when a user stops dragging the UI element.
    • Capabilities: UI
    Parameters
    Parameter
    inputPosition: Vector2
  • UIDragDetector.DragStart: RBXScriptSignal<(inputPosition: Vector2)>
    Fires when a user starts dragging the UI element.
    • Capabilities: UI
    Parameters
    Parameter
    inputPosition: Vector2