We use cookies on this site to enhance your user experience
Collapse Sidebar


The GetSupportedGamepadKeyCodes function returns the Enum/KeyCode that the connected gamepadNum supports.

This can be used to retrieve a list of supported KeyCodes for a gamepad - which can then be iterated through to determine what KeyCodes are and are not supported.

Since UserInputService only runs client-side, this function will only work when used in a LocalScript.


Name Type Default Description

The Enum/UserInputType being checked


Return Type Summary

An array of Enum/KeyCodes supported by the gamepad.

Code Samples


This example gets and prints the KeyCodes supported by Enum.UserInputType.Gamepad2. Since the function returns an array of KeyCodes, this example uses a for loop to iterate through the array an print every supported KeyCode.

Check out the Articles/Gamepad-Input article to learn more about this function and a diagram of the KeyCodes supported by a sample Gamepad2 controller.

local UserInputService = game:GetService("UserInputService")

local supportedKeyCodes = UserInputService:GetSupportedGamepadKeyCodes(Enum.UserInputType.Gamepad2)

print("This controller supports the following controls:")
for _, keycode in pairs(supportedKeyCodes) do