Positioning buttons over text

I’m trying to create an interactive computer interface module but am unsure how position a TextButton over a given string of characters.

(e.g. I want to make the word “administrator” a piece of text that could be clicked on and brought to another page.)

1 Like

Try changing the ZIndex property of the TextButton so that it’s higher than the ZIndex of the TextLabel.

  1. You could do it with TextBounds by getting text size then divide the lines on TextSize.Y and it will give you Y per line like if you have 3 lines and the textsize is 30 then the size of the one line is 10, then you can position it with line position which is 10 , This is only for the Y axis but the X is bit difficulted to get,
  • For the X you can loop per lines by spliting “\n” means new line with string.split(str,“\n”) and it will give you all the lines then you are going to loop throught these lines and get the most line that has many character now we know the character per x for example if the biggest line has 5 character and the textsize.X is 10 then every character size is 2 but make sure you don’t count the spaces or taps, then you can change size of the textbutton the new values,
  1. If your last word is administrator then you can use the TextBounds.Y to position the button Y and then remove SizePerLine so it position it for the last line and for the x just make it same as AbsoluteSize.X

if we use TextService and :GetTextSize it will give us the x,y but these aren’t getting the accurate size because we have Textfont and other stuff that will make it bigger anyway

||i haven’t test this so don’t judge me if i was wrong||
TextBounds | Documentation - Roblox Creator Hub

1 Like

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