Alternative to player.Chatted for TextChatService?

I’m converting my scripts to be compatible with the new chat system/API, TextChatService over the old legacy chat. However, I cannot figure out an alternative to player.Chatted that will work on a server script for the new system. TextChatService.OnIncomingMessage would be ideal, but it only works on the client (local scripts).

Is there anything that will detect a player’s chat message in a server script for TextChatService? Or am I going to have to do it on the client and then use remote events to send it to the server?

You can use something like this to detect what a player said and get their unfiltered chat message. Not sure if you thought you couldn’t use it still.

game.Players.PlayerAdded:Connect(function(player)
	player.Chatted:Connect(function(msg, rec)
		print(msg)
	end)
end)
1 Like

You can still use Player.Chatted I believe? I don’t think there is anything against that to my knowledge. Why would you not want to use Player.Chatted?

Actually, you’re right. I should’ve looked at the error in my script more closely instead of assuming it wasn’t compatible. I had the exact same code as posted above and it was just giving me a nil value error because the function I called inside of it wasn’t properly defined first. Anyways, it works now. Thank you.

1 Like

for anyone confused .Chatted still works with textchatservice but only in the server and not the client
for the client you can use TextChatService.MessageReceived (this will fire on any message from any player) or TextChatService.SendingMessage (fires only from messages the client sends and is unfiltered)

1 Like