Okay, so today I learned about the new TextChatService as I was still using the Legacy one.
So, I just have one question about the default TextChannels that appear, Is there a difference between RBXGeneral and RBXSystem?
Okay, so today I learned about the new TextChatService as I was still using the Legacy one.
So, I just have one question about the default TextChannels that appear, Is there a difference between RBXGeneral and RBXSystem?
RBXGeneral and RBXSystem both have independent TextChannel.OnIncomingMessage
callbacks set.
RBXGeneral’s OnIncomingMessage
callback will auto-color the name of the sender. It looks a little like:
textChannel.OnIncomingMessage = function(message)
local properties = Instance.new("TextChatMessageProperties")
if message.TextSource then
local nameColor = GetNameColor(message.TextSource.UserId)
properties.PrefixText = `<font color="#{nameColor:ToHex()}">{message.PrefixText}</font>`
end
return properties
end
RBXSystem’s OnIncomingMessage
callback is a little different and will color the entire message based on the Metadata
property of the incoming message. This looks something like:
textChannel.OnIncomingMessage = function(message)
local properties = Instance.new("TextChatMessageProperties")
local messageColor = if string.find(message.Metadata, "Error")
then Colors.Red:ToHex()
else Colors.LightGrey:ToHex()
properties.Text = `<font color="#{messageColor}">{message.Text}</font>`,
return properties
end
Oh okay, I’ve got it now thank you
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.