Can you enable/disable bubble chat for a specific player?

So I’m creating a Radio System, and I would like to disable the bubble chat for a player when they have their radio on.

To turn your radio on, you simply press a keybind, I used UserInputService.

Now, how would I go on with disabling the chat for only one player?

Any help would be appreciated. Thanks.

3 Likes

I should suggest to put this in a localscript in startergui

local StarterGui = game:GetService("StarterGui")
StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Chat, false)

You could always do the function first in the local script, and when you are preparing to fire the remote events when the walkie talkie is picked up, execute this as well.

game:GetService("StarterGui"):SetCoreGuiEnabled("Chat", false)

This will disable the player’s whole chat, including the chat bar. I would like to just disable the bubble chat that appears above the player’s character.

1 Like

This would prevent any player from talking in-game.

Not if you change the variables, and the arguments… If it’s a local script… It’ll only work for them. Make sure you set the StarterGui’s variable to the Player’s Starter Gui.

1 Like

try to use this then

local ChatService = game:GetService("Chat") -- Call ChatService
ChatService:RegisterChatCallback(Enum.ChatCallbackType.OnCreatingChatWindow, function()
return {BubbleChatEnabled = true} -- Call the API to change its boolean value to true
end)
1 Like

I’m not sure but, I don’t believe there is a way to disable bubble chat for a player on the client without having a custom chat, or setting the chat to just regular without bubble chat.

This still won’t work, I tried it as well.

Don’t think it’s possible, and if it is… There has to be some deep math to do. But as a scripter when you can’t find the exact code to run your script, try to work around it.

It’s not a magic spell or anything involving math. :slight_smile:
(@visvisjes All this piece of code does is change the chat type - it does not toggle bubble chat)

Bubble chat is controlled by a LocalScript called BubbleChat which is responsible for drawing the bubble chat UIs above player’s heads. There’s an even better way to do this though without forking; it’ll prevent a sent message from showing up both in bubble chat and in the chat window. The Lua Chat System provides a lot of API so you can modify and extend vanilla chat.

If you’re on Roblox, you should be familiar with the /e dance chat command. It does not show up on either the chat window or as a chat bubble. This makes use of a command processor (available in documentation as Command Modules). Essentially, what we want to do is stop our message from being processed if the radio is on.

First off, we will need a way to indicate that a player’s radio is on - doesn’t matter how. We will then want to create a Command Module that will stop messages from being processed and sent when typed if radios are on. To add a command module without forking anything else:

  1. Create a Folder in Chat called ChatModules.
  2. Insert a BoolValue named InsertDefaultModules and make sure the value is checked off.
  3. Insert a ModuleScript and give it a fancy name, like RadioChatBlock.

In this ModuleScript, clear out the template code and replace it with the command module boilerplate:

local function Run(ChatService)
	local function processChat(speakerName, message, channelName)
		return (RADIO_IS_ON_CONDITION)
	end
 
	ChatService:RegisterProcessCommandsFunction("RadioChatBlock", processChat)
end
 
return Run

In RADIO_IS_ON_CONDITION, replace this with the place where you identify whether the radio is on or not, like the value of a BoolValue named On in the radio. If the function returns true when the command is ran, the chat will not be processed and thus will not show up in the chat window or as a bubble chat. If it’s false, the chat will show up.

Thus, there you have it. No chats while the radio’s on!

15 Likes