Not long ago Roblox added a new feature, RichText. It allows different text in a text label to have different colour, size, font, etc... However, when RichText is combined with string.sub also know as a typewriter effect, this happens since RichText tags need a <> and </>.
I found this off the Roblox Developer Forum to bold a string of text.
local textToType = "The quick brown fox jumps over the lazy dog.";
local richTextTemplate = "<b>%s</b>"
for i = 1, textToType:len() do
script.Parent.Text = richTextTemplate:format(textToType:sub(1, i))
wait()
end
However, my text is stored like this:
Text = "The quick <font color='rgb(106, 57, 9)'>brown</font> fox jumps over the lazy dog."
So that way would not be possible to do as it will colour the entire string instead of just one word or if I wanted to sub in the player's name
Text = "Hey <font color='rgb(106, 57, 9)'>%s</font>, welcome to my game!"
where %s will be used with string.format(Text, Player's Name)
What's the best way to make both of them compatible given the situation I have? Any tips or help would be appreciated! Thanks in advance.
