Change colors of string multiple time

Hello !
I search everywhere and I dont find my anwser.
This is what is have : I have a string, with value who come from server and other and i want to have different colors, for server value, and normal values.

replicatedStorage.REWARDS_EXPLO.TEXT_REWARDS.SCRAP_TEXT.OnClientEvent:Connect(functi on(newxp, newScrap)
    local textREwards = replicatedStorage.REWARDS_EXPLO.TEXT_REWARDS.MONEY_REWARDS
    local clone = textREwards:Clone()
    local tchat = button.Parent.UPDATETCHAT
    clone.Text = text .. newxp .. " XP and " .. newScrap .. " Scraps while searching an factory"
    clone.Parent = tchat
end)

And so i want to have a different color for “newxp” “newscrap” but i dont know how

You can edit the color of text in a textlabel/textbutton by editing its TextColor3 property

You can check out Using Rich Text (roblox.com) it allows you to add cool things such as different colored text, bold, italic, etc.

Example:

clone.RichText = true -- Enable rich text
newxp = "<font color=\"rgb(0, 0, 255)\">" .. newxp .. "</font>"
newScrap = "<font color=\"rgb(255, 255, 0)\">" .. newScrap .. "</font>"
clone.Text  = text .. newxp .. " XP and " .. newScrap .. " Scraps while searching an factory"
1 Like

okay thanks ! i try now this seems to be the solution

THANKS YOU