Chat Tags not working

Probably my first time making a chat tag but I don’t know why it isn’t working.

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

game.Players.PlayerAdded:Connect(function(player)
	if player:IsInGroup(4952707) then
		local tag = 
			{
				{
					TagText = "Staff",
					TagColor = Color3.fromRGB(100, 100, 100)
				}
			}
		local speaker = nil
		while speaker == nil do
			speaker = ChatService:GetSpeaker(player.Name)
			if speaker ~= nil then break end
			wait(0.1)
		end
		speaker:SetExtraData("Tags", tag)
	end
end)

There aren’t any errors

Using this as a reference, I revised your code to used the SpeakerAdded event.

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

ChatService.SpeakerAdded:Connect(function(PlayerName)
	local Player = Players:FindFirstChild(PlayerName)
	local Speaker = ChatService:GetSpeaker(PlayerName)
	if Player:IsInGroup(4952707) then
		local tag = {
			{
				TagText = "Staff",
				TagColor = Color3.fromRGB(100, 100, 100)
			}
		}
		Speaker:SetExtraData("Tags", tag)
	end
end)
1 Like

Just tested and it works, great help!

3 Likes