Undocumented ChatSpeaker "SetMainChannel" method

The ChatSpeaker page on the wiki fails to mention a pretty useful method: SetMainChannel. This function takes one parameter, the name of a chat channel, and in turn forces the speaker to be set to talking in this channel. This is what the team commands use to focus the player into a team chat. It seems useful for some cases and should probably be documented.

Example usage:

local channel = ChatService:AddChannel("Private") -- Assuming ChatService is defined
channel.AutoJoin = false
channel.Joinable = false
channel.Private = true

local speaker = ChatService:GetSpeaker(player.Name) -- Assuming player is defined
speaker:JoinChannel("Private")
speaker:SetMainChannel("Private") -- Causes "[Private]" to appear in the chat bar in blue, and the player will be talking in this channel until they manually stop talking in it.
5 Likes

I’ve added this function to the page. Been a while since I’ve worked on the beast that was the Lua Chat System docs… let me know if there’s any further improvements to be made :grin:

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.