Getting Button Input

I am using an ImageButton in a game on both Xbox and PC, and while MouseButton1Down seems to work on PC, nothing seems to happen on Xbox. I don’t know if I’m doing something wrong, and developer.roblox.com isn’t being very helpful.

You use a different input on PC and Xbox

MouseButton1Down will only fire if the user has a mouse and presses Button1, which in the case of a mobile user or an xbox user, won’t happen because they don’t have a mouse. I would suggest binding an action using the ContextActionService which might be able to detect controller input, however, I have not tested this. An implementation idea could be to bind the action when the gui is visible then unbind it when the gui is no longer visible.

You could use the .Activated event instead of .MouseButton1Down.

1 Like

There is always the InputBegan event which allows you to receive any input on the GuiObject (specifically ImageLabel).