TextChatMessageProperties Overriding Bubblechat's Text Color by RichText

Expected

TextChatMessageProperties Changing Only TextChat’s Message Color.

Issue

TextChatMessageProperties Changes Bubblechat’s Text Color and TextChat’s Message Color, Likely because of the RichText Behind it, this reply tries to explain it from the post linked below, and this reply too thats also from a post linked below.

RBXL Showcasing The Problem

BubbleChatBug.rbxl (52.7 KB)

Code Used Inside RBXL
local TextChatService, Players = game:GetService("TextChatService"), game:GetService("Players")

TextChatService.OnIncomingMessage = function(message: TextChatMessage)
	local Properties = Instance.new("TextChatMessageProperties")

	if message.TextSource then
		local player = Players:GetPlayerByUserId(message.TextSource.UserId)
		Properties.Text = "<font color='#d91695'>".. message.Text.. "</font>"

	end
	return Properties
end
Posts Regarding Issue

My Forum Post: Making Bubble Text and Chat Text Different Colors
2023 Post About The Issue: Make bubble chat color different from chat color

The Issue Itself

The Script causes the exact text to replicate to the Chat Bubble’s TextLabel, this shouldn’t happen.

image

Without the initial RichText problem, the Bubble Chat’s Text Color functions Properly.

8 Likes

Thanks for the report! I filed a ticket in our internal database.

4 Likes

Any updates regarding this? I don’t mean to be any impatient.

Just ran into this as well, this is a crucial part of our existing chat customization system which relied on us using a fork in the past. We can no longer use a fork due to all the chat advancements and thus have lost a TON of customizability.

With bugs like this (which are incredible in their nature themselves) it becomes even more difficult to work with the tools that Roblox provides us. Especially with the extreme lack of documentation around these topics.

I managed to find a workaround for this bug in case anyone was coming across this and needed one. It’s pretty dirty but it works. Basically what you have to do is decouple TextChatService.OnIncomingMessage and TextChatService.OnBubbleAdded by first disabling TextChatService.BubbleChatConfiguration and TextChatService.BubbleChatConfiguration.Enabled, then on TextChatService.MessageReceived, strip the message of its rich text tags, then call textChatService:DisplayBubble, which will then invoke TextChatService.OnBubbleAdded, where you can do your bubble chat configuration.

Example (first set TextChatService.BubbleChatConfiguration.Enabled to false):

local players = game:GetService('Players')
local textChatService = game:GetService('TextChatService')

game:GetService('Chat').BubbleChatEnabled = false

function textChatService.OnIncomingMessage(message: TextChatMessage)
	local source = message.TextSource

	if not source then
		return
	end

	local player = players:GetPlayerByUserId(source.UserId)

	if not player then
		return
	end

	local messageProperties = Instance.new('TextChatMessageProperties')
	messageProperties.PrefixText = `<font color="#ff00ff">{ message.PrefixText }</font>`
	messageProperties.Text = `<font color="#ffff00">{message.Text}</font>`

	return messageProperties
end

textChatService.MessageReceived:Connect(function(message)
	local source = message.TextSource

	if not source then
		return
	end

	local user = players:GetPlayerByUserId(source.UserId)

	if not user then
		return
	end

	local character = user.Character
	if not character then
		return
	end

	textChatService:DisplayBubble(character, message.Text:gsub("<[^<>]->", ""))
end)

function textChatService.OnBubbleAdded(message, adornee)
	if not adornee then 
		return
	end

	local player = players:GetPlayerFromCharacter(adornee)

	if not player then
		return
	end

	local properties = Instance.new('BubbleChatMessageProperties')

	properties.BackgroundColor3 = Color3.new(0, 1, 0)
	properties.TextColor3 = Color3.new(1, 1, 1)

	return properties
end

This will result in:

5 Likes

This issue still persists and is yet to be changed.

1 Like

Bump, this is still occurring.

4 Likes

also bump, this happens for my game as well

1 Like

Encountered this issue just now and would really like it resolved. I’ll be going with cody’s workaround for now, but I really think developers shouldn’t have to do that. Modifying the chat message color should never affect the bubble text color, as they are two entirely different things. I didn’t expect at all that modifying chat test color would have this type of effect.

there also an issue with TextChatService.OnIncomingMessage which firing twice on each message