How to create seperate chats

I’m making a game where I want the players to have a separate chat for their team and a global chat. Something like the chat in Ultimate Driving.

I used this devforum thread to create a new channel, but the behavior isn’t exactly how I want it.

The Code
local ServerScriptService = game:GetService("ServerScriptService")
local ChatService = require(ServerScriptService:WaitForChild("ChatServiceRunner"):WaitForChild("ChatService"))
local ChannelName = "TestChat"


local Channel = ChatService:AddChannel(ChannelName)
Channel.Joinable = false
Channel.AutoJoin = false


ChatService.SpeakerAdded:Connect(function(PlayerName)
    local Player = game.Players:FindFirstChild(PlayerName)
    if Player and Player.Name == "MayorGnarwhal" then -- just for testing
		print("Join the channel!")
        local Speaker = ChatService:GetSpeaker(PlayerName)
        Speaker:JoinChannel(ChannelName)
    end
end)


Channel.SpeakerJoined:Connect(function(speakerName)
	Channel:SendSystemMessage(speakerName .. " has joined the channel.")
end)

The player does join the team chat, but I don’t like how the player must click the channels “tag” to access it (basically how the whisper system works).

I want something like the chat in Ultimate Driving, where there are tabs that show the different chats the player is in. Is this some sort of custom chat or is there some setting somewhere in the default Chat Modules that will allow me to do this?

That’s a natively supported Lua Chat System feature. It’s done with a chat setting called ShowChannelsBar and you can enable it much like the way you toggle different chat types. If you’d like, my tutorial can help you do that without forking the ChatSettings module:

1 Like