Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How to make an Colored TextLabel?

So i wanted to make a Text label that has more than one color so for example

script.Parent.Text = "HI MY NAME IS TOM"

So here i want to have different types of colors on the them for example i want to change "HI" to color of yellow and "TOM" to green and other part stay the color black as normal. So you can say i want different parts of the text to be colored with different colors.

2 answers

✓ Accepted answer

TextLabel.RichText is what you need, read the article to understand, it basically let's you do good stuff with your text, make sure the RichText in enabled in the TextLabel and for your case you need to use font color which is part of RichText utilities, you would do:

script.Parent.RichText = true -- or set it in properties

script.Parent.Text = '<font color="rgb(255, 255, 0)">HI</font>MY NAME IS<font color="rgb(0, 255, 0)">TOM</font>'

This is taken from html where you do for example <h1 style="color=rgb(255,0,0)">heading</h1 so you can read about it but the roblox link about it explains it very well. In this case you need to use modifier <font></font> where inside of >< there is the text you want to be modified, doing just <font>Text</font> would not do much but you can add modifier to the font so you need to use color exactly, <font color="rgb(255,0,0)">Text</font>, this text will apear red as 255, 0, 0 in RGB is red. Everything not modified by text color will have color same as TextLabel.TextColor3.

I strongly suggest you to read this as it explains it very well.

2 comments

0

Fantastic

0

Really Hard Work Thank you Bro!!!

add a uigradient instance into the textlabel and edit the colors to what you need, you can also set these colors through a script although it requires a lengthy color sequence table

This discussion is preserved as it was. New answers, comments, and votes are closed.