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)
@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.
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.
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?
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.
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.
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…
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
Ive found a workaround for it, I’m overwriting the L2/R2 buttons while in select mode, might not be the best thing to do, but it’s not fixed yet so.
GuiService:GetPropertyChangedSignal("SelectedObject"):Connect(function()
local IN_SELECTION: GuiButton? = GuiService.SelectedObject
local EmptyCall: () -> () = function() end
if IN_SELECTION then
ContextActionService:BindAction("OverwriteKeys", EmptyCall, false, Enum.KeyCode.ButtonL2, Enum.KeyCode.ButtonR2)
else
ContextActionService:UnbindAction("OverwriteKeys")
end
end)