Have chatted bubble only appear above the Local Player?

I’m working on a multiplayer game, where each player exists in the same space, but they shouldn’t be able to see each other. I’ve managed to code it so that they are invisible to one another and cannot collide.

However, when talking in the chat, the bubble appears above their respective locations. To a client, this just appears as a floating bubble. Ideally, I’d like to keep bubble chat on, so as to not remove the “immersion” within the game.

I haven’t been able to find anything online that can help with my situation specifically. I’ve experimented with several things on my own but can’t get anything to work. I was wondering if perhaps disabling the bubblechat within a script and then changing the talkpart for the client, but I’m not positive that would work.

Any thoughts? Thanks in advance!

One way to do it is:

  1. Disable bubble chat by setting the TextChatService.BubbleChatConfiguration.Enabled to false
  2. Make a remote event, for this example I will call it “ShowChatBubble” and place it in ReplicatedStorage
  3. Create a server Script, place it in ServerScriptService
game.Players.PlayerAdded:Connect(function(playerChatted)
	playerChatted.Chatted:Connect(function(message)
		for _, player in ipairs(game.Players:GetPlayers()) do
			if player == playerChatted then continue end
			game.ReplicatedStorage.ShowChatBubble:FireClient(player, playerChatted, message)
		end
	end)
end)
  1. Create a LocalScript, place it in StarterPlayer.StarterPlayerScripts:
local chat = game:GetService("Chat")

game.ReplicatedStorage.ShowChatBubble.OnClientEvent:Connect(function(playerChatted, message)
	if playerChatted == nil or message == nil or playerChatted.Character == nil then return end
	chat:Chat(playerChatted.Character, message)
end)
  1. Test out if it works

Hope this helps!

Thanks for the reply! Unfortunately, this doesn’t seem to work. While the output finds no errors, upon chatting both solo and in a server setting, the chat bubble doesn’t appear. The text does get fired into the chatlogs, which I was hoping for, but client-side there is no bubble.

Definitely helped though! Thank you!

Oh, is your intended behaviour to only see your own chat bubbles or to only see others’ chat bubbles?

If you only wish to see your own chat bubbles, just change the if player == playerChatted then continue end line to if player ~= playerChatted then continue end and it should work.

Or better yet, change the code to

game.Players.PlayerAdded:Connect(function(playerChatted)
	playerChatted.Chatted:Connect(function(message)
		game.ReplicatedStorage.ShowChatBubble:FireClient(playerChatted, playerChatted, message)
	end)
end)

The server script pretty much controls who gets to see the bubbles of the player who chatted and who doesn’t.

Works beautifully! Thanks so much for your help, it was greatly appreciated and definitely helpful.