Add event for when SelectedObject property changes in GuiService

To make adding gamepad support a little easier, I would like an event in GuiService that detects when the SelectedObject property is changed.
This would be helpful for if I want to play a sound effect or do something visually when the left thumbstick selects another object.
I don’t want to have to bind my own function over Thumbstick1 or run a loop to detect its change.

Signal SelectedObjectChanged (GuiObject NewSelection)
Fired when the SelectedObject property is changed.

I just noticed
GuiObject.SelectionGained() and GuiObject.SelectionLost() which would help my case, but it might still be more convenient for playing a sound effect whenever the selection is changed rather than gathering every button and connecting them all to SelectionGained.

Use .Changed. It fires for SelectedObject.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.