I’m pretty confused about the ChatService module. I’m trying to create 2 different chat channels, 1 dead and 1 living channel. Basically, when a player dies, they are able to talk to other dead players and see the living talk. For the living, they can talk to the other living players, but cannot see the dead players talk. I’ve tried removing the ‘all’ channel but without success as it gives an error stating it doesn’t exist. Removing the player from the living channel and onto the dead channel and trying to make it the main channel, also isn’t working out. I’ve been struggling with this for a while, without any success of finding an answer. I’m only using the bubble chats, not the general chat.
1 Like
Try looking at this:
I’m not sure if it works for bubble chat though
4 Likes
I got very excited to use that idea, but I’m encountering issues with it. When I mute the ‘all’ channel, it seems other channels don’t seem to work whether I’m in them, or not. The chat doesn’t pop up any bubble-chats. Using the ‘SetMainChannel’ function is also a problem for me, as it pops up a blue word stating the channel in the chat, which is removable and just makes the player chat in the ‘all’ channel, which they are muted in and just messes up the system.
local ChatServiceRunner = ServerScriptService:WaitForChild("ChatServiceRunner")
ChatService = ChatServiceRunner:WaitForChild("ChatService")
ChatService = require(ChatService)
local Channel = ChatService:AddChannel("Dead")
Channel.Joinable = false
Channel.Leavable = false
Channel.AutoJoin = false
Channel.Private = true
local Channel = ChatService:AddChannel("Living")
Channel.Joinable = false
Channel.Leavable = false
Channel.AutoJoin = true
Channel.Private = true
local Success, Channel = pcall(ChatService.GetChannel, ChatService, "All")
if not Success then
repeat until ChatService.ChannelAdded:Wait() == "All"
Channel = ChatService:GetChannel("All");
end
Channel.SpeakerJoined:Connect(function(Speaker)
Channel:MuteSpeaker(Speaker)
end)
Remotes.DeathEvent.OnServerEvent:Connect(function(Player)
local Character = Player.Character
local Humanoid = Character.Humanoid
if Humanoid.Health <= 0 then
local Speaker = ChatService:GetSpeaker(Player.Name)
Speaker:JoinChannel("Dead")
Speaker:SetMainChannel("Dead")
local Channel = ChatService:GetChannel("Living")
Channel:MuteSpeaker(Player.Name)
end
end)
2 Likes
Found the issue myself, I changed the original chatmodule into so it doesn’t give this blue channelname word to switch channels.
6 Likes