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

GetGamepadConnected

The GetGamepadConnected function checks if a Enum/UserInputType gamepad is connected to the client. It returns true if gamepadNum is connected to the client.

This can be used to check if a specific gamepad, such as Enum.UserInputType.Gamepad1 is connected or not connected to the client’s device.

If you want to retrieve a list of all connected gamepads instead, 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

The gamepadNum being checked if connected.

Returns

Return Type Summary

Indicates whether the gamepadNum gamepad argument is connected to the client. Returns true if connected and false if not.


Code Samples


UserInputService:GetGamepadConnected

This example returns whether the Enum.UserInputType.Gamepad1 gamepad is connected to the client. It will print true if Gamepad1 is connected and false if Gamepad1 is not connected.