Skip to content
Roblox API Reference

ContextActionService

A service used to bind user input to contextual actions.
  • Not creatable
  • Service
Memory category
Instances
Own members
34
Inherited members
75
Subclasses
0
Siblings
608

Properties23

Inherited fromObject2

Property categoryData

Inherited fromInstance21

Property categoryBehavior

Property categoryData

Property categoryPermissions

Methods68

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 byContextActionService26
  • ContextActionService:BindAction(actionName: string,functionToBind: (...any) -> ...any,createTouchButton: boolean,...: any,)
    Bind user input to an action given an action handling function.
    • Capabilities: Input
    Parameters
    ParameterDescription
    actionName: string
    A string representing the action being performed (e.g. "HonkHorn" or "OpenDoor").
    functionToBind: (...any) -> ...any
    The action-handling function, called with the following parameters when the bound inputs are triggered: string (actionName), UserInputState and an InputObject.
    createTouchButton: boolean
    Whether a GUI button should be created for the action on touch input devices.
    ...: any
    Any number of KeyCode or UserInputType representing the inputs to bind to the action.
  • ContextActionService:BindActionAtPriority(actionName: string,functionToBind: (...any) -> ...any,createTouchButton: boolean,priorityLevel: number,...: any,)
    Behaves like BindAction but also allows a priority to be assigned to the bound action for overlapping input types (higher before lower).
    • Capabilities: Input
    Parameters
    ParameterDescription
    actionName: string
    A string representing the action being performed (e.g. "HonkHorn" or "OpenDoor").
    functionToBind: (...any) -> ...any
    The action-handling function, called with the following parameters when the bound inputs are triggered: string (actionName), UserInputState and an InputObject.
    createTouchButton: boolean
    Whether a GUI button should be created for the action on touch input devices.
    priorityLevel: number
    The priority level at which the action should be bound (higher considered before lower).
    ...: any
    Any number of Enum.KeyCode or Enum.UserInputType representing the inputs to bind to the action.
  • ContextActionService:BindActivate(userInputTypeForActivation: Enum.UserInputType,...: any,)
    Bind a KeyCode with a specific UserInputType to trigger Tool.Activation and ClickDetector events.
    • Capabilities: Input
    Parameters
    ParameterDescription
    userInputTypeForActivation: Enum.UserInputType
    Must be Keyboard or Gamepad1 through Gamepad8.
    ...: any
    Any number of KeyCode values that trigger Tool activation for the specified UserInputType.
  • ContextActionService:BindCoreAction(actionName: string,functionToBind: (...any) -> ...any,createTouchButton: boolean,...: any,)
    • Roblox script security
    • Capabilities: Input
    Parameters
    Parameter
    actionName: string
    functionToBind: (...any) -> ...any
    createTouchButton: boolean
    ...: any
  • ContextActionService:BindCoreActionAtPriority(actionName: string,functionToBind: (...any) -> ...any,createTouchButton: boolean,priorityLevel: number,...: any,)
    • Roblox script security
    • Capabilities: Input
    Parameters
    Parameter
    actionName: string
    functionToBind: (...any) -> ...any
    createTouchButton: boolean
    priorityLevel: number
    ...: any
  • ContextActionService:BindCoreActivate(userInputTypeForActivation: Enum.UserInputType,...: any,)
    • Roblox script security
    • Capabilities: Input
    Parameters
    Parameter
    userInputTypeForActivation: Enum.UserInputType
    ...: any
  • ContextActionService:CallFunction(actionName: string,state: Enum.UserInputState,inputObject: Instance,): ...any
    • Roblox script security
    • Capabilities: Input
    Parameters
    Parameter
    actionName: string
    state: Enum.UserInputState
    inputObject: Instance
    Returns
    Type
    ...any
  • ContextActionService:FireActionButtonFoundSignal(actionName: string,actionButton: Instance,)
    • Roblox script security
    • Capabilities: Input
    Parameters
    Parameter
    actionName: string
    actionButton: Instance
  • ContextActionService:GetAllBoundActionInfo(): { [string]: any }
    Get a table of information about all bound actions (key is the name passed to BindAction, value is a table from GetBoundActionInfo when called with the key).
    • Capabilities: Input
    Returns
    TypeDescription
    { [string]: any }
    A dictionary mapping each bound action name to its info table.
  • ContextActionService:GetAllBoundCoreActionInfo(): { [string]: any }
    • Roblox script security
    • Capabilities: Input
  • ContextActionService:GetBoundActionInfo(actionName: string): { [string]: any }
    Get a table of information about a bound action given its name originally passed to BindAction.
    • Capabilities: Input
    Parameters
    ParameterDescription
    actionName: string
    The name of the action originally passed to BindAction.
    Returns
    TypeDescription
    { [string]: any }
    A dictionary with keys describing the bound action, including stackOrder, priorityLevel, createTouchButton, inputTypes, description, title, and image.
  • ContextActionService:GetBoundCoreActionInfo(actionName: string): { [string]: any }
    • Roblox script security
    • Capabilities: Input
    Parameters
    Parameter
    actionName: string
  • ContextActionService:GetButton(actionName: string): Instance
    Retrieves a ImageButton of a bound action that had a touch input button created.
    • Yields
    • Capabilities: Input
    Parameters
    ParameterDescription
    actionName: string
    The name of the action originally passed to BindAction.
    Returns
    TypeDescription
    Instance
    An ImageButton created by BindAction.
  • ContextActionService:GetCurrentLocalToolIcon(): string
    Return the BackpackItem.TextureId of a Tool currently equipped by the Player.
    • Capabilities: Input
    Returns
    TypeDescription
    string
    A content string from the Tool's TextureId, or nil if one could not be found.
  • ContextActionService:GetInputContexts(): { Instance }
    • Roblox script security
    • Capabilities: Input
    Returns
    Type
    { Instance }
  • ContextActionService:GetInputSchemaKeyCodeTree(): { [string]: any }
    • Roblox script security
    • Capabilities: Input
  • ContextActionService:SetDescription(actionName: string, description: string)
    Given the name of a bound action with a touch button, sets the description of the action.
    • Capabilities: Input
    Parameters
    ParameterDescription
    actionName: string
    The name of the action originally passed to BindAction.
    description: string
    A text description of the action, such as "Honk the car's horn" or "Open the inventory".
  • ContextActionService:SetImage(actionName: string, image: string)
    If actionName key contains a bound action, then image is set as the image of the touch button.
    • Capabilities: Input
    Parameters
    ParameterDescription
    actionName: string
    The name of the action originally passed to BindAction.
    image: string
    The value to which the Image property should be set.
  • ContextActionService:SetPosition(actionName: string, position: UDim2)
    Given the name of a bound action with a touch button, sets the position of the button within the ContextButtonFrame.
    • Capabilities: Input
    Parameters
    ParameterDescription
    actionName: string
    The name of the action originally passed to BindAction.
    position: UDim2
    The position within the ContextButtonFrame.
  • ContextActionService:SetTitle(actionName: string, title: string)
    Given the name of a bound action with a touch button, sets the text shown on the button.
    • Capabilities: Input
    Parameters
    ParameterDescription
    actionName: string
    The name of the action originally passed to BindAction.
    title: string
    The text to display on the button.
  • ContextActionService:UnbindAction(actionName: string)
    Unbind an action from input given its name.
    • Capabilities: Input
    Parameters
    ParameterDescription
    actionName: string
    The name of the action to unbind, as originally passed to BindAction.
  • ContextActionService:UnbindActivate(userInputTypeForActivation: Enum.UserInputType,keyCodeForActivation: Enum.KeyCode? = Enum.KeyCode.None,)
    Unbind a KeyCode with a specific UserInputType from triggering Tool.Activation when bound with ContextActionService:BindActivate().
    • Capabilities: Input
    Parameters
    ParameterDescription
    userInputTypeForActivation: Enum.UserInputType
    The same UserInputType originally sent to BindActivate.
    keyCodeForActivation: Enum.KeyCode? = Enum.KeyCode.None
    The same KeyCode originally sent to BindActivate.
  • ContextActionService:UnbindAllActions()
    Removes all functions bound. No actionNames will remain. All touch buttons will be removed.
    • Capabilities: Input
  • ContextActionService:UnbindCoreAction(actionName: string)
    • Roblox script security
    • Capabilities: Input
    Parameters
    Parameter
    actionName: string
  • ContextActionService:UnbindCoreActivate(userInputTypeForActivation: Enum.UserInputType,keyCodeForActivation: Enum.KeyCode? = Enum.KeyCode.None,)
    • Roblox script security
    • Capabilities: Input
    Parameters
    Parameter
    userInputTypeForActivation: Enum.UserInputType
    keyCodeForActivation: Enum.KeyCode? = Enum.KeyCode.None
  • ContextActionService:BindActionToInputTypes(actionName: string,functionToBind: (...any) -> ...any,createTouchButton: boolean,...: any,)
    Deprecated: This item has been superseded by ContextActionService:BindAction() which should be used in all new work.
    Binds functionToBind to input events such as key presses, mouse movement, or controller input.
    • Deprecated
    • Capabilities: Input
    Parameters
    Parameter
    actionName: string
    functionToBind: (...any) -> ...any
    createTouchButton: boolean
    ...: any

    Use BindAction instead.

Events18

Inherited fromObject1
Inherited fromInstance9
Defined byContextActionService8