I want to create a chat speaker and have it speak publicly within the chat. However, this doesn’t seem to work for me.
Initially it worked, however didn’t show up within the chat itself (a print that came with the message showed up regardless). I figured out that the issue was that they were not in the “All” channel, and made according changes. Now the script doesn’t seem to run at all as it doesn’t print, and I’m afraid it’s endlessly waiting for the “All” channel, because it doesn’t seem to get past that point. I’ve already tried to look for solutions to this on the Devforum, but to no avail.
local Chat = game:GetService("Chat")
local CS = require(Chat:WaitForChild('ChatServiceRunner').ChatService)
local name = "CustomSpeaker"
while true do
wait(.5)
local waitchannel = CS.ChannelAdded:Wait()
if waitchannel == "All" then
break
end
end
local speakerr = CS:AddSpeaker(name)
speakerr:JoinChannel("All")
local function SayMSG(speaker, msg, channel)
speaker:SayMessage(msg, channel)
end
while true do
wait(5)
SayMSG(speakerr, "Test message", "All")
print 'spoke'
end