How to set RichText color with variables?

So I’ve made a chat system, where the name of the player will be displayed in a color according to him or her’s team. Everything works fine right until it’s time to set the color with variables and suddenly it all breaks.
(I’ve tried tostring)

local Color = Player.Team.TeamColor.Color

local R,G,B 
R = Color.R * 255
G = Color.G * 255
B = Color.B * 255

--Manual color line:
TextLabel.Text = '<font color="rgb(255,125,0)">['..Player.Name..']:</font>'.._message

--Color set by variables line:
TextLabel.Text = '<font color="rgb('..R..","..G..","..B..')">['..Player.Name..']:</font>'.._message

Result of manual:
ex1

Result of color set by variables: (Which doesn’t work)
ex2

local Color = Player.Team.TeamColor.Color

local R,G,B
R = Color.R * 255
G = Color.G * 255
B = Color.B * 255

TextLabel.Text = `<font color="rgb({R},{G},{B})">[{PlayerName}]:</font>{_message}`
1 Like

Sadly didn’t work, I had the same result as before.

local Color = Player.Team.TeamColor.Color:ToHex()

--Manual color line:
TextLabel.Text = '<font color="rgb(255,125,0)">['..Player.Name..']:</font>'.._message

--Color set by variables line:
TextLabel.Text = "<font color=\""..Color.."\">["..Player.Name.."]:</font>".._message
1 Like

Still pops out with the wrong result sadly
ex3

ah sorry but a # before the color i.e

local Color = Player.Team.TeamColor.Color:ToHex()

--Manual color line:
TextLabel.Text = '<font color="rgb(255,125,0)">['..Player.Name..']:</font>'.._message

--Color set by variables line:
TextLabel.Text = "<font color=\"#"..Color.."\">["..Player.Name.."]:</font>".._message
3 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.