ContextActionService
A service used to bind user input to contextual actions.
Memory category | Instances |
---|
Member index 30
Removed member index 3
History | Member | |
---|---|---|
145 | ContextButtonEnabled: bool | |
145 | ActivateLocalTool(): void | |
145 | DeactivateLocalTool(): void |
Description
Allows an experience to bind user input to contextual actions, or actions that are only enabled under some condition or period of time. For example, allowing a player to open a door only while close by. In code, an action is simply a string (the name of the action) used by the service to differentiate between unique actions. The action string is provided to BindAction and UnbindAction, among other member functions. If two actions are bound to the same input, the most recently bound will take priority. When the most recent action is unbound, the one bound before that takes control again. Since this service deals with user input, you can only use it in client-side LocalScripts.
Context and Action
A context is simply a condition during which a player may perform some action. Some examples include holding a Tool, being seated in a car or standing near a door. Whatever the case may be, it is up to your LocalScripts to call BindAction when the context is entered and UnbindAction when the context is left.
An action is simply some input that can be performed by the player while in that context. Such an action could open/close some menu, trigger a secondary tool action or send a request to the server using RemoteFunction:InvokeServer(). An action is identified by a unique string as the first parameter of both BindAction and UnbindAction. The string can be anything, but it should reflect the action being performed, not the input being used. For example, don't use "KeyH" as an action name - use "CarHorn" instead. It is best to define your actions as a constant at the top of your script since you will use it in at least three different places in your code.
Binding Actions Contextually
It's better to use ContextActionService's
BindAction than
UserInputService.InputBegan for most cases. For
UserInputService.InputBegan, your connected function would have to
check if the player is in the context of the action being performed. In most
cases, this is harder than just calling a function when a context is entered/
left. For example, if you want to have the H
key trigger a car horn sound
while the player is sitting in it, the player might type "hello" in chat or
otherwise use the H
key for something else. It is harder to determine if
something else is using the H key (like chat) - the car might honk when the
player didn't mean to. If you instead use
BindAction and
UnbindAction when the player
enters/leaves the car, ContextActionService will make sure that H
key presses trigger the honk action only when it is the most recently bound
action. If something else (like chat) takes control, you won't have to worry
about checking that.
Inspecting Bound Actions
To see a list of actions and their bound inputs, you can inspect the "Action Bindings" tab in the Developer Console (F9 while in game). This shows all bindings, including those bound by Roblox core scripts and default camera/control scripts too. This is useful for debugging if your actions are being bound/unbound at the correct times, or if some other action is stealing input from your actions. For example, if you are attempting to bind WASD, it may be the case that default character movement scripts are binding over those same keys. Similarly, the camera control script can steal right-click input if the script runs after yours.
Keyboardless Input
This service is especially useful for supporting gamepad and touch input. For gamepad input, you might choose to bind the B button to an action that returns the user to the previous menu when they enter another menu. For touch, on-screen touch buttons can be used in place of key presses: these buttons display only while the action is bound, and the position, text and/or images of these buttons can be configured through this service. They're somewhat limited in the amount of customization provided by this service; it's usually a better idea to make your own on-screen buttons using ImageButton or TextButton.
History 92
- 573 Change ReturnType of UnbindCoreActivate from void to null
- 573 Change ReturnType of UnbindCoreAction from void to null
- 573 Change ReturnType of UnbindAllActions from void to null
- 573 Change ReturnType of UnbindActivate from void to null
- 573 Change ReturnType of UnbindAction from void to null
- 573 Change ReturnType of SetTitle from void to null
- 573 Change ReturnType of SetPosition from void to null
- 573 Change ReturnType of SetImage from void to null
- 573 Change ReturnType of SetDescription from void to null
- 573 Change ReturnType of FireActionButtonFoundSignal from void to null
- 573 Change ReturnType of BindCoreActivate from void to null
- 573 Change ReturnType of BindCoreActionAtPriority from void to null
- 573 Change ReturnType of BindCoreAction from void to null
- 573 Change ReturnType of BindActivate from void to null
- 573 Change ReturnType of BindActionToInputTypes from void to null
- 573 Change ReturnType of BindActionAtPriority from void to null
- 573 Change ReturnType of BindAction from void to null
- 567 Add UnbindCoreActivate
- 567 Add BindCoreActivate
- 553 Change PreferredDescriptor of BindActionToInputTypes from to BindAction
- 549 Change Parameters of BindActivate from (userInputTypeForActivation: UserInputType, keyCodeForActivation: KeyCode = Unknown) to (userInputTypeForActivation: UserInputType, keyCodesForActivation: Tuple)
- 462 Change ThreadSafety of LocalToolUnequipped from to Unsafe
- 462 Change ThreadSafety of LocalToolEquipped from to Unsafe
- 462 Change ThreadSafety of GetActionButtonEvent from to Unsafe
- 462 Change ThreadSafety of BoundActionRemoved from to Unsafe
- 462 Change ThreadSafety of BoundActionChanged from to Unsafe
- 462 Change ThreadSafety of BoundActionAdded from to Unsafe
- 462 Change ThreadSafety of UnbindCoreAction from to Unsafe
- 462 Change ThreadSafety of UnbindAllActions from to Unsafe
- 462 Change ThreadSafety of UnbindActivate from to Unsafe
- 462 Change ThreadSafety of UnbindAction from to Unsafe
- 462 Change ThreadSafety of SetTitle from to Unsafe
- 462 Change ThreadSafety of SetPosition from to Unsafe
- 462 Change ThreadSafety of SetImage from to Unsafe
- 462 Change ThreadSafety of SetDescription from to Unsafe
- 462 Change ThreadSafety of GetCurrentLocalToolIcon from to Unsafe
- 462 Change ThreadSafety of GetButton from to Unsafe
- 462 Change ThreadSafety of GetBoundCoreActionInfo from to Unsafe
- 462 Change ThreadSafety of GetBoundActionInfo from to Unsafe
- 462 Change ThreadSafety of GetAllBoundCoreActionInfo from to Unsafe
- 462 Change ThreadSafety of GetAllBoundActionInfo from to Unsafe
- 462 Change ThreadSafety of FireActionButtonFoundSignal from to Unsafe
- 462 Change ThreadSafety of CallFunction from to Unsafe
- 462 Change ThreadSafety of BindCoreActionAtPriority from to Unsafe
- 462 Change ThreadSafety of BindCoreAction from to Unsafe
- 462 Change ThreadSafety of BindActivate from to Unsafe
- 462 Change ThreadSafety of BindActionToInputTypes from to Unsafe
- 462 Change ThreadSafety of BindActionAtPriority from to Unsafe
- 462 Change ThreadSafety of BindAction from to Unsafe
- 313 Add BindCoreActionAtPriority
- 296 Change Parameters of BoundActionRemoved from (actionRemoved: string, functionInfoTable: Dictionary) to (actionRemoved: string, functionInfoTable: Dictionary, isCore: bool)
- 296 Change Parameters of BoundActionAdded from (actionAdded: string, createTouchButton: bool, functionInfoTable: Dictionary) to (actionAdded: string, createTouchButton: bool, functionInfoTable: Dictionary, isCore: bool)
- 296 Add GetBoundCoreActionInfo
- 296 Add GetAllBoundCoreActionInfo
- 295 Add BindActionAtPriority
- 294 Change ReturnType of CallFunction from void to Tuple
- 199 Add UnbindActivate
- 199 Add BindActivate
- 194 Add UnbindCoreAction
- 194 Add BindCoreAction
- 193 Change Tags of BindActionToInputTypes from [] to [Deprecated]
- 193 Add BindAction
- 192 Change Tags of BindActionToInputTypes from [Deprecated] to []
- 192 Remove BindAction
- 193 Change Tags of BindActionToInputTypes from [] to [Deprecated]
- 193 Add BindAction
- 145 Add GetActionButtonEvent
- 145 Add BoundActionRemoved
- 145 Add BoundActionChanged
- 145 Add BoundActionAdded
- 145 Add UnbindAllActions
- 145 Add UnbindAction
- 145 Add SetTitle
- 145 Add SetPosition
- 145 Add SetImage
- 145 Add SetDescription
- 145 Add GetButton
- 145 Add GetBoundActionInfo
- 145 Add GetAllBoundActionInfo
- 145 Add FireActionButtonFoundSignal
- 145 Remove DeactivateLocalTool
- 145 Add CallFunction
- 145 Add BindActionToInputTypes
- 145 Remove ActivateLocalTool
- 145 Remove ContextButtonEnabled
- 90 Add LocalToolUnequipped
- 90 Add LocalToolEquipped
- 90 Add GetCurrentLocalToolIcon
- 90 Add DeactivateLocalTool
- 90 Add ActivateLocalTool
- 90 Add ContextButtonEnabled
- 90 Add ContextActionService
Members 30
BindAction
Parameters (4) | ||
---|---|---|
actionName | string | |
functionToBind | Function | |
createTouchButton | bool | |
inputTypes | Tuple | |
Returns (1) | ||
null |
Bind an action to user input given an action handling function. Upon a
matching input being performed, the action handler function will be called
with the arguments listed below. Valid input enum items include those
within the following: KeyCode, UserInputType or
PlayerActions . Call this function when a player enters the
context in which an action can be performed. When the player leaves the
context, call UnbindAction
with the same actionName
. You can manually call the action handling
function of an action by using
CallFunction.
The code sample below shows how a Sound can be played while a key (H), game pad button, or touch screen button is pressed.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
|
Action Handler Parameters
The action handler functions are called with the following parameters:
# | Type | Description |
---|---|---|
1 | string | The same string that was originally passed to BindAction† |
2 | UserInputState | The state of the input (Begin, Change, End or Cancel)* |
3 | InputObject | An object that contains information about the input (varies based on UserInputType) |
† This allows one function to handle multiple actions at once, if necessary. *Cancel is sent if some input was in-progress and another action bound over the in-progress input, or if the in-progress bound action was unbound.
Action Bindings Stack
Action bindings behave like a stack: if two actions are bound to the same
user input, the most recently bound action handler will be used. If an
action handler returns ContextActionResult.Pass, the next most
recently bound action handler will be called, and so on until a handler
sinks the input (by returning nil
or ContextActionResult.Sink).
When UnbindAction is called,
the action handler is removed from the stack. This stack behavior can be
overridden using
BindActionAtPriority,
where an additional priority parameter after createTouchButton
may
override the order in which actions are bound (higher before lower).
Touch Buttons
In addition to input types, this function's third parameter controls whether a button is created for TouchEnabled devices. Upon the first touch button's creation, a ScreenGui named "ContextActionGui" is added to the PlayerGui. Inside the ScreenGui is a Frame called "ContextButtonFrame" is added. It is in this frame in which ImageButtons for bound actions are parented; you can use GetButton to retrieve such buttons for customization.
Thread safety | Unsafe |
---|
History 5
- 573 Change ReturnType of BindAction from void to null
- 462 Change ThreadSafety of BindAction from to Unsafe
- 193 Add BindAction
- 192 Remove BindAction
- 193 Add BindAction
BindActionAtPriority
Parameters (5) | ||
---|---|---|
actionName | string | |
functionToBind | Function | |
createTouchButton | bool | |
priorityLevel | int | |
inputTypes | Tuple | |
Returns (1) | ||
null |
BindActionAtPriority behaves like BindAction but also allows a priority to be assigned to the bound action. If multiple actions are bound to the same input, the higher priority function is called regardless of the order in which the actions were bound. In other words, this function overrides the normal "stack" behavior of BindAction.
Thread safety | Unsafe |
---|
History 3
- 573 Change ReturnType of BindActionAtPriority from void to null
- 462 Change ThreadSafety of BindActionAtPriority from to Unsafe
- 295 Add BindActionAtPriority
BindActionToInputTypes
Parameters (4) | ||
---|---|---|
actionName | string | |
functionToBind | Function | |
createTouchButton | bool | |
inputTypes | Tuple | |
Returns (1) | ||
null |
This function binds functionToBind to input events such as key presses, mouse movement, or controller input. The specific input types the engine listens for are listed as parameters of BindAction. Whenever a player uses any of these input types, the Roblox engine calls "functionToBind". BindAction sets the priorityLevel via ContextActionPriority to Default.Value, which is 2000. Use ContextActionService:GetButton() to control the priority of bound events.
In addition to input types, BindAction has a createTouchButton parameter. When this is set to true it creates an ImageButton on any device with a touchscreen. A ScreenGui is also created to put the context buttons into named ContextActionGui and is parented to PlayerGui. The created ImageButton is parented to this ContextActionGui. GetButton can be used to retrieve the button that was created.
If an input has more than one function bound to it, each function will be placed on a stack. A stack obeys the principle of last in first out. So the first object placed on the stack will be on the top. The next object placed on the stack becomes the top and the previous object moves one position down (like a stack of books). When the input is triggered, the function at the top of the stack is called. If the function returns ContextActionResult.Pass this will continue down the stack. To remove a function from being called by all input that it was bound by use ContextActionService:UnbindAction().
BindAction allows control over whether or not a bound action should be processed by other actions on the stack using ContextActionResult. If ContextActionResult.Pass is returned in the callback function, every action below it in the stack (last function called gets executed first) will get a chance to process it. Anything other than Pass will be treated as ContextActionResult.Sink, including nil. It will also sink if the callback is yielded.
Thread safety | Unsafe |
---|
History 7
- 573 Change ReturnType of BindActionToInputTypes from void to null
- 553 Change PreferredDescriptor of BindActionToInputTypes from to BindAction
- 462 Change ThreadSafety of BindActionToInputTypes from to Unsafe
- 193 Change Tags of BindActionToInputTypes from [] to [Deprecated]
- 192 Change Tags of BindActionToInputTypes from [Deprecated] to []
- 193 Change Tags of BindActionToInputTypes from [] to [Deprecated]
- 145 Add BindActionToInputTypes
BindActivate
Parameters (2) | ||
---|---|---|
userInputTypeForActivation | UserInputType | |
keyCodesForActivation | Tuple | |
Returns (1) | ||
null |
Bind a KeyCode that can be used with a UserInputType to activate ClickDetector events, Tools, and GuiButtons. When the given key/button is pressed, it fires the Mouse.Button1Down event on the mouse sent to Tool.Equipped. This in turn fires the Tool.Activated event if Tool.ManualActivationOnly is not set to true. For gamepad input, this function is called by the default control scripts in order to bind the ButtonR2 KeyCode.
Note that the UserInputType specified must be Keyboard
or
Gamepad1
through Gamepad8
in order to be valid.
Thread safety | Unsafe |
---|
History 4
- 573 Change ReturnType of BindActivate from void to null
- 549 Change Parameters of BindActivate from (userInputTypeForActivation: UserInputType, keyCodeForActivation: KeyCode = Unknown) to (userInputTypeForActivation: UserInputType, keyCodesForActivation: Tuple)
- 462 Change ThreadSafety of BindActivate from to Unsafe
- 199 Add BindActivate
BindCoreAction
Parameters (4) | ||
---|---|---|
actionName | string | |
functionToBind | Function | |
createTouchButton | bool | |
inputTypes | Tuple | |
Returns (1) | ||
null |
Security | RobloxScriptSecurity |
---|---|
Thread safety | Unsafe |
History 3
- 573 Change ReturnType of BindCoreAction from void to null
- 462 Change ThreadSafety of BindCoreAction from to Unsafe
- 194 Add BindCoreAction
BindCoreActionAtPriority
Parameters (5) | ||
---|---|---|
actionName | string | |
functionToBind | Function | |
createTouchButton | bool | |
priorityLevel | int | |
inputTypes | Tuple | |
Returns (1) | ||
null |
Security | RobloxScriptSecurity |
---|---|
Thread safety | Unsafe |
History 3
- 573 Change ReturnType of BindCoreActionAtPriority from void to null
- 462 Change ThreadSafety of BindCoreActionAtPriority from to Unsafe
- 313 Add BindCoreActionAtPriority
BindCoreActivate
Parameters (2) | ||
---|---|---|
userInputTypeForActivation | UserInputType | |
keyCodesForActivation | Tuple | |
Returns (1) | ||
null |
Security | RobloxScriptSecurity |
---|---|
Thread safety | Unsafe |
History 2
- 573 Change ReturnType of BindCoreActivate from void to null
- 567 Add BindCoreActivate
BoundActionAdded
Parameters (4) | |
---|---|
actionAdded | string |
createTouchButton | bool |
functionInfoTable | Dictionary |
isCore | bool |
Security | RobloxScriptSecurity |
---|---|
Thread safety | Unsafe |
History 3
- 462 Change ThreadSafety of BoundActionAdded from to Unsafe
- 296 Change Parameters of BoundActionAdded from (actionAdded: string, createTouchButton: bool, functionInfoTable: Dictionary) to (actionAdded: string, createTouchButton: bool, functionInfoTable: Dictionary, isCore: bool)
- 145 Add BoundActionAdded
BoundActionChanged
Parameters (3) | |
---|---|
actionChanged | string |
changeName | string |
changeTable | Dictionary |
Security | RobloxScriptSecurity |
---|---|
Thread safety | Unsafe |
History 2
- 462 Change ThreadSafety of BoundActionChanged from to Unsafe
- 145 Add BoundActionChanged
BoundActionRemoved
Parameters (3) | |
---|---|
actionRemoved | string |
functionInfoTable | Dictionary |
isCore | bool |
Security | RobloxScriptSecurity |
---|---|
Thread safety | Unsafe |
History 3
- 462 Change ThreadSafety of BoundActionRemoved from to Unsafe
- 296 Change Parameters of BoundActionRemoved from (actionRemoved: string, functionInfoTable: Dictionary) to (actionRemoved: string, functionInfoTable: Dictionary, isCore: bool)
- 145 Add BoundActionRemoved
CallFunction
Parameters (3) | ||
---|---|---|
actionName | string | |
state | UserInputState | |
inputObject | Instance | |
Returns (1) | ||
Tuple |
Security | RobloxScriptSecurity |
---|---|
Thread safety | Unsafe |
History 3
- 462 Change ThreadSafety of CallFunction from to Unsafe
- 294 Change ReturnType of CallFunction from void to Tuple
- 145 Add CallFunction
FireActionButtonFoundSignal
Parameters (2) | ||
---|---|---|
actionName | string | |
actionButton | Instance | |
Returns (1) | ||
null |
Security | RobloxScriptSecurity |
---|---|
Thread safety | Unsafe |
History 3
- 573 Change ReturnType of FireActionButtonFoundSignal from void to null
- 462 Change ThreadSafety of FireActionButtonFoundSignal from to Unsafe
- 145 Add FireActionButtonFoundSignal
GetActionButtonEvent
Parameters (1) | |
---|---|
actionName | string |
Security | RobloxScriptSecurity |
---|---|
Thread safety | Unsafe |
History 2
- 462 Change ThreadSafety of GetActionButtonEvent from to Unsafe
- 145 Add GetActionButtonEvent
GetAllBoundActionInfo
Parameters (0) | ||
---|---|---|
No parameters. | ||
Returns (1) | ||
Dictionary |
GetAllBoundActioninfo returns a table which maps all actions' names (those originally passed to BindAction) to a table returned by GetBoundActionInfo when called with the action name itself. Using this function, you can inspect all presently bound actions. This is useful when debugging their priority levels or stack orders.
Thread safety | Unsafe |
---|
History 2
- 462 Change ThreadSafety of GetAllBoundActionInfo from to Unsafe
- 145 Add GetAllBoundActionInfo
GetAllBoundCoreActionInfo
Parameters (0) | ||
---|---|---|
No parameters. | ||
Returns (1) | ||
Dictionary |
Security | RobloxScriptSecurity |
---|---|
Thread safety | Unsafe |
History 2
- 462 Change ThreadSafety of GetAllBoundCoreActionInfo from to Unsafe
- 296 Add GetAllBoundCoreActionInfo
GetBoundActionInfo
Parameters (1) | ||
---|---|---|
actionName | string | |
Returns (1) | ||
Dictionary |
GetBoundActionInfo returns a table with the following keys describing a bound action given its name. To get the same information for all actions at once, use GetAllBoundActionInfo.
Name | Type | Description |
---|---|---|
stackOrder | number | Describes the index of the action on the stack (increasing) |
priorityLevel * | number | Describes the priority level of the action |
createTouchButton | bool | Describes whether a touch button should be created on TouchEnabled devices |
inputTypes | table | The input types passed to BindAction for which this action will trigger |
description † | string | The description of action set by SetDescription |
title † | string | The title of the action set by SetTitle |
image † | string | The image of the action's touch button set by SetImage |
* Priority level will still be included even if BindActionAtPriority wasn't used - by default it will be 2000.
† Indicates that this field will be nil
if the associated method was not
called for the given action.
Thread safety | Unsafe |
---|
History 2
- 462 Change ThreadSafety of GetBoundActionInfo from to Unsafe
- 145 Add GetBoundActionInfo
GetBoundCoreActionInfo
Parameters (1) | ||
---|---|---|
actionName | string | |
Returns (1) | ||
Dictionary |
Security | RobloxScriptSecurity |
---|---|
Thread safety | Unsafe |
History 2
- 462 Change ThreadSafety of GetBoundCoreActionInfo from to Unsafe
- 296 Add GetBoundCoreActionInfo
GetButton
Parameters (1) | ||
---|---|---|
actionName | string | |
Returns (1) | ||
Instance |
GetButton returns the ImageButton created by BindAction if its third parameter was true and the device is TouchEnabled. The only parameter to this function must match exactly the name of the action originally sent to BindAction.
If no such action was bound or if a button was not created, this function
returns nil
.
Thread safety | Unsafe |
---|
GetCurrentLocalToolIcon
Parameters (0) | ||
---|---|---|
No parameters. | ||
Returns (1) | ||
string |
GetCurrentLocalToolIcon will return the BackpackItem.TextureId of
a Tool currently equipped by the
Player, or nil
if there is no such Tool or if the player lacks a
Character.
Thread safety | Unsafe |
---|
History 2
- 462 Change ThreadSafety of GetCurrentLocalToolIcon from to Unsafe
- 90 Add GetCurrentLocalToolIcon
LocalToolEquipped
Parameters (1) | |
---|---|
toolEquipped | Instance |
Fires when the current player equips a Tool.
Thread safety | Unsafe |
---|
History 2
- 462 Change ThreadSafety of LocalToolEquipped from to Unsafe
- 90 Add LocalToolEquipped
LocalToolUnequipped
Parameters (1) | |
---|---|
toolUnequipped | Instance |
Fires when the current player unequips a Tool.
Thread safety | Unsafe |
---|
History 2
- 462 Change ThreadSafety of LocalToolUnequipped from to Unsafe
- 90 Add LocalToolUnequipped
SetDescription
Parameters (2) | ||
---|---|---|
actionName | string | |
description | string | |
Returns (1) | ||
null |
SetDescription will set the description of an action bound by BindAction. In a list of available actions, this would be text that describes the given action.
Although the name may suggest that this method is related to the family of functions that customize a touch button for actions that create them (SetTitle, SetImage and SetPosition), this method does not affect such a button. This method merely sets a text description of an action, and nothing more.
Thread safety | Unsafe |
---|
History 3
- 573 Change ReturnType of SetDescription from void to null
- 462 Change ThreadSafety of SetDescription from to Unsafe
- 145 Add SetDescription
SetImage
Parameters (2) | ||
---|---|---|
actionName | string | |
image | string | |
Returns (1) | ||
null |
This method sets the image shown on a touch button created by BindAction(). Specifically, it sets the ImageLabel.Image property of the ImageLabel within the ImageButton that would be returned by GetButton. If no such bound action exists (e.g. nothing is returned by GetButton), this function does nothing and throws no error.
This function is part of a family of methods that customize the touch button of an action. Others in this family include SetPosition and SetTitle.
Thread safety | Unsafe |
---|
SetPosition
Parameters (2) | ||
---|---|---|
actionName | string | |
position | UDim2 | |
Returns (1) | ||
null |
This method sets the position of a touch button created by BindAction(). Specifically, it sets the GuiObject.Position property of the ImageButton that would be returned by GetButton. If no such bound action exists (e.g. nothing is returned by GetButton), this function does nothing and throws no error.
This function is part of a family of methods that customize the touch button of an action. Others in this family include SetImage and SetTitle.
Thread safety | Unsafe |
---|
History 3
- 573 Change ReturnType of SetPosition from void to null
- 462 Change ThreadSafety of SetPosition from to Unsafe
- 145 Add SetPosition
SetTitle
Parameters (2) | ||
---|---|---|
actionName | string | |
title | string | |
Returns (1) | ||
null |
SetTitle will set the text shown on a touch button created by BindAction. Specifically, this sets the TextLabel.Text property of a TextLabel within the ImageButton that would be returned by GetButton. If no such bound action exists (e.g. nothing is returned by GetButton), this function does nothing and throws no error.
This function is part of a family of methods that customize the touch button of an action. Others in this family include SetImage and SetPosition.
Thread safety | Unsafe |
---|
UnbindAction
Parameters (1) | ||
---|---|---|
actionName | string | |
Returns (1) | ||
null |
UnbindAction will unbind an action by name from user inputs so that the action handler function will no longer be called. Call this function when the context for some action is no longer applicable, such as closing a user interface, exiting a car or unequipping a Tool. See BindAction for more information on how bound actions operate.
This function will not throw an error if there is no such action bound with the given string. Using GetAllBoundActionInfo or the Developer Console's "Action Bindings" tab, you can find out what actions are presently bound.
Thread safety | Unsafe |
---|
History 3
- 573 Change ReturnType of UnbindAction from void to null
- 462 Change ThreadSafety of UnbindAction from to Unsafe
- 145 Add UnbindAction
UnbindActivate
Parameters (2) | Default | |
---|---|---|
userInputTypeForActivation | UserInputType | |
keyCodeForActivation | KeyCode | Unknown |
Returns (1) | ||
null |
UnbindActivate unbinds an KeyCode used with an UserInputType for activating a Tool (or a HopperBin) using BindActivate. This function essentially undoes the action performed by that function.
Thread safety | Unsafe |
---|
History 3
- 573 Change ReturnType of UnbindActivate from void to null
- 462 Change ThreadSafety of UnbindActivate from to Unsafe
- 199 Add UnbindActivate
UnbindAllActions
Parameters (0) | ||
---|---|---|
No parameters. | ||
Returns (1) | ||
null |
Removes all functions bound. No actionNames will remain. All touch buttons will be removed. If a button was manipulated manually there is no guarantee it will be cleaned up.
Thread safety | Unsafe |
---|
History 3
- 573 Change ReturnType of UnbindAllActions from void to null
- 462 Change ThreadSafety of UnbindAllActions from to Unsafe
- 145 Add UnbindAllActions
UnbindCoreAction
Parameters (1) | ||
---|---|---|
actionName | string | |
Returns (1) | ||
null |
Security | RobloxScriptSecurity |
---|---|
Thread safety | Unsafe |
History 3
- 573 Change ReturnType of UnbindCoreAction from void to null
- 462 Change ThreadSafety of UnbindCoreAction from to Unsafe
- 194 Add UnbindCoreAction
UnbindCoreActivate
Parameters (2) | Default | |
---|---|---|
userInputTypeForActivation | UserInputType | |
keyCodeForActivation | KeyCode | Unknown |
Returns (1) | ||
null |
Security | RobloxScriptSecurity |
---|---|
Thread safety | Unsafe |
History 2
- 573 Change ReturnType of UnbindCoreActivate from void to null
- 567 Add UnbindCoreActivate
Removed members 3
ActivateLocalTool
Parameters (0) | ||
---|---|---|
No parameters. | ||
Returns (1) | ||
void |
Security | RobloxScriptSecurity |
---|
History 2
- 145 Remove ActivateLocalTool
- 90 Add ActivateLocalTool
ContextButtonEnabled
Type | Default | |
---|---|---|
bool |
Category | |
---|---|
Loaded/Saved | false |
History 2
- 145 Remove ContextButtonEnabled
- 90 Add ContextButtonEnabled
DeactivateLocalTool
Parameters (0) | ||
---|---|---|
No parameters. | ||
Returns (1) | ||
void |
Security | RobloxScriptSecurity |
---|
History 2
- 145 Remove DeactivateLocalTool
- 90 Add DeactivateLocalTool