How to hide Chat Messages with Default Chat?

I have a game where players will be put in either a lobby or a battleground. I’m trying to make it so the lobby players can see all chat messages while the battleground players can only see each others’,

I managed to achieve this with a custom chat I but recently discovered that Murder Mystery 2 are doing this with the default one. I’m thinking that this has been made possible with the addition of Lua Chat but I find the Client API quite confusing.

I can think of two methods:

  • Somehow block all chat messages so they don’t get sent to server at all. Then create the messages locally if conditions are met. I’m aware of game.StarterGui:SetCore("ChatMakeSystemMessage") but it doesn’t allow separate color for tag / username.
  • Somehow connect to the creation of new messages locally and if conditions are met, call something like Channel:RemoveLastMessage().

Any idea how to do this with the Lua Chat API?

1 Like

I don’t have the specifics for you, but where clients receive messages you can check the team of the sending player and the receiving player. If the sender and the receiver are both on battlegrounds team or lobby team then allow the message to be processed, but if the teams don’t match then don’t process or display the message.

I’m pretty sure they’re using chat channels somehow. While you also may be able to ‘manully’ block messages, the chat system has a channels feature.

An idea for how they do it could be when a player is in the lobby, they join all three channels (lobby, team 1, team 2), and then when a player is in game they leave two channels (lobby, other team). When a player in lobby speaks, their messages go into the lobby channel. When a player in a team speaks, the same thing happens for their channel.

I haven’t really used them much myself, but the documentation is here:
http://wiki.roblox.com/index.php?title=Lua_Chat_System#Adding_Channels
http://wiki.roblox.com/index.php?title=Lua_Chat_System/Server_API/ChatChannel

4 Likes