Hey there! I am making a command system. I have gotten to the point of handling arguments of commands and am currently stuck on sending a classical red-colored [system]-tagged error message.
I tried to use DisplaySystemMessage in the RBXSystem channel for that; however, it did not work, and as the title suggests, showed raw content (e.g. <font color… is seen). (Neither did it work with RBXGeneral channel)
The DisplaySystemMessage is ran in a LocalScript in StarterPlayerScripts. The following part gets executed on a client event (Event.OnClientEvent):
I also have another script called UserChatScript, also in StarterPlayerScripts. Here are its contents:
local function incomingMessage(message: TextChatMessage)
local textChannel = message.TextChannel
local properties = Instance.new("TextChatMessageProperties")
local textSource = message.TextSource
-- Tags
if message.TextSource then
local player = game:GetService('Players'):GetPlayerByUserId(message.TextSource.UserId)
if player:GetAttribute('isOwner') then
properties.PrefixText = "<font color='#F5CD30'>[Owner]</font> " .. message.PrefixText
elseif player:GetAttribute('IsDev') then
properties.PrefixText = "<font color='#F5CD30'>[Developer]</font> " .. message.PrefixText
elseif player:GetAttribute('isAdmin') then
properties.PrefixText = "<font color='#F5CD30'>[Admin]</font> " .. message.PrefixText
end
end
if textChannel and textChannel.Name == "RBXGeneral" and message.Metadata == 'systemMessage' then
properties.Text = string.format("<font color='#FF0000'>%s</font>", message.Text)
--properties.Text = message.Text
end
return properties
end
game:GetService("TextChatService").OnIncomingMessage = incomingMessage
How the raw DisplaySystemMessage message gets outputted:
I hope there is an answer to my issue and it can be resolved swiftly. Thanks in advance!
Thank you for your reply. As you can see in the picture provided in the post, the RichText contents work fine with the PrefixTest, however, as far as I understand this, there is an unexpected behavior with Text.