Hey there! So I’m trying to color a TextLabel with each letter having a different color. The problem is that I need to do it with variables and it just doesn’t work.
word.Text = “<font color = ‘#00be00’>”..Variable1.."</font.><font color = ‘#ff0000’>"..Variable2
Any help would be really appreciated!
Your mistake is in the quotes, you can use double quotes(") and single (') to separate the strings, try this
word.Text = "<font color='#00BE00'>"..Variable1.."</font><font color='#FF0000'>"..Variable2.."</font>"
if you only will use rich text for color, you can make a function to make it easyer
local function toRichText(...) local args = {...} local texts = {} for i,v in next, args do local colors ={v[2].R, v[2].G, v[2].B} texts[i] = "<font color='rgb("..table.concat(colors, ', ')..")'>"..v[1].."</font>" end return table.concat(texts, '') end -- Single text example: word.Text = toRichText({'Hello', Color3.new(0, 170, 255)}) -- Multi text example word.Text = toRichText( {'Hello', Color3.new(0, 170, 255)}, {', how are you?', Color3.new(0,0,0,0)} )