PcoWSkbVqDnWTu_dm2ix
We use cookies on this site to enhance your user experience
Collapse Sidebar

SelectionLost

This event fires when the Gamepad selector stops focusing on the GuiObject|GUI.

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

When a GUI loses selection focus, the value of the GuiService/SelectionObject|SelectionObject property changes either to nil or to the GUI element that gains selection focus. To determine which GUI gained selection, or if no GUI is selected, check the value of this property.


Code Samples


Handling GUI Selection Lost

The following example prints a message when the element has its focus lost on a gamepad.

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

local gui = script.Parent

local function selectionLost()
	print("The user no longer has this selected with their gamepad.")
end

GuiObject.SelectionLost:Connect(selectionLost)