How does one change the font, color, or text size of a message sent from the server? (TextChatService)

I’ve been looking more at the new TextChatService, and I’m not seeing a way to send messages with different fonts, colors, or any of that via a script… is that still possible?

local TextChat = game:GetService("TextChatService")
warn("RAN MESSAGE RECEIVER")
repeat
	wait()
	local Success = pcall(function()
		TextChat.TextChannels.RBXGeneral:DisplaySystemMessage(message)
	end)
until Success
warn("COMPLETED")
2 Likes

I’m not to diverse in TextChatService but, according to the wiki, what you’re looking for is TextChatService.OnIncomingMessage. If you’re trying to send a message from the Server to Clients, you’ll have to utilize a RemoteEvent since the displaying of text chats are handled entirely on the client.

1 Like

You’re going to need RemoteEvents and a localscript.

Server script:

local Event: RemoteEvent -- make an event and put it somewhere (example: ReplicatedStorage)
local TextChatService = game:GetService("TextChatService")

task.wait(15)
Event:FireAllClients("[SERVER]: Server custom message")

Local script:

local Event: RemoteEvent -- same event from before
local TextChatService = game:GetService("TextChatService")
local channel = TextChatService:WaitForChild('TextChannels').RBXGeneral

-- changing size --> <font size="32">message</font> -- 32 is the size
-- changing color --> <font color='..rgb or hex..'>'..message..'</font>

-- This example will change the color
Event.OnClientEvent:Connect(function(message)
	local color = "#ffb429"
	channel:DisplaySystemMessage(
		'<font color='..color..'>'..message..'</font>'
	)
end)

For more variety just treat it as RichText (changing font, visibility, etc)

3 Likes

This works! Just one thing…

Make sure to add extra parentheses around the hex code or else the markdown won’t work properly

Event.OnClientEvent:Connect(function(message)
	local color = '"#ffb429"'
	channel:DisplaySystemMessage(
		'<font color='..color..'>'..message..'</font>'
	)
end)

Now the code will see it as <font color="#ffb429" instead of <font color=#ffb429.
Brilliant solution, thanks for the help!

1 Like