Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do i detect a gamepad in my game?

I've tried using game:GetSetting('UserInputService').GamepadEnabled but it doesn't work with my generic gamepad, neither with my PS3 controller. I've tried to use Better DS3 to trick my PC into thinking the PS3 controller is a Xbox 360 one, but it still doesn't work...

2 comments

0

game:GetService? game doesn't have a function GetSetting() that I see.

0

woops....

2 answers

Its GetService, not GetSetting

game:GetService('UserInputService').GamepadEnabled

1 comment

0

i can't remember if i do have written GetService or GetSetting, but i'll check it later

Detects when a controller is connected. I use this for my game and it's like a charm.

local UIS = game:GetService("UserInputService")
 
UIS.GamepadConnected:connect(function(gamepad)
	print("Player has plugged in controller: " .. tostring(gamepad))
end)
 
UIS.GamepadDisconnected:connect(function(gamepad)
	print("Player has unplugged in controller: " .. tostring(gamepad))
end)

that will detect when a gamepad is connected and disconnected

This discussion is preserved as it was. New answers, comments, and votes are closed.