ew_iscool
(professional)
June 17, 2024, 6:47pm
1
so i’ve been trying to make roblox NPCs chat with TextChatService, and im trying to color their name differently from the rest of their text, but since roblox uses
'<mark><font color="rgb(numbers numbers numbers)">TEXT</font></mark>'
i cant put variables in, since the string is just set in stone
when i really want to do
"<mark><font color="..nameColors[math.fmod(getNameValue(Name),#nameColors-2)+1]..">"..Name.."</font></mark>"
1 Like
0101100_0
(私はかわいいワッフルです)
June 17, 2024, 6:51pm
2
You can use `` (back apostrophe) thats like “” or ‘’ but you can insert variables using braces inside of it like {something}
Stimwave
(Stimwave)
June 17, 2024, 6:54pm
3
local color = nameColors[math.fmod(getNameValue(Name), #nameColors - 2) + 1]
local text = `<mark><font color="{color:ToHex()}">{Name}</font></mark>`
this is using string interpolation ( ` backtick)
3 Likes
ew_iscool
(professional)
June 17, 2024, 7:13pm
4
i’ve edited the code a little bit, but even before i edited it it still had this issue
why is there an extra <font color=“#d4d4d4 ” before the msg
edit: nvm i figured it out
Stimwave
(Stimwave)
June 17, 2024, 7:23pm
5
OOPS i just realized i put ToHSV and not ToHex
system
(system)
Closed
July 1, 2024, 7:23pm
6
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.