How do I Change the Background Color of someones bubble!

Hey all! I was messing around with Roblox’s more new and modern text service, and I can’t seem to quite figure it out fully. I am attempting to modify the background color of a message bubble when it’s sent in teamchat. I figured out how to make it detect if it’s teamchat or not, however, I am unaware how to modify just that player’s bubble. The closest I got was modifying the Chat Configuration locally, which still effected all players bubble color, not just that player. I am doing this so players can distinguish whether the player is in teamchat or not without the chat window. Any suggestions, solutions, or ideas are appreciated!

Bubble chat, not the chat box.

Hey! Could you send a quick screenshot of what you mean, do you mean the Bubble CHat or the PrefixText?

Bubble Chat! Whenever a player sends a message and that little bubble pops up on top of the players character, that thing.

What you’re looking for is TextChatService.OnBubbleAdded. The documentation for this function can be found here. It doesn’t go through much on the bubble chat properties, so I’ll give a little insight below, just make sure to create your own code for it so that you can learn better.

TextChatService.OnBubbleAdded = function(Bubble: TextChatMessage)
     local properties = Instance.new("BubbleChatMessageProperties")

     if Bubble.TextSource then
       -- Add any logic you want here, me personally I check if the player is valid by checking Bubble.TextSource.UserId

       properties.TextColor3 = -- Desired Text Color
       properties.BackgroundColor3 = -- Desired Text Color
     end

     return properties
end

This will run before the bubble is sent, so this ensures that it’s configured to your likings before showing the chat onto the client. You can expand on further functionality in the documentation, but hopefully this gives you the basics.

1 Like

Thanks a lot. Never knew this function existed! You learn something every day.

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