Hi, this is my second post here, so I’ll keep it simple;
I want to make an Inter-team chat.
I have looked on the Developer Forum and the Developer Hub, but I cannot seem to find a good guide on how to make an inter-team chat. I’m sure there’s a solution that I haven’t found, if so, please say.
I’d like there to be a channel for people in certain teams to communicate. For example, if there’s a “Helper” team and a “Trainer” team, they should be able to communicate. I found a guide that works on ranks, but not teams.
TL;DR: I want to make an Inter-team chat, if you can help, please comment
1 Like
Hello, how are you doing?
If you’re talking about people in the same team talk with each other, there’s no need to do any script as adding % or /t before you’re message automatically makes you speak with you’re team.
Now, if you want two different teams to speak with each other. You can do this:
Make a remote event inside Replicated Storage with the name of “TeamChatting”
Local script inside StarterGui:
local remote = game:GetService("ReplicatedStorage").TeamChatting
remote.OnClientEvent:Connect(function(Message)
game:GetService("StarterGui"):SetCore("ChatMakeSystemMessage", (Message))
end)
Server Script inside ServerScriptService:
Note: Make two teams called “Helper” and the other one “Trainer” inside game.Teams
local command = {}
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local prefix = "/"
command.talk = function(sender, String, PlayerWhoFired)
if String then
local Split = String:split("/talk")
String = Split[2]
for _, PlayersInGame in pairs(Players:GetChildren()) do
if PlayersInGame.Team == game.Teams.Helper or PlayersInGame.Team == game.Teams.Trainer then
wait()
game.ReplicatedStorage.TeamChatting:FireClient(PlayersInGame, {
Text = "["..PlayerWhoFired.Name.."]: "..String;
Color = Color3.fromRGB(255, 255, 0);
Font = Enum.Font.SourceSansBold;
FontSize = Enum.FontSize.Size18;
})
end
end
end
end
game.Players.PlayerAdded:Connect(function(Player)
Player.Chatted:Connect(function(message)
if Player.Team == game.Teams.Helper or Player.Team == game.Teams.Trainer then
local messagelower = string.lower(message)
local splitString = messagelower:split(" ")
local slashCommand = splitString[1]
local cmd = slashCommand:split(prefix)
local cmdName = cmd[2]
if command[cmdName]then
command[cmdName](Player, message, Player)
end
end
end)
end)
I still don’t have any idea of how to make the original message “not appear” or “delete itself”, but this creates a message where only people in the Helper and Trainer team can see, you have to write /talk before you’re actual message is written.
I hope i’ve helped you! Sorry for the late reply!