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
ContextActionService/BindAction|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
ContextActionService/GetAllBoundActionInfo|GetAllBoundActionInfo or the Developer Console’s “Action Bindings” tab, you can find out what actions are presently bound.
ContextActionService Tool Reload
This example properly shows how to use ContextActionService in binding user input to a contextual action. The context is the tool being equipped; the action is reloading some weapon. Test this code sample by placing it in a LocalScript parented to a Tool. When the Tool is equipped, a “Reload” action is bound, and when the Tool is unequipped the “Reload” action is unbound. When the player presses R with the Tool equipped, the message “Reloading!” will appear.