Skip to content
Roblox API Reference

VirtualInput

Simulates mouse, keyboard, and pointer input as if it were performed by a real player.
  • Not creatable
  • Not replicated
Memory category
Instances
Own members
6
Inherited members
6
Subclasses
0
Siblings
30

Properties2

Inherited fromObject2

Property categoryData

Methods9

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.

Defined byVirtualInput6
  • VirtualInput:SendKey(isPressed: boolean,keyCode: Enum.KeyCode,isRepeatedKey: boolean? = false,)
    Injects a keyboard key press or release event.
    Parameters
    ParameterDescription
    isPressed: boolean
    Whether to simulate a key press (true) or a key release (false).
    keyCode: Enum.KeyCode
    The KeyCode of the key to inject.
    isRepeatedKey: boolean? = false
    Whether this is an auto-repeat event, as occurs when a key is held down. Only valid for text-manipulation keys such as KeyCode.Backspace, KeyCode.Delete, and the arrow keys. Defaults to false.
  • VirtualInput:SendMouseButton(position: Vector2,button: Enum.UserInputType,isDown: boolean,repeatCount: number? = 0,)
    Injects a mouse button press or release event at the specified screen position.
    Parameters
    ParameterDescription
    position: Vector2
    The screen-space position in pixels at which to inject the event.
    button: Enum.UserInputType
    The mouse button to use. Supported values are UserInputType.MouseButton1, UserInputType.MouseButton2, and UserInputType.MouseButton3.
    isDown: boolean
    Whether to simulate a button press (true) or a button release (false).
    repeatCount: number? = 0
    The consecutive-click count for multi-click detection, such as a double- or triple-click. Defaults to 0.
  • VirtualInput:SendMouseDelta(positionDelta: Vector2)
    Injects a relative mouse movement event. Only works while the player's cursor is locked.
    Parameters
    ParameterDescription
    positionDelta: Vector2
    The relative mouse movement in pixels along each axis.
  • VirtualInput:SendMousePosition(position: Vector2)
    Moves the virtual mouse cursor to the specified absolute screen position.
    Parameters
    ParameterDescription
    position: Vector2
    The target screen-space position in pixels.
  • VirtualInput:SendPointerAction(position: Vector2,pointerAction: { [string]: any },)
    Injects a scroll wheel, trackpad pan, or pinch gesture event at the specified screen position.
    Parameters
    ParameterDescription
    position: Vector2
    The screen-space position in pixels at which to inject the event.
    pointerAction: { [string]: any }
    A dictionary describing the pointer action to inject. Accepted keys are Wheel (number), Pan (Vector2), and Pinch (number). At least one key must have a non-zero value.
  • VirtualInput:SendTextInput(text: string)
    Injects a text input event as if the specified string was typed on a keyboard.
    Parameters
    ParameterDescription
    text: string
    The string to inject as text input.

Events1

Inherited fromObject1