PcoWSkbVqDnWTu_dm2ix
The Developer Hub is now deprecated and information on this page may no longer be accurate. To see our new and improved documentation, please click here. You can read more about the future of documentation here.
Collapse Sidebar

SelectionGained

This event fires when the Gamepad selector starts focusing on the GuiObject.

If you want to check from the Gamepad select stops focusing on the GUI element, you can use the GuiObject/SelectionLost event.

When a GUI gains selection focus, the value of the GuiService/SelectionObject|SelectionObject property also changes to the that gains selection. To determine which GUI gained selection, check the value of this property.


Code Samples


Handling GUI Selection Gained

The following example prints a message when the user selects the object with a gamepad.

In order for this to work as expected, it must be placed in a LocalScript and a child of gui.