I am trying to make separate chat channels for a “Dead” and “Alive” team. This is what I came up with.
local AliveChannel = ChatService:AddChannel(aliveChannel)
AliveChannel.Joinable = false
AliveChannel.AutoJoin = false
AliveChannel.Private = true
AliveChannel.Leavable = false
AliveChannel.WelcomeMessage = "You are Alive."
local DeadChannel = ChatService:AddChannel(deadChannel)
DeadChannel.Joinable = false
DeadChannel.AutoJoin = false
DeadChannel.Private = true
DeadChannel.Leavable = false
DeadChannel.WelcomeMessage = "You are Dead."
function changeChannel(obj)
local Player = Players:FindFirstChild(obj.Name)
if Player then
local Speaker = ChatService:GetSpeaker(obj.Name)
Speaker:LeaveChannel(deadChannel)
Speaker:JoinChannel(aliveChannel)
end
end
This script creates two new channels and once changeChannel(obj)
is called, the speaker is notified of the aliveChannel’s welcome message but doesn’t actually chat in that channel when typing. Instead, the player has to automatically say “/c Alive”, and THEN he can now chat in the private channel. I want to force this behavior automatically.