InputBegan for Gamepad doesn't always fire for GUI Elements

InputBegan does not always fire when using a Gamepad on GUI elements.

Connecting InputBegan to any GUI element will only register the Gamepad button “A” being fired. However, UserInputService will always register any Gamepad button being pushed.

The code is below, simply insert it as the child of any TextButton… and make sure to use a gamepad!
Output data from both STUDIO and PLAYER are included afterwards. They have the same result!

There’s also a place file attached, if that’s easier…

--Testing Gamepad Input

--UserInputService vs GUI Element InputBegan

local userInputService = game:GetService("UserInputService")
local GuiService = game:GetService("GuiService")
GuiService.SelectedObject = script.Parent

function testButton(input)
	print("InputBegan Connection Registered: ",input.KeyCode)
end
script.Parent.InputBegan:Connect(testButton)

userInputService.InputBegan:Connect(function(input)
	print("UserInputService Registered: ",input.KeyCode)
end)

studiooutput


InputBeganPlace.zip (6.2 KB)

2 Likes