Currently trying to make one of those Chat System messages that get sent in chat from time to time, problem is the :DisplayChatMessage() function creates its own font color, so I am never able to change the font color because it just breaks the whole rich text markup, I’ve seen these type of messages in a lof of games so I assume I’m doing something wrong. Any workarounds or fixes for this issue?
Part of script that handles the SystemMessage
local TextChatService = game:GetService("TextChatService")
local TextChannels = TextChatService:WaitForChild("TextChannels") -- waitforchild is pointless when adding a wait at top but better be safe than sorry.
local SystemChannel: TextChannel = TextChannels:WaitForChild("RBXSystem")
local g = "<font size='18'><font face='FredokaOne'>TEST</font></font></font>"
local h = string.gsub(tostring(g),"TEST",tostring(pickedTip))
SystemChannel:DisplaySystemMessage(
"<font color="..tostring(Color3.fromRGB(randomColor.R,randomColor.G,randomColor.B):ToHex())..">"..h
)
What gets sent:
(I’m assuming #d4d4d4 is the default text color)
First off, I’m not fully sure if this will solve your issue but I’ve seen this cause similar issues in the past, when doing rich text markup like this you want to keep all of your sections in the same bracket.
Okay so, I’ve tested with the sections, font name, and changed it up a little. I think the rich text markup itself is done correctly, but the problem lies within the function since it adds it’s own Font Color on top of my own.
Updated Script:
local TextChatService = game:GetService("TextChatService")
local TextChannels = TextChatService:WaitForChild("TextChannels")
local SystemChannel: TextChannel = TextChannels:WaitForChild("RBXSystem")
local g = string.gsub('<font color="COLOR" size="18" face="FredokaOne"> TEST </font>',"COLOR",tostring(Color3.fromRGB(randomColor.R,randomColor.G,randomColor.B):ToHex()))
local h = string.gsub(tostring(g),"TEST",tostring(pickedTip))
SystemChannel:DisplaySystemMessage(
h
)
What gets sent:
(you can see my own font color which is the ed65ff and the default one which is #d4d4d4)
(NOTE: tested my rich text markup thing on a TextLabel just to check and it works just fine.)
I don’t know why it’s sending the first “automatic” color statement but I do notice your color’s hex value doesn’t have a #, this could cause it to not format properly