Gamepad: Right trigger activates gui buttons, how do I disable this?

If I’m using a gamepad, R2 will fire MouseButton1Down and MouseButton1Up and MouseButton1Click for any GuiButtons that happen to be under the reticle (my guis are moving around). This happens even if the Active property is set to false. It happens for both surface guis and screen guis.

I understand how this is fine default mapping, especially with surface guis, but obviously anyone who’s going to intentionally develop for a controller will usually use A for any gui selection, or anything but triggers.

How do I unmap this? I can’t find anything in the playerscripts that handles this. I tried using contextActionService:BindAction("R2Override", function() end, false, Enum.KeyCode.ButtonR2) to override it, but this didn’t work.

Here’s a small repro place that shows what I mean if you have a controller:
TriggerRepro.rbxl (13.4 KB)

3 Likes

@Quenty has come to the rescue, I should be using GuiButton.InputBegan instead of the mouse events.

Edit: even with using InputBegan and InputEnded instead of MouseButton1Down and MouseButton1Up, I’m still not able to filter input coming from a gamepad trigger:

guiButton.InputBegan:connect(function(inputObject)
	print(inputObject.UserInputType, inputObject.KeyCode)
end

returns Enum.UserInputType.MouseButton1, Enum.KeyCode.Unknown when the button is activated by R2. It should definitely not be passing a mouse button in this case; instead it probably should yield something more like Enum.UserInputType.Gamepad1 Enum.KeyCode.ButtonR2.

I think the current behavior is wrong, so I’m moving this topic to client bugs.

1 Like

Also, InputBegan doesn’t fire at all when a button is activated through gui navigation. That is, when GuiService.SelectedObject = guibutton and you press A on the controller.

@darthskrill

3 Likes

Yes, this seems like a bug, we will look into it. thanks!

1 Like

I’m running into this issue as well. The worst part is that GuiObject.InputBegan/Ended fire for OTHER objects other than the one which it should actually be firing for. Apparently this is because those events on GuiObject fire regardless of whether other GUI elements handled them? Why is that the case?

1 Like

There is CAS::BindActivate which binds RT to this. I have simply removed the BindActivate calls (and unbind) from the Gamepad control script which makes RT no longer trigger GUI events anymore.

3 Likes

This bug has seems to still be existent/came back. I’m unable to differentiate between gamepad and mouse inputs for MouseButton1 and ButtonR2 on a GuiObject as a result.

R2 is firing GUI buttons, which shouldn’t be intended at all, and is leading to some weird behavior in my game as well as others.

Also happy 2 year anniversary to this bug!

7 Likes

(Insane hall of fame of posters here…)

But jumping in to say I’m experiencing the same thing. When the gamepad is in selection mode, aka has the blue/white selection rectangle around buttons, ButtonA should cause it to click that button. Cool, that works great.

However, Right Trigger (as this post indicates) is for some reason clicking buttons as well… but not even the one selected… it’s clicking the button above, or even higher in Studio…

Here’s a gif

4 Likes

Can confirm this, i have actually experienced this a few times out of studio as well as in studio
And actually, now that @badcc mentioned it i also have experienced it in jailbreak on not many but a few amount of times. Not sure if it has anything to do but it more often than not happened in very tense situations with a lot of inputs at once. Hope its fixed soon