UserInputService.TextButtonPressed

As a Roblox developer, it is currently impossible to detect clicks on TextButtons without creating an event listener for each individual button. I’m currently creating a dialogue system for a large open world and having a listener for the billboard overhead every NPC on the map isn’t performative and doesn’t make sense.

There is already an event similar to this for TextBox focus: UserInputService | Documentation - Roblox Creator Hub

Having this for TextButtons would be super useful.

10 Likes

Would such an event also work for ImageButtons? If so it would make more sense to name it ButtonPressed or something similar instead of TextButtonPressed. If not would we get something similar like ImageButtonPressed?

3 Likes

Would be cool to have both/ just one for both, if there was one event it can easily be split between the two with an :IsA anyway

How come it isn’t? Each connection should only take some bytes of memory if you are reusing the same function reference / creating similar Lua closures.

There’s not really a constant processing overhead you pay for having thousands of connections, it’s mostly just small amounts of memory AFAIK.

It would just be a lot nicer to have one event I can listen to for all the TextButtons in the game - I recognise that it’s not a massive difference in performance, but if you had a very large game this sort of thing can build up quickly. It’s also a lot cleaner solution instead of having thousands of connections.

This is like the difference between having an event for individual gamepass purchases and having one event for all gamepass purchases which you then differentiate if needed.