I’ve been trying to figure out how replace ContentText with another string but I can’t figure out how. For example:
--INPUT
local str = "<font face='FredokaOne'> Hello </font> <b> World! </b>"
--OUTPUT
local str = "<font face='FredokaOne'> Hey </font> <b> Mars! </b>"
ContentText, as in the property of a TextLabel for example? ContentText is simply a copy of the Text property, it’s read only to my knowledge. From the wiki:
“A copy of TextLabel.Text that contains exactly what is being rendered by the TextLabel.”
Essentially to change it, you’d have to change the actual text of the TextLabel by editing the Text
property.
local str = "<font face='FredokaOne'> Hello </font> <b> World! </b>"
local PathToTextLabel = script.Parent -- or wherever your text is located in relation to the script
PathToTextLabel.Text = str
If I misunderstood what you meant please let me know.
“Sorry for a bad explanation”
I was thinking something of a sign where the user can change the text. Like in PLS DONATE.
Since they create the RichText markups, how would I only filter the content text?
Just so I understand correctly, you’re referring to starting with "<font face='FredokaOne'> Hello </font> <b> World! </b>"
and getting the expected output of “Hello World!”, right?
just set the textlabel’s .Text property to the rich text you want(like <font face='FredokaOne'> Hello </font> <b> World! </b>
) and set RichText to true.