Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why is speakerObj not joining the ChatChannel when InternalAddSpeaker() is called?

Asked by 4 years ago
Edited 4 years ago

Recently, I have made a custom chat using the Default Chat's scripts with ChatChannel functionality.

To make players be able to chat in a ChatChannel, they have to join the channel. But when InternalAddSpeaker() is called, the speakerObj won't join the channel.

Code:

local Players = game:GetService("Players")
local ChatService = require(game.Chat.ChatServiceRunner.ChatService)
local ChatChannel = require(game.Chat.ChatServiceRunner.ChatChannel)
local ParticipantManagement = require(script.Parent.Parent.Parent.ParticipantLabelModules.ParticipantManagement)
local Participant = require(script.Parent.Parent.Parent.ParticipantLabelModules.Participant)
local ChatGroupName = script.Parent.Parent.Parent.Content.ChatGroupSettings.GroupName.GroupFrame.TextFrame.GroupName
local WindowTitle = script.Parent.Parent.Parent.Parent.ChatGroupMessaging.Header.WindowTitle

script.Parent.Activated:Connect(function()
    local channelObj = ChatService:AddChannel(ChatGroupName.Text)
    script.Parent.Parent.Parent.Visible = false
    script.Parent.Parent.Parent.Parent.ChatGroupMessaging.Visible = true
    WindowTitle.Text = ChatGroupName.Text

    local Details = Participant:GetParticipantList()
    local Count = Participant:GetParticipantCount()
    local speakerObj = ChatService:GetSpeaker(Details.No1)

    channelObj:InternalAddSpeaker(speakerObj)
end)

-- MacFan2006

Output:

ServerScriptService.ChatServiceRunner.Speaker:85: Speaker is not in channel "Group"

Any fixes? Thanks! :)

Answer this question