Textbutton script Function?

Hey guys, I was wondering if there is a function for GUI Textbuttons that fire the script inside the button? This would be similar to how pressing “X” when using the “Select” navigation fires the script. Thanks!


Are you asking if there’s a way to detect when the user presses A while a button is selected? That’s bound to the MouseButton1Down/Up/Click events.

Put this script in the text button, and replace the comment with code that you want to happen when it parent is pressed.

function parentPressed()
--do something
1 Like

So say I was creating my own GUI selection system. I select a GUI that would normally make another GUI visible if I clicked it. Now I want the same to happen when I press “X”. How would I make the X fire the MouseButton1Down event?

Use UserInputService.InputBegan and listen for the ButtonX (or whatever it’s called) input. Then look to see what you have selected and invoke a custom call on it.

You can’t fire built-in events though FYI.