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.
Disable bubble chat by setting the TextChatService.BubbleChatConfiguration.Enabled to false
Make a remote event, for this example I will call it “ShowChatBubble” and place it in ReplicatedStorage
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)
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)
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.
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.