Hi. I have a chat tag system script in ServerScriptService. It works fully but with the new TextChatService update that is in April 2025, I have to convert because my script only supports LegacyChatService. I’m looking for some help on changing my script. All help appreciated thanks.
Script:
local ServerScriptService = game:GetService("ServerScriptService")
local ChatServiceRunner = ServerScriptService:WaitForChild("ChatServiceRunner")
local ChatService = require(ChatServiceRunner.ChatService)
local GroupID = 33796958 -- Replace 16885155 with your actual Group ID
local adminCT = Color3.fromRGB(235, 211, 158)
local function GetGroupId(player)
local success, result = pcall(function()
return player:GetRankInGroup(GroupID)
end)
return success and result or nil
end
local GroupTags = {
[255] = { -- Owner
ChatColor = adminCT,
Tags = { -- Starts the Tags List (chat tags will be contained in this table)
{ -- Starts tag 1
TagText = "Owner", -- Change this to the word(s) that you want in the Chat Tag
TagColor = Color3.fromRGB(177, 7, 0) -- Change this to the Color you want the Chat Tag to appear in
}, -- Ends tag 1
}, -- Ends Tags List
}, -- Ends RoleID
[240] = { -- OVERSEER
ChatColor = adminCT,
Tags = { -- Starts the Tags List (chat tags will be contained in this table)
{ -- Starts tag 1
TagText = "OVERSEER", -- Change this to the word(s) that you want in the Chat Tag
TagColor = Color3.fromRGB(250, 23, 0) -- Change this to the Color you want the Chat Tag to appear in
}, -- Ends tag 1
}, -- Ends Tags List
}, -- Ends RoleID
[239] = { -- developer
ChatColor = adminCT,
Tags = { -- Starts the Tags List (chat tags will be contained in this table)
{ -- Starts tag 1
TagText = "Developer", -- Change this to the word(s) that you want in the Chat Tag
TagColor = Color3.fromRGB(132, 0, 250) -- Change this to the Color you want the Chat Tag to appear in
}, -- Ends tag 1
}, -- Ends Tags List
}, -- Ends RoleID
[100] = { -- staff
ChatColor = adminCT,
Tags = { -- Starts the Tags List (chat tags will be contained in this table)
{ -- Starts tag 1
TagText = "Staff", -- Change this to the word(s) that you want in the Chat Tag
TagColor = Color3.fromRGB(255, 195, 66) -- Change this to the Color you want the Chat Tag to appear in
}, -- Ends tag 1
}, -- Ends Tags List
}, -- Ends RoleID
[90] = { --tester
ChatColor = adminCT,
Tags = { -- Starts the Tags List (chat tags will be contained in this table)
{ -- Starts tag 1
TagText = "Tester", -- Change this to the word(s) that you want in the Chat Tag
TagColor = Color3.fromRGB(0, 1, 182) -- Change this to the Color you want the Chat Tag to appear in
}, -- Ends tag 1
}, -- Ends Tags List
}, -- Ends RoleID
[10] = { --verified
ChatColor = Color3.new(0, 0.934569, 1),
Tags = { -- Starts the Tags List (chat tags will be contained in this table)
{ -- Starts tag 1
TagText = "Verified", -- Change this to the word(s) that you want in the Chat Tag
TagColor = Color3.fromRGB(0, 99, 255) -- Change this to the Color you want the Chat Tag to appear in
}, -- Ends tag 1
}, -- Ends Tags List
}, -- Ends RoleID
[1] = { -- tryhard
Tags = { -- Starts the Tags List (chat tags will be contained in this table)
{ -- Starts tag 1
TagText = "Fan🌎", -- Change this to the word(s) that you want in the Chat Tag
TagColor = Color3.fromRGB(245, 232, 1) -- Change this to the Color you want the Chat Tag to appear in
}, -- Ends tag 1
}, -- Ends Tags List
}, -- Ends RoleID
} -- Ends GroupTags
local function handleSpeaker(speakerName)
local speaker = ChatService:GetSpeaker(speakerName)
local player = speaker:GetPlayer()
if player then
local groupRankID = GetGroupId(player)
if groupRankID then
local extraData = GroupTags[groupRankID]
if extraData then
for key, value in pairs(extraData) do
speaker:SetExtraData(key, value)
end
end
end
end
end
ChatService.SpeakerAdded:Connect(handleSpeaker)
for _, speakerName in pairs(ChatService:GetSpeakerList()) do
handleSpeaker(speakerName)
end
local toggles = {}
local function toggle(speakerName)
local speaker = ChatService:GetSpeaker(speakerName)
local player = speaker:GetPlayer()
if player then
local groupRankID = GetGroupId(player)
if groupRankID and GroupTags[groupRankID] then
if not toggles[groupRankID] then
toggles[groupRankID] = true
speaker:SetExtraData('Tags', {})
speaker:SetExtraData('ChatColor')
else
toggles[groupRankID] = false
speaker:SetExtraData('Tags', GroupTags[groupRankID].Tags)
speaker:SetExtraData('ChatColor', GroupTags[groupRankID].ChatColor)
end
end
end
end
game.Players.PlayerAdded:Connect(function(plr)
plr.Chatted:Connect(function(msg)
if msg:lower() == "/e tag" then
local groupRankID = GetGroupId(plr)
if groupRankID >= 90 then -- Replace 255 with the required Rank ID
toggle(plr.Name)
else
print("Player is not High Enought Rank To use /e !ToggleChatTag")
end
end
end)
end)
game.Players.PlayerRemoving:Connect(function(plr)
local groupRankID = GetGroupId(plr)
if groupRankID and toggles[groupRankID] then
toggles[groupRankID] = nil
end
end)
for i, plr in pairs(game.Players:GetPlayers()) do
plr.Chatted:Connect(function(msg)
if msg:lower() == "/e tag" then
local groupRankID = GetGroupId(plr)
if groupRankID >= 90 then -- Replace 255 with the required Rank ID
toggle(plr.Name)
else
print("Player is not High Enought Rank To use /e !ToggleChatTag")
end
end
end)
end