When using RichText
, changing the TextLabel’s text either manually or via script will keep the TextLabel’s previous rich text, so long as you’re using bold
, italics
or font weight
. (There may be other types of rich text that this happens with, though from my testing it was only these three)
This happens on both the client and the server.
This happens both in studio and in game.
Currently, a way around this is to change the text into something that doesn’t use rich text, like an empty string, beforehand. If done via script, you need to include a task.wait()
.
To reproduce this manually, without a script, you can do the following with a TextLabel
with the RichText
property set to true
:
- Set the
TextLabel
’sText
property to a string with italic formatting, such as<i>italics</i>
- Without changing it to anything else prior, set the
TextLabel
’sText
property to a string with bold formatting, such as<b>bold</b>
Notice how the TextLabel
is displaying the previously inputted italic formatting, but the newly inputted “bold” text?
This does the same in the other direction too, and also functions similarly when using font weight
Below is a video of how it works without a script:
Below is a video of how it works with a script:
Below is a script that’ll replicate this functionality, assuming script.Parent
is a TextLabel
with the RichText
property set to true
:
script.Parent.Text = "<i>italics</i>"
--script.Parent.Text = "<font weight = \"heavy\">heavy</font>"
--script.Parent.Text = "<b>bold</b>"
task.wait(3)
-- These two commented out lines prevent this bug, but it generally looks ugly with the slight flicker
--script.Parent.Text = ""
--task.wait()
--script.Parent.Text = "<i>italics</i>"
--script.Parent.Text = "<font weight = \"heavy\">heavy</font>"
script.Parent.Text = "<b>bold</b>"
Below is a place file that replicates this functionality:
richtextbug.rbxl (60.6 KB)