Hey! I am currently trying to make text that appears that has richtext in it. However, I am having a bit of a struggle getting it to work. For some reason, when I want it to change the font color, it directly prints the string instead of changing the font color. It does work with other things, but it doesn’t work with this.
Here is my code;
local frame = script.Parent
wait(3)
frame:TweenPosition(UDim2.new(0, 0,0.808, 0), "Out", "Quart", 0.65)
text.Text = "I want the <font color="rgb(255,165,0)">orange</font> candy."
wait(0.5)
text:TweenPosition(UDim2.new(0.032, 0,0.5, 0), "Out", "Quart", 0.5)
I used escape characters so it doesn’t break the string, here are the escape characters.
Here is what it prints out;
If you know the issue, please inform me!
Did you forget to turn on rich text in the text label
I tested the method I used out and it should work. Another way of using escape characters is to put a backslash before it. Try out this code:
local frame = script.Parent
wait(3)
frame:TweenPosition(UDim2.new(0, 0,0.808, 0), "Out", "Quart", 0.65)
text.Text = "I want the <font color=\"rgb(255,165,0)\">orange</font> candy."
wait(0.5)
text:TweenPosition(UDim2.new(0.032, 0,0.5, 0), "Out", "Quart", 0.5)
Additionally, you can use quotes inside a string by either wrapping them in apostrophes, or in double brackets:
'This is a valid "string" that quotes can be used in'
[[This is a valid "string" that quotes can be used in]]
2 Likes
Be warned though that the double brackets creates a string literal, and you can’t use escape sequences in them.
3 Likes
It is already turned on. It works with everything else but text color.
Yes, this worked!
Such an easy fix, my bad!