ContextActionService basics
Each input type bound to a function using BindAction works like a stack: whichever function was the most recent to be bound will be called when that input type is activated by the player. ContextActionService binding
As soon as a player can use an input (like A/B, triggers, or thumbstick), use :BindAction(...) . This will override the given input types current actions with the new one. When the player can no longer use the input for the action, use :UnbindAction(name) .ContextActionService example
When the given input type is activated/changed, the function passed to :BindAction(...) is called with the action name, the input state (Begin, Change, End or Cancel) and the InputObject. It's good practice to have just one action-handling function per script. Wiki References
| Gamepad KeyCodes and UserInputTypesUserInputService querying
Avoid using UserInputService.InputBegan for actions involving button presses! Use ContextActionService:BindAction(...) because this "overrides" existing actions using the given input types, and properly returns control to existing actions when yours are unbound.Tips and Good Practices
A good way to know what kinds of control schemes work is by playing other gamepad/controller enabled games. |
Cheatography
https://cheatography.com
Roblox: Gamepad Input Cheat Sheet by Ozzypig
A quick reference for implementing gamepad (controller) input on Roblox. This cheatsheet is written for intermediate scripters.
Created By
ozzypig.com
Metadata
Comments
No comments yet. Add yours below!
Add a Comment
Related Cheat Sheets
More Cheat Sheets by Ozzypig