I have no idea how to use richtext or html, so I have no idea how to insert the player name into this string.
All I found is people sending the devforum post which doesnt really help me in this situation.
I’m using a custom chatbox to change the color of the player name in chat.
How would i change “player name here” to the actual player name?
local function rgb255RichText(color3)
local R = (color3.R * 255)
local G = (color3.G * 255)
local B = (color3.B * 255)
return string.format("rgb(%d, %d, %d)", R, G, B)
end
function createtext(stri,plr)
local c = Text:Clone()
local color = rgb255RichText(Color3.fromRGB(0, 55, 235))
local name = color
c.Text = [[<font color="]] .. color .. [[">[ "PLAYER NAME HERE" ]</font>]] .. " " .. stri
c.Parent = goal
end
You should take a look at string interpolation. It’s cleaner (imo) than using the concatenation operator. You can add the player’s username like this, alongside the other variables you were mixing in. This could also be a replacement for string.format() in some cases.