PcoWSkbVqDnWTu_dm2ix
Collapse Sidebar

BindActionAtPriority

BindActionAtPriority behaves like ContextActionService/BindAction|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.

Parameters

Name Type Default Description

A string representing the action being performed (e.g. “HonkHorn” or “OpenDoor”)

The action-handling function, called with the following parameters when the bound inputs are triggered: string (actionName), Enum.UserInputState and an InputObject

Whether a GUI button should be created for the action on touch input devices

int

The priority level at which the action should be bound (higher considered before lower)

Any number of Enum.KeyCode or Enum.UserInputType representing the inputs to bind to the action

Returns

Return Type Summary

Code Samples


ContextActionService BindAction Priorities

This code sample demonstrates how ContextActionService/BindActionAtPriority can be used to bind actions out of order yet still have the same priority levels. Normally, ContextActionService/BindAction|BindAction would operate on order (last bound action has highest priority), but priority levels override this. You can test this code by pasting it into a LocalScript in StarterPlayerScripts.