I’m currently trying to make an information index for my game, but I want a script to automatically find words in the Text property of a TextLabel and make them clickable (so if a player clicks the WORD it redirects them to another gui)
How would I go about doing this? I don’t know what systems or methods to use.
I plan to have multiple redirects in one description so I can’t just make one big TextButton and overlap it.
I believe you can put an invisible (background transparency 1 and no text) textbutton in front of the textlabel then when the textbutton is clicked, you redirect the player to the other gui.
I’m trying to make a script automatically do this, as my game currently makes the description of the item you’re focused on FROM SCRATCH (using a string value in replicatedstorage)
How about a small textbutton just on top of each of the redirect words?
It may be an issue placing it properly if players have different sized screens and you have the TextLabel set up for percentage of screen size, but if you just make the Textlabel a fixed pixel size it shouldn’t be too bad.
EDIT, I was typing my post while you guys were already mentioning this.
You could try using mouse enter to check if someone hovers their mouse over the textlabel, and then create a way of tracking user input from the player’s mouse afterwards.
The only idea I can think of to get the position of a string within a textlabel is using TextService:GetTextSize, where you may be able to calculate the size of the string and therefore calculate the sizes of certain parts of that string.
Probably the most efficient way to go about this is to make the text you want to be clickable a TextButton. You could make the text the same size and font, and set the background transparency like @DioGotHeaven said. Then you could put a local script that would open said info about the word.
There is no way for it to be clickable but u could make a invisible part on the blue text and u parent the surface gui into startergui and adornee it to the part.