I am trying to make custom chat tags/colors with the TextChatService. I have had success but have one problem: changing the color of my chat text also changes the color of my text in bubble chat, but I don’t want it to do that.
Here is my code:
local TextChatService = game:GetService("TextChatService")
local function onIncomingMessage(message: TextChatMessage)
local properties = Instance.new("TextChatMessageProperties")
if message.TextSource then
local player = Players:GetPlayerByUserId(message.TextSource.UserId)
if player.UserId == 196806612 then
local color = Color3.fromRGB(99, 255, 75):ToHex()
local tag = "[DEV]"
properties.PrefixText = `<font color="#{tostring(color)}">{tag} {message.PrefixText}</font>` -- set chat tag
properties.Text = `<font color="#{tostring(color)}">{message.Text}</font>` -- set chat color
end
properties.PrefixText = properties.PrefixText:gsub(player.DisplayName, player.Name) -- disable display names in chat
end
return properties
end
TextChatService.OnIncomingMessage = onIncomingMessage
This code works as expected:
But also makes my bubble chat color the same color, making it hard to read.
Is there a way to keep the bubble chat color as the default, but change the color of the messages in the chat window with TextChatService?
I’ve been facing the same issue recently, and despite my efforts, I haven’t been able to find a solution. One suggestion you could try is utilizing the Rich Text stroke feature. However, I must mention that it didn’t work for me when I attempted to combine it with colored text. As a workaround, I’ve been changing the chat box to black and setting the default text color to white by modifying the TextChatService properties in the Explorer. This adjustment significantly improves visibility for custom colors like green and yellow. Give it a try as a temporary fix until a proper solution is available!
That’s a good workaround, I’ll do some experimenting. Quite annoying that there’s no documented way to change the color of the bubble text to something other than the chat color. When I get some time I’ll play around with the bubble chat properties and see if I can figure out a better workaround as I don’t want to have to make the bubbles darker in this particular game.
Also running into this… for some reason when rich text is applied to OnIncomingMessage, by the time it gets stripped out for OnBubbleAdded… it is no longer possible to change the text color. Seems as though the chat is somehow “flattening” the color from rich text into actual properties that we can no longer override, or something like that.
So we too in Jailbreak will make our chat bubbles dark for the time being.
I wanted to bump this as I’m also running into this issue, and it’s super annoying. There is no reason that the colored-text of OnIncomingMessage should override changes made OnBubbleAdded. I additionally tried to parent a new instance of BubbleChatMessageProperties to my props instance of TextChatMessageProperties as part of OnIncomingMessage (which in theory should’ve worked as BCMP is a child of TCMP) – but that was also unsuccessful. I think by default colored-text should apply to both, but OnBubbleAdded’s properties should ultimately take priority control over the bubble chat.
If in your game in the Studio you go to the Explorer window down to …
TextChatService / BubbleChatConfiguration, there is a property called BackgroundColor3.
Change that. TextColor3 is there also.
From script:
-- non-local script in ServerScriptService
local cs = game:GetService("TextChatService")
local bubble = cs.BubbleChatConfiguration
bubble.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
bubble.TextColor3 = Color3.fromRGB(255, 255, 0)