Chat Tags Converting Over From Old Version To New, Not Working

I had this script in my game before I convert over from the OLD chat version “LegacyChatService” to the new one “TextChatService”. Before I made the change, the chat tags worked in the game but now they don’t ever since I changed over.

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

local CommunityGroup = 6878947
local PRCGroup = 4328109
local MainDeveloperGroup = 32737855
local Developers = {'OfficialJellyPlays', 'Nokturat', 'LMVM2041'}

local tagColors = {
	["Developer"] = Color3.fromRGB(195, 76, 78),
	["Owner"] = Color3.fromRGB(12, 144, 200),
	["GameManager"] = Color3.fromRGB(0, 189, 189),
	["QATester"] = Color3.fromRGB(0, 118, 0),
	["PRCOfficial"] = Color3.fromRGB(93, 32, 33),
	["Staff"] = Color3.fromRGB(255, 181, 61)

	local Speaker = ChatService:GetSpeaker(PlrName)
	local Player = Players[PlrName]
	if table.find(Developers, Player.Name) then
		Speaker:SetExtraData('Tags', {{TagText = "Developer", TagColor = tagColors.Developer}})

	elseif Player:GetRankInGroup(MainDeveloperGroup) == 50 then
		Speaker:SetExtraData('Tags', {{TagText = "QA Tester", TagColor = tagColors.QATester}})

		-- PRC Group
	elseif Player:GetRankInGroup(PRCGroup) >= 125 then -- Anything Above and Including Moderator
		Speaker:SetExtraData('Tags', {{TagText = "PRC Official", TagColor = tagColors.PRCOfficial}})

		-- Community Group
	elseif Player:GetRankInGroup(CommunityGroup) == 251 then
		Speaker:SetExtraData('Tags', {{TagText = "Staff", TagColor = tagColors.Staff}})

	elseif Player:GetRankInGroup(CommunityGroup) == 255 then
		Speaker:SetExtraData('Tags', {{TagText = "OMB", TagColor = tagColors.Owner}})

	elseif Player:GetRankInGroup(CommunityGroup) == 253 then
		Speaker:SetExtraData('Tags', {{TagText = "Oli", TagColor = tagColors.GameManager}})

If there is some sort of fix for this, that would be great

This is because the new TextChatService does not support that system. You can use the OnIncomingMessage callback to set up your chat tags.

local tcs = game:GetService("TextChatService")
local players = game:GetService("Players")

--process a message
local function addTag(message:TextChatMessage): TextChatMessageProperties|nil
    --create new properties
    local properties ="TextChatMessageProperties")

    if not message.TextSource then return nil end
    local player = players:GetPlayerByUserId(message.TextSource.UserId)

    --developer tag as example
    if table.find(developers, player.Name) then
        properties.PrefixText = "<font color = \"rgb(255, 170, 0)\">[Developer]</font>"

    elseif something then --continue with your chat tag priorities

    return properties --return the properties to be used

--set the callback - this can only be done once
tcs.OnIncomingMessage = addTag

Hope this helps.

I’d also like to point out with your variable naming that variables starting with a capital letter a typically used for objects and classes, someone else reading it might get confused!

1 Like

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