Bubble Chat Team Only?

So, I am making a game and it is bubble chat exclusive, so i’ve been exploring it and I am stuck on this:

I am wanting it to only show the bubble chat if the players are on the same team, I cannot find anywhere where I can reference the people seeing the chat, I tried accessing the table but not luck, if anyone could figure this out I haven’t found anything about this so I think it might help people in the future wondering.

BubbleChat rendering is handled on the client, so the person seeing the chats is the individual player which the BubbleChat script is running on.

You could handle adding Team Chat in the OnPlayerChatMessage function in the BubbleChat LocalScript, which passes in the source player as one of its arguments.

Where? targetPlayer is nil so I cannot access it.

The first argument in the function is sourcePlayer, you should use this.

function this:OnPlayerChatMessage(sourcePlayer, message, targetPlayer)

Source player is the one talking? Don’t I need to access the people seeing it to make sure they are on the same team?

Yes sourcePlayer is the person talking and like I said, BubbleChat is Rendered on the client. The person seeing their chat is the LocalPlayer.

So sourcePlayer is the one receiving the message? Sorry I am very confused.

sourcePlayer is the person who sent the message.

Line 556

if LocalPlayer.Character.Head.Color ~= sourcePlayer.Character.Head.Color then
message = “…”
end

In this instance I have it checking the talking player head color and if the player being talked to has a head color any different it will make the message appear as “…”.

To edit this to teams, simple replace with .Team

To make the chat not appear at all, simple replace the “…” line with “return”.