Properties of DisplaySystemMessage || TextChatServices

Im attempting to modify other properties of a system message other than its text (Color for instance), but I don’t know how and the documentation doesnt show any way to do so.

game.TextChatService.TextChannels.RBXGeneral:DisplaySystemMessage('Hello')

image

Is there any way to get the TextLabel instance and change its textcolor?

2 Likes

In this one, I’m not sure if there is a way to properly do that. If you didn’t care about which text channel the system message was in, you could use ChatMakeSystemMessage. For the documentation, scroll down this page StarterGui | Roblox Creator Documentation

Can’t you use ChatMakeSystemMessage?

Allows for modifying properties such as color, font and text size.

That’s outdated, we’re talking about TextChatService.

Done some more digging, found there is a way to do so:

local m = game.TextChatService.TextChannels.RBXGeneral:DisplaySystemMessage('asdasd123').MessageId
game.CoreGui.ExperienceChat.appLayout.chatWindow.scrollingView.bottomLockedScrollView.scrollingFrame:WaitForChild(m).TextColor3 = Color3.fromRGB(101, 227, 255)

it only works as a command line and not in a script

I saw a similar question posted this weekend here: How do I change System Text's Color on the new TextChatService? - #3 by be_nj

In your case, it sounds like you want to have a specific color for your “Hello” system message. In this case, I’d recommend using the second optional argument, metadata of DisplaySystemMessage to attach a unique ID for your system messages. You can then use the metadata property in your OnIncomingMessage callback like this:

TextChatService.OnIncomingMessage = function(textChatMessage)
    if textChatMessage.Metadata == "hello" then
        local overrideProperties = Instance.new("TextChatMessageProperties")
        overrideProperties.Text = string.format("<font color='#FF0000'>%s</font>", textChatMessage.Text)
        return overrideProperties
    else
        -- do nothing
        return nil
    end
end

RBXGeneral:DisplaySystemMessage("Hello there!", "hello")
RBXGeneral:DisplaySystemMessage("Hola!", "hello")
19 Likes

I tried this myself and it works great, although I had to change line 4 from

overrideProperties.Text = string.format("<font color='#FF0000'>%s</font>", textChatMessage)

to

overrideProperties.Text = string.format("<font color='#FF0000'>%s</font>", textChatMessage.Text)

for it to work properly.

3 Likes

Good catch, that was a typo on my part. I’ve edited my original message with your change for future readers

3 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.