How to change color of system message

Hi all,

I want to make a system message when a player reaches a checkpoint.

However I’m struggling trying to change the color of the system message. Can anyone help please?

5 Likes

Edit: For clarity,

local msg = "Hello world!"
local color = '#CD5C5C'

game:GetService("TextChatService").TextChannels.RBXGeneral:DisplaySystemMessage(
	'<font color=\''..color..'\'>'..msg..'</font>'
)

Can get color codes from here or here

5 Likes

I did this a bit differently. This is a simple chat message when you start the game.
You’ll have to set the chat to LegacyChatService on TextChatService ChatVersion.

--LocalScript in StarterPlayerScripts

task.wait(6)
game.StarterGui:SetCore("ChatMakeSystemMessage", {	
Text = "First one to the center wins!"
Color = Color3.fromRGB(0,255,0)
Font = Enum.Font.SourceSansBold
FontSize = Enum.FontSize.Size18
})
2 Likes

Why would you recommend them to use legacy chat? Roblox has been pushing devs off it because it’s not going to get that much support

A way I did it is a bit easier to customize to your liking

local Message = "Hello world!" -- Original message
local Color = Color3.fromRGB(255,255,0) -- Yellow
local Metadata = ""
local FormattedMessage = string.format([[<font color="%s">%s</font>]], Color:ToHex(), Message) -- Formats the message so that you only have to plug in the values
TextChannel:DisplaySystemMessage(FormattedMessage, Metadata)

The reason why I use string.format() as well as Color:ToHex() is to avoid having to always convert the Color3 value each time. The string.format() makes it easier to just plug in the values you need. It is also important that you can also use [[ ]] as a way to put in quotation marks as well instead of having to use \" each time. Just my personal preference!

You can also use all the rich text that Roblox provides to do even more!

Avoid using this as this is outdated. Roblox is planning to phase out legacy chat in the future, so this function will not work as intended. Roblox also will moderate your experience if you continue to use the legacy chat

Didn’t recommend anything nor do I really care what chat I use.

--LegacyChatSystem:
game.StarterGui:SetCore("ChatMakeSystemMessage", {
    Text = "message here",
    Color = Color3.new(1, 0, 0)
})

--TextChatService
game.TextChatService.TextChannels.RBXGeneral:
       DisplaySystemMessage("<font color='#FF0000'>message here</font>")

It seems the new format is pretty much like an older html.

--html 4.01
<font color="#FF0000">message here</font>