ContextActionService

extends Instance

Class fields

FieldXML typeValue
NamestringContextActionService
summarystringA service used to bind input to various lua functions.

Functions

17
BindAction
(actionName: string, functionToBind: Function, createTouchButton: bool, inputTypes: Tuple) → void
FieldXML typeValue
NamestringBindAction
summarystringBinds 'functionToBind' to fire when any 'inputTypes' happen. InputTypes can be variable in number and type. Types can be Enum.KeyCode, single character strings corresponding to keys, or Enum.UserInputType. 'actionName' is a key used by many other ContextActionService functions to query state. 'createTouchButton' if true will create a button on screen on touch devices. This button will fire 'functionToBind' with three arguments: first argument is the actionName, second argument is the UserInputState of the input, and the third is the InputObject that fired this function.
BindActionToInputTypes
(actionName: string, functionToBind: Function, createTouchButton: bool, inputTypes: Tuple) → void
FieldXML typeValue
NamestringBindActionToInputTypes
BindActivate
(userInputTypeForActivation: UserInputType, keyCodeForActivation: KeyCode = …) → void
FieldXML typeValue
NamestringBindActivate
BindCoreAction
(actionName: string, functionToBind: Function, createTouchButton: bool, inputTypes: Tuple) → void
FieldXML typeValue
NamestringBindCoreAction
CallFunction
(actionName: string, state: UserInputState, inputObject: Instance) → void
FieldXML typeValue
NamestringCallFunction
FireActionButtonFoundSignal
(actionName: string, actionButton: Instance) → void
FieldXML typeValue
NamestringFireActionButtonFoundSignal
GetAllBoundActionInfo
() → Dictionary
FieldXML typeValue
NamestringGetAllBoundActionInfo
summarystringReturns a table with all bound action info. Each entry is a key with 'actionName' and value being the same table you would get from ContextActionService:GetBoundActionInfo('actionName').
GetBoundActionInfo
(actionName: string) → Dictionary
FieldXML typeValue
NamestringGetBoundActionInfo
summarystringReturns a table with info regarding the function bound with 'actionName'. Table has the keys 'title' (current title that was set with SetTitle) 'image' (image set with SetImage) 'description' (description set with SetDescription) 'inputTypes' (tuple containing all input bound for this 'actionName') 'createTouchButton' (whether or not we created a touch button for this 'actionName').
GetCurrentLocalToolIcon
() → string
FieldXML typeValue
NamestringGetCurrentLocalToolIcon
SetDescription
(actionName: string, description: string) → void
FieldXML typeValue
NamestringSetDescription
summarystringIf 'actionName' key contains a bound action, then 'description' is set as the description of the bound action. This description will appear for users in a listing of current actions availables.
SetImage
(actionName: string, image: string) → void
FieldXML typeValue
NamestringSetImage
summarystringIf 'actionName' key contains a bound action, then 'image' is set as the image of the touch button. Does nothing if a touch button was not created. No guarantees are made whether image will be set when button is manipulated.
SetPosition
(actionName: string, position: UDim2) → void
FieldXML typeValue
NamestringSetPosition
summarystringIf 'actionName' key contains a bound action, then 'position' is set as the position of the touch button. Does nothing if a touch button was not created. No guarantees are made whether position will be set when button is manipulated.
SetTitle
(actionName: string, title: string) → void
FieldXML typeValue
NamestringSetTitle
summarystringIf 'actionName' key contains a bound action, then 'title' is set as the title of the touch button. Does nothing if a touch button was not created. No guarantees are made whether title will be set when button is manipulated.
UnbindAction
(actionName: string) → void
FieldXML typeValue
NamestringUnbindAction
summarystringIf 'actionName' key contains a bound action, removes function from being called by all input that it was bound by (if function was also bound by a different action name as well, those bound input are still active). Will also remove any touch button created (if button was manipulated manually there is no guarantee it will be cleaned up).
UnbindActivate
(userInputTypeForActivation: UserInputType, keyCodeForActivation: KeyCode = …) → void
FieldXML typeValue
NamestringUnbindActivate
UnbindAllActions
() → void
FieldXML typeValue
NamestringUnbindAllActions
summarystringRemoves all functions bound. No actionNames will remain. All touch buttons will be removed. If button was manipulated manually there is no guarantee it will be cleaned up.
UnbindCoreAction
(actionName: string) → void
FieldXML typeValue
NamestringUnbindCoreAction

Yield functions

1
GetButton
(actionName: string) → Instance
FieldXML typeValue
NamestringGetButton
summarystringIf 'actionName' key contains a bound action, then this will return the touch button (if was created). Returns nil if a touch button was not created. No guarantees are made whether button will be retrievable when button is manipulated.

Events

6
BoundActionAdded
(actionAdded: string, createTouchButton: bool, functionInfoTable: Dictionary) → void
FieldXML typeValue
NamestringBoundActionAdded
BoundActionChanged
(actionChanged: string, changeName: string, changeTable: Dictionary) → void
FieldXML typeValue
NamestringBoundActionChanged
BoundActionRemoved
(actionRemoved: string, functionInfoTable: Dictionary) → void
FieldXML typeValue
NamestringBoundActionRemoved
GetActionButtonEvent
(actionName: string) → void
FieldXML typeValue
NamestringGetActionButtonEvent
LocalToolEquipped
(toolEquipped: Instance) → void
FieldXML typeValue
NamestringLocalToolEquipped
LocalToolUnequipped
(toolUnequipped: Instance) → void
FieldXML typeValue
NamestringLocalToolUnequipped