Add support for MouseButton4, MouseButton5, etc

As a Roblox developer, it is currently not possible to detect mouse button 4 and 5 which are both supported in a decent amount of software (browsers, text editors, etc) for forwards/backwards navigation in history.

If Roblox is able to address this issue, it would improve my development experience because it would allow me to implement button 4/5 behaviours. These two buttons are relatively common on a lot of mice, so a decent number of people have them even if they don’t use them or know that some software they use actually supports them really well.

Web browsers use these buttons for forwards/backwards navigation, and VSCode uses these buttons for traversing backwards and forwards through cursor history, both of which I regularly use. Some games support these buttons for forwards, or at least backwards navigation in UIs, which is also what I would like to utilize these buttons for.

This behaviour has also been requested before:

But these requests were made years ago and are now pretty stale as a result, replies from more recently in time haven’t brought any attention to them, and there doesn’t seem to be a recent reply from a staff member suggesting that this was ever dropped, so I apologize for posting a duplicate, I wasn’t sure whether or not replying would actually make a difference noting that others have replied in the recent future too.

Furthermore, a handful of topics can be found asking how to achieve this behaviour:

It’s also worth mentioning that these buttons are sometimes also referred to as mouse buttons X1/X2 respectively (presumably meaning extra 1 and extra 2) but I think they are more commonly referred to as button 4 and 5 by most people but that’s mostly just based on personal experience. Here’s an example of them being referred to as X1 and X2 in SDL3 (which is consistent with older versions of SDL too): SDL3/SDL_MouseButtonFlags - SDL Wiki

29 Likes

Wouldn’t it be better to support variable number of mouse buttons instead of a fixed amount? Instead of adding more buttons:

  • MouseButton1
  • MouseButton2
  • MouseButton3
  • MouseButton4
  • MouseButton5
  • MouseButton6
  • MouseButton7 and many more…

How about a new property?

local UserInputService = game:GetService("UserInputService")

UserInputService.InputBegan:Connect(function(input, gameProcessed)
    for i, button in input.MouseButtons do
        print(`Button {i} is {if button.Active then "held" else "released"}`)
    end
end)
2 Likes

True, but the way Roblox designs stuff when it comes to anything variable is just adding a bunch of numbered enums. Only David Baszucki knows why… :sob:

3 Likes

There might be a reason for them not to add it, majority of people who play Roblox probably don’t have a MB4 or even MB5, even I have only MB1 - MB3 because I’ve intetionally removed them. I personally wouldn’t like a game from limiting functions just because I only have a limited amount of Mouse Buttons.

Couldn’t one use ContextActionService to map it to multiple buttons, keys, etc.?

Either way, this feature would probably need a first-party key/button remapping system to be useful - because there’s no way all mice have a uniform definition for what a button4 vs button5 is. Could make for some situationally-uncomfortable control layouts otherwise.

1 Like

This isn’t a fair reason. Mobile can use Swipe features, but PC can’t. Should Swipe features be removed because PC users can’t use them?

As long as the function they execute is either determined by the Player (like a “Keybind Remap” setting in the game) or has an alternative mapping or interaction that could cause the same effect.

For example: Making MouseButton4 be an “Undo”, also have CTRL+Z and/or a button on screen to undo as well. It’s not “limiting” or “blocking” the use of anything, just making it a bit easier for those who can. Of course, that requires the developer to do what I’m saying, however it wouldn’t be Roblox’s fault if a game developer forgot to add alternates. That’s like blaming Roblox for a game not having proper controller support.

3 Likes

That’s the fault of the developer if they’re binding controls poorly. There’s no reason to hold back the engine because of developer incompetence.

4 Likes

This isn’t about Mobile, it’s about how having more than 3 mouse buttons isn’t the normality, Roblox is trying to keep you from ruining those people’s experience by forcing them to have a modern mouse to play.

You’re correct, it’s up to the developer to ruin their game’s player experience, but having MB1 - MB9 would be way to ugly, they should instead remodel their Enum for the Mouse Buttons or certain buttons that may be variable in quantity.

i guess you just forgot how to read more than ten words? next time, please at least attack a point i made constructively instead of attacking air.

5 Likes

No because there aren’t mouse buttons past 4 and 5, other mouse buttons either just bind to numpad keys or are programmable and don’t have their own unique identifiers that the OS will recognize. I have never seen a 6th mouse button referenced in any software or libraries before and to my knowledge one doesn’t actually exist.

3 Likes

This is not true, a lot of mice support button 4 & 5 including my cheap laser mouse. They’re not exclusive or obscure buttons. Most ‘gaming’ mice support the two buttons, a lot of office mice support these buttons, and this has been true for at least the last decade but probably longer. It’s not an uncommon pair of buttons at all, in fact the last three pairs of mice I’ve owned all had them and it wasn’t something I was even actively looking out for.

But, they do. All mice with the 4th and 5th button have a unified definition of what those buttons are and they’re recognized by all browsers and quite a lot of software. Windows itself supports these buttons in the file explorer and in other places, my OS’s file browser supports them, Steam supports them. They are decades old and well recognized.

Having a button 4 and 5 is not modern. These buttons are not new, or obscure, and are supported on a large number of mice including as I’ve mentioned, office mice too. They are recognized by windows itself in the file explorer, they are recognized by all major browsers, VSCode, Steam, etc. You can find mice with a button 4/5 all over the place for the exact same price as mice without them. Nobody is making games that require you to press the middle mouse button, button 3, because it would be frankly terrible input design. It isn’t something people do because it just doesn’t make sense to do.

The argument that ‘but people might use it wrong’ can literally be applied to anything and is therefore, in my opinion, not a relevant argument to the question of whether or not Roblox should support mouse buttons that have been around for decades and are implemented in plenty of major software. The idea that someone will make a game that requires you to have a button 4 and button 5 so Roblox shouldn’t support button 4/5 at all sounds completely silly to me.

There is not a button 6+.

2 Likes

So, that logic can also be applied to the numpad keys because there are keyboards that do not have those yet can be binded


I think there is a use-case for this if done right

3 Likes

Full sized keyboards are more common than mice with more than 3 buttons. You’re forgetting most Roblox children are probably playing on office computers.

A lot does not mean all of them, a lot of people use Mac and Linux, but that doesn’t mean they’re a large majority compared to Windows. Majority of Mice have a total of 3 buttons due to them being over manufactured for office settings and being cheaper.

If you refuse to acknowledge a valid point because you didn’t like the amount of text used to communicate it then you are not arguing in good faith.

This is almost certainly false depending on the demographic you pick, the majority of Roblox players are mobile players, and beyond that the demographic you are talking about on PC tend to play on laptops which don’t have full sized keyboards. You can speculate all day on these things which is why I think it’s not relevant to be making arguments like these for or against my feature request.

The majority of players on the platform do not use a keyboard or a mouse, but that doesn’t mean there is no value in supporting a keyboard/mouse. Your idea that it has to be some majority thing is completely arbitrary and doesn’t make sense, most engine features are not for the majority.

I’ll reiterate that the argument you seem to have been making is fundamentally just very flawed. So far you are against this because you have theorized that people might implement awful input design in a game, and you don’t want that. But that argument can be applied to anything.

My request for Roblox to add support for decades old mouse inputs with widespread support in major software is not invalid because you came up with a hypothetical scenario where for some unspecified reason you can’t play a game because it wants you to have side buttons on your mouse for some reason.

The hypothetical existence of bad design in regards to something is not a reason to have literally no relevant design features for that thing at all whatsoever.

By your logic, Roblox should never have added MeshParts because people can import a cube made of half a million triangles.

5 Likes

Laptop argument, I use a gaming laptop, I have a full sized keyboard plugged into it, because as a developer you need it.

But any mouse buttons over MB3 are useless, when I did have MB4 I just programmed it to be my autoclicker with the included drivers, and anybody else with MB4 has probably done the same.

If a player wants to remap their mouse to have MB4 in your game they can easily do that by mapping a key which your game should have and shouldn’t be based entirely on Mouse keys.

Even if you don’t have a full sized keyboard, you still have Num Lock which acts like a Numberpad if required, your argument is invalid.

No, they should NOT add support for Mouse Buttons above 3.

I see you flagging posts disagreeing with you.

And for more complex games, you may need a mouse with 5 buttons, just like how you state that you need a full-sized keyboard as a developer. Obviously, a developer should try to be as inclusive as possible, but they should also be given the option of using more advanced form of input.

They aren’t necessarily ‘useless’, sometimes there aren’t enough keybinds on a mouse to provide easy access to certain common functions and keyboard input may be deemed too slow given you have to find and press down the key. For power users, supporting this as an additional feature would be helpful.

This makes the assumption that the player both knows how to re-map these bindings in their computer settings and is willing to take the effort to do so; which unfortunately isn’t always the case. The convenience would be nice to have over this current workaround.

However, F13 to F15 are also supported, in which the documentation even specifies that they aren’t supported on all keyboards. There are also many other keybinds that Roblox specifies are not supported on all keyboards as listed in the KeyCode documentation. Support on all devices for KeyCodes seemingly hasn’t been an issue in the past, and I doubt it would be now. Also, I wouldn’t say their argument was ‘invalid’ either; they’ve brought up many other valid points as reasons for why this should get supported.

I am genuinely curious, however, is there a reason why this would be a negative feature? I can personally only see a net-gain from adding this functionality? More feature support is nearly always a good thing?

2 Likes

I use these ‘useless’ buttons in non-Roblox games, mostly so that I don’t need to let go of WASD. Examples:

  • Deep Rock Galactic: Traversal tool / Previous weapon
  • Noita: Interact / Kick
  • Space Engineers: Interact / Reload

Extra mouse buttons would indeed be appreciated.