I’ve been messing around with the TextChatService, and I wanted to make system messages. After finally getting the code to work (using code for LegacyTextService didn’t work) I managed to make them. A problem that I have is that they’re white (just as if a player would type it). I want to make them a different color, which I knew was possible with the old text service, but I’m stuck here.
the LocalScript in my StarterPlayersScripts:
local Player = game:GetService("Players").LocalPlayer
local replstorage = game:GetService("ReplicatedStorage")
local Event = replstorage.Events:WaitForChild("Chatted")
Event.OnClientEvent:Connect(function(msg)
task.wait(.1)
game:GetService("TextChatService").ChatWindowConfiguration.TextColor3 = Color3.fromRGB(170, 255, 255)
local m = game:GetService("TextChatService").TextChannels.RBXGeneral:DisplaySystemMessage(msg)
end)
I’ve tried changing its color, but that changes the whole chat instead of just that message
For those who are reading this in the future, you can use TextChannel.OnIncomingMessage or TextChatService.OnIncomingMessage to handle this in the future.
The two properties are similar except TextChannel’s will only run on messages that go through the channel and TextChatService’s will run on all messages.
For example, this snippet will change the message color of all messages that would display in the default RBXSystem channel.
TextChatService.OnIncomingMessage = function(textChatMessage)
local textChannel = textChatMessage.TextChannel
if textChannel and textChannel.Name == "RBXSystem" then
local overrideProperties = Instance.new("TextChatMessageProperties")
overrideProperties.Message = string.format("<font color='#FF0000'>%s</font>", textChatMessage.Text)
return overrideProperties
else
return nil
end
end