TextChatService and MessageReceived

  1. What do you want to achieve? Keep it simple and clear!
    Connect to the MessageReceived event on the server and have it fire when a player speaks in chat.

  2. What is the issue? Include screenshots / videos if possible!
    The event does not fire on the server but on the client it does.

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    Tried asking in the ROBLOX discord server. Searched wide and far in the wiki and bunch of devforum posts which had no answers.

local TextChatService = game:GetService("TextChatService")
TextChatService.MessageReceived:Connect(function()
	print("hi")
end)

Thanks!

1 Like

You still can do the MessageReceived function in client side, then fire a remote to send it in server side and do your thing. ^^

  • Create a “Remote Event” in Replicated storage, name it “RemoteChat”

Local Script:

local TextChatService = game:GetService("TextChatService")
local Event = game.ReplicatedStorage:WaitForChild("RemoteChat" ,30)

if Event ~= nil then
   TextChatService.MessageReceived:Connect(function()
	   Event:FireServer()
   end)
end

Script:

local Event = game.ReplicatedStorage:WaitForChild("RemoteChat" ,30)

if Event ~= nil then
   Event.OnServerEvent:Connect(function(Player)
      print("Hi ".. Player)
   end)
end

When I run this on the server, it does not print “hi” when I speak in chat. However, when I do it on the client it does.

I tried it and it works for me. I also tried it using NetworkClient and NetworkServer.
Here’s a screenshot:

Here’s my code:


TextChatService.MessageReceived:Connect(function()
    print("hi")
end)

This is a little bit concerning, I shouldn’t need an event for this. Might push this into #bug-reports

1 Like

Update, I can use this to get the message from the server:

GeneralChannel.ShouldDeliverCallback = function(Message: TextChatMessage, TargetTextSource: TextSource)

3 Likes

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