Is there a way to do OnIncomingMessage with LegacyChatService?

I need to use OnIncomingMessage event which involves the TextChatService service. But this event only works if the service is not set to LegacyChatService. But the problem is that I prefer LegacyChatService over the other option. Is there a way to do this event but with LegacyChatService? Thanks.

What specifically are you trying to do? TextChatService and LegacyChatService are very different when trying to modify their base functionality. Specifically, LegacyChatService is much more modular and changes more often must be made in a more specific place (e.g. in a specific ModuleScript) rather than there being a convenient callback like OnIncomingMessage where you can make many adjustments.

Also, is there a reason you prefer LegacyChatService? It’s called “Legacy” for a reason, and you should use the new TextChatService if at all possible. It is more easily customizable and you can likely achieve the same or better results.

I’m using Legacy because I like the design better than the new one
Designs Here

Also what I was trying to do was this:
Here

For LegacyChatService, chat tags aren’t added on the client, but it’s still possible to add them. In a Script in ServerScriptService, the following will add a chat tag with the LegacyChatService.

---> services
local Players = game:GetService("Players")
local ServerScriptService = game:GetService("ServerScriptService")
local ChatService = require(ServerScriptService:WaitForChild("ChatServiceRunner"):WaitForChild("ChatService"))

---> main
ChatService.SpeakerAdded:Connect(function(playerName: string)
    local speaker = chatService:GetSpeaker(player)
    local player = Players:FindFirstChild(playerName)

    if player.UserId == 0 then -- change to your User ID
        speaker:SetExtraData("Tags", { TagText = "DEV", TagColor = Color3.fromRGB(0, 255, 0) })
    end
end)

It should be noted that LegacyChatService is deprecated as per this article so using it in new work is not recommended.

1 Like