PcoWSkbVqDnWTu_dm2ix
Collapse Sidebar

GamepadSupports

This function returns whether the given Enum/UserInputType gamepad supports a button corresponding with the given Enum//KeyCode. This function is used to determine valid gamepad inputs.

To determine which Enum/UserInputType gamepads are connected, use UserInputService/GetConnectedGamepads.

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

See 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/GetSupportedGamepadKeyCodes
  • UserInputService/GetGamepadState
  • UserInputService/GetGamepadConnected
  • UserInputService/GamepadEnabled

Parameters

Name Type Default Description

The Enum/UserInputType of the gamepad

The Enum/KeyCode of the button in question

Returns

Return Type Summary

Whether the given gamepad supports a button corresponding with the given Enum/KeyCode|KeyCode


Code Samples


Binding Functions to Gamepad Controls

This example binds the Enum/KeyCode|ButtonX key to action if it is supported by controller (Enum/UserInputType|Gamepad1). If bound, pressing the X Button invokes the action() function, which prints “Action”.