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

GamepadSupports

The GamepadSupports function returns whether a specified gamepad supports a corresponding Enum//KeyCode button. This can be used to determine the valid inputs for a specified gamepad.

To determine which Enum/UserInputType Gamepads are connected, you can use the UserInputService/GetConnectedGamepads function.

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

Parameters

Name Type Default Description

Gamepad being checked

KeyCode being checked

Returns

Return Type Summary

Indicates whether gamepad supports the keycode argument


Code Samples


UserInputService:GamepadSupports

This example prints whether Enum.UserInputType.Keyboard supports the Enum.KeyCode.Backspace keycode.

local UserInputService = game:GetService("UserInputService")

local supported = UserInputService:GamepadSupports(Enum.UserInputType.Keyboard, Enum.KeyCode.Backspace)

print(supported)