How to make players not see chat from different teams?

For example if the player is in team lobby, and another player is in team ingame, team ingame cant see chats from team lobby.

2 Likes

Do you want this to be optional or forced?

If it’s optional, players can just type /team in the chat box before their message so that their chat is only sent to their team.

If you want it to be forced, the Lua Chat API will need to be used.

This was explained by @antonio6643 in a past thread:

3 Likes

This is fairly simple and works through a local script.

So what you want to do is for a local script to check which team you’re in as you join in the game, if you’re on the lobby team, chat is false, if you’re not it shouldn’t be interfered with and chat is on by default.

No matter what, everytime you spawn in, the local script will run.

repeat wait() until game.Players.LocalPlayer

local Teams = game:GetService("Teams")

local PlayerService = game:GetService("Players")

local Player = PlayerService.LocalPlayer

local StarterGui = game:GetService("StarterGui")

if Player.TeamColor == Teams.Lobby.TeamColor then
StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Chat, false)
else
StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Chat, true)
end

I would put the local script inside StarterGui.

In this case, the team is called “Lobby”.

He still wants people in the lobby to be able to chat with other players in the lobby. Your approach would completely disable chat for players in the lobby.

What he needs to do is mute players in the lobby from the global chat channel as I explained in the post I linked above.

6 Likes

Hey, do you know how I could get the players as soon as they chat, and make it so that other players can’t see those messages if a condition is met, I’ve already forked the chat system, I just need to figure out how to get when a player sends a message