PcoWSkbVqDnWTu_dm2ix
The Developer Hub is now deprecated and information on this page may no longer be accurate. To see our new and improved documentation, please click here. You can read more about the future of documentation here.
Collapse Sidebar

GetSupportedGamepadKeyCodes

This function returns an array of Enum/KeyCode|KeyCodes that the gamepad associated with the given Enum/UserInputType supports.

This function can be used to determine which KeyCodes are supported and not supported by a connected gamepad. To determine if a specific KeyCode is supported, use UserInputService/GamepadSupports.

If called on a non existent, or non connected, gamepad, this function will return an empty array.

As UserInputService is client-side only, this function can only be used in a LocalScript.

Check out this article to learn more about adding support for gamepad input into your game and this page for articles on cross-platform development.

See also

  • UserInputService/GamepadConnected
  • UserInputService/GamepadDisconnected
  • UserInputService/GetConnectedGamepads
  • UserInputService/GetNavigationGamepads
  • UserInputService/SetNavigationGamepad
  • UserInputService/IsNavigationGamepad
  • UserInputService/IsGamepadButtonDown
  • UserInputService/GetGamepadState
  • UserInputService/GetGamepadConnected
  • UserInputService/GamepadSupports
  • UserInputService/GamepadEnabled

Parameters

Name Type Default Description

The Enum/UserInputType of the gamepad

Returns

Return Type Summary

An array of Enum/KeyCode|KeyCodes supported by the given gamepad


Code Samples


Binding Supported Gamepad KeyCodes

This example gets a list of navigation gamepads and a list of their supported Enum/KeyCodes. Then, it iterates through the supported KeyCode list and binds the ButtonX and X keys to functions if they are supported by a gamepad using the ContextActionService/BindAction|ContextActionService.

Check out this article to learn more about adding support for gamepad input into your game.