TextChatService Speaker:SayMessage() equivalent

I am trying to find an equivalent to the Legacy Chat’s Speaker:SayMessage() in the new TextChatService.

My current code is similar to the following:

local ChatService = require(game.ServerScriptService:WaitForChild("ChatServiceRunner"):WaitForChild("ChatService"))
local RemoteEvent = game.ReplicatedStorage.RemoteEvent

RemoteEvent.OnServerEvent:Connect(function(player, msg)
    local speaker = ChatService:GetSpeaker(player.Name)
    if speaker then
        speaker:SayMessage(msg, "All", {})
   end
end)

I want to change this to TextChatService but the ChatServiceRunner module is only available in the old chat. Is there any way to replicate this behavior where the game can send a message in chat on the player’s behalf?

Note: I have looked into ChatService:Chat() but this does not add a message to the chat window so it is not the behavior I am looking for.

Thanks in advance :slightly_smiling_face:

You need to use SendAsync for the channel (only client).
Docs: TextChannel | Documentation - Roblox Creator Hub
Example:

local channel = game.TextChatService:WaitForChild("TextChannels"):WaitForChild("RBXGeneral")
channel:SendAsync("Test message")

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