Collapse Sidebar


This function returns an array of InputObject|InputObjects for all available inputs on the given Enum/UserInputType gamepad, representing each input’s last input state.

To find the Enum/UserInputType|UserInputTypes of connected gamepads, use UserInputService/GetConnectedGamepads.

As this function only fires locally, it 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/GetGamepadConnected
  • UserInputService/GamepadSupports
  • UserInputService/GamepadEnabled


Name Type Default Description

The Enum/UserInputType corresponding with the gamepad in question


Return Type Summary

An array of InputObject|InputObjects representing the current state of all available inputs for the given gamepad

Code Samples

Mapping and Polling GamepadStates

This example demonstrates how to map a Enum/UserInputType|gamepad’s states to their corresponding Enum|KeyCode|KeyCodes, and then you can always reference them. Since the states are mutable; you don’t have to keep calling GetGamepadState once they are mapped. Then, you can reference the states of the gamepad’s controls using KeyCodes and indices - such as to poll the Thumbstick1 position.

local UserInputService = game:GetService(“UserInputService”)

local _states = UserInputService:GetGamepadState(Enum.UserInputType.Gamepad1)
local states = {}
for _,state in pairs(_states) do
	states[state.KeyCode] = state

-- Poll the Thumbstick position:
local thumbstick1 = states[Enum.KeyCode.Thumbstick1]
while true do