Recently Sonic Speed Simulator released a gamepad support update to improve overall experience for players on console and for those who prefer to use gamepads even on other platforms.
However, a very strange bug was reported by mobile players using gamepads.
The Bug:
We use UserInputService:GetSupportedGamepadKeyCodes() to confirm whether the player can actually use the keycodes (and we dynamically show or hide keycode hints) but on mobile, the method errors:
Open the reproduction file OR make your own place and use UserInputService:GetSupportedGamepadKeyCodes() when a gamepad is connected
Publish the place
Connect a gamepad to a mobile device
Open the place on the Roblox app on your mobile device
Try to move using the gamepad
Open Dev console and see the error
NOTE 1: Interchanging steps 3 and 4 does not seem to affect the outcome.
NOTE 2: The bug seems to occur very frequently but not at all times.
NOTE 3: UserInputService.GamepadEnabled is true
Thanks for the report! We looked into this and couldn’t reproduce the error on different mobile platforms / gamepads over several tries with the provided file. Are you still able to reproduce the issue?
Yes, I am able to reliably reproduce the bug.
The code I used in the reproduction place:
local UIS: UserInputService = game:GetService("UserInputService")
local function printSupportedGamepadKeyCodes(gamepadNum: Enum.UserInputType)
print("Is Gamepad enabled?", UIS.GamepadEnabled)
local supportedKeyCodes: {Enum.KeyCode} = UIS:GetSupportedGamepadKeyCodes(gamepadNum)
print("Supported keycodes for the gamepad are:", unpack(supportedKeyCodes))
end
UIS.GamepadConnected:Connect(printSupportedGamepadKeyCodes)
printSupportedGamepadKeyCodes(Enum.UserInputType.Gamepad1) -- in case your gamepad was connected already ^_^
The result on my mobile device (Samsung S24 Ultra, with an XBox One Controller connected via Bluetooth):
You can directly test this in a published place of mine if you so wish: Bug testing 1 - Roblox
I have set Place Copying to enabled for this place in case you want to grab a copy for any reason, however the .rbxl file in the OP is the same.