What is the equivalent of MouseButton1/Touch for Console/Xbox?

I’m working on making a helicopter cross-platform. So far it works for mobile and PC, but I can’t seem to get it to work for console, and I think I pinned the problem on mouse movement.

For PC and mobile, I use Enum.UserInputType.MouseButton1 and Enum.UserInputType.Touch for controlling the direction of the helicopter. Since it appears that they both don’t work for console (I have no idea what the output is, I was testing on my console as I don’t have the wire to attach my controller to my PC), I was wondering what I should do to fix this error.

You’d probably have to use Enum.UserInputType.Gamepad1. Not positive how this works, but https://developer.roblox.com/en-us/api-reference/enum/UserInputType should point you to the right direction.

Console controllers go from Enum.UserInputType.Gamepad1 to Enum.UserInputType.Gamepad8. However, if you want to be more precise, I would advise using Enum.KeyCode with whichever button you need to use.

For controller keycodes, there are:
ButtonX
ButtonY
ButtonA
ButtonB
ButtonR1
ButtonL1
ButtonR2
ButtonL2
ButtonR3
ButtonL3
ButtonStart
ButtonSelect
DPadLeft
DPadRight
DPadUp
DPadDown
Thumbstick1
Thumbstick2

I imagine the right bumpers would be MouseButton1. However, I wouldn’t know, as I don’t own a controller, let alone a console.

To see all keycodes, go to this devhub page.

You should use the Activated event for this case. It handles MouseButton1, Touch and the ButtonA being pressed when the object is selected with controller.
https://developer.roblox.com/en-us/api-reference/event/GuiButton/Activated

3 Likes