Custom TextChannels using TextChatService

So, I’m trying to use Custom TextChannels with TextChatService to see what I can do with it, and how I can Modify it, But I keep coming across the Issue with none of the Text Appearing when I Type and Send something in the Chat, This could be how I have set up the System, which is likely as I’m not the best when it comes to stuff like this, so I could be missing something very Important.

This is the Code on the Server after playing around with some functions,:AddUserAsync() appears to only work on the Server so I made this to see how it would work, It is likely I’m missing something here:

local TxtChatSvc = game:GetService("TextChatService") -- Service
local TestChn = TxtChatSvc.TestChannel -- TextChannel

game.Players.PlayerAdded:Connect(function(p)
    TestChn:AddUserAsync(p.UserId) -- Adds TextSource for Player
end)

But what do I do on the Client? I have tried looking into Documentation about certain stuff like OnIncomingMessage and :SendAsync() to send Messages, but everything I have tried hasnt worked at all, There arent any Events being Fired, or any changes happening When the Player Sends a Message, so I’m not sure what to do now, There might be Something Important that I’m missing and if there is, I would like to know.

As a Side Note: I do not want Code, That is not what this is about, I’m just asking what I should do.

Hey Cairo!

I still haven’t gotten completely used to the TextChatService either. I’m just sending this as an observation.

  • Text source

Players can send messages via TextSource under the condition that CanSend is enabled. It seems reasonable to always use :WaitForChild() on channels and sources.

  • SendAsync()

Only available on client.

  • SendingMessage (event)

Received by the calling client, moments before the server is signalled.

  • ShouldReceiveCallback (function)

Whether other clients should be recipients of the message or not. Determined by the server.

  • MessageReceived (event)

When the client who sent the message receives the server’s response. The previous “placeholder” message is replaced by this updated one.

  • OnIncomingMessage (event)

Fires both on the sender’s and other clients’ end; may only be connected locally. The step where styling can be applied.


→ On all receiving clients.

Very helpful flowchart (In-Experience Text Chat System | Documentation - Roblox Creator Hub).

I know you said you don’t need any code, but I’m sending what I used for repo purposes.

Server
local TextChatService = game:GetService("TextChatService")
local Players = game:GetService("Players")

local customChannel = Instance.new("TextChannel")
customChannel.Name = "CustomChannel"
customChannel.Parent = TextChatService

customChannel.ShouldDeliverCallback = function(message, targetTextSource)
	print("Should deliver callback: "..message.Text)
	return true;
end

customChannel.MessageReceived:Connect(function(message)
	print("Message received: "..message.Text)
end)

Players.PlayerAdded:Connect(function(player)
	customChannel:AddUserAsync(player.UserId)
end)
Client
local TextChatService = game:GetService("TextChatService")

local customChannel = TextChatService:WaitForChild("CustomChannel")
customChannel:WaitForChild(game.Players.LocalPlayer.Name)

customChannel.MessageReceived:Connect(function(message)
	print("[Client] Message received: "..message.Text)
end)

task.wait(1)
customChannel:SendAsync("Bonjour")

Side note: Interestingly, this doesn’t work if the custom channel is placed into TextChannels.

1 Like

If you’d like, you can upload an rbxl of what you have so far and I can diagnose.