Help With ChatTag

Hey Guys ,
I am a new roblox developer , I tried to make a chat tag , but the chat tag didn’t work and I didn’t got any error with the output

My Code :

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

ChatService.SpeakerAdded:Connect(function(Player)
	local Speaker = ChatService:GetSpeaker(Player)
	if Player.UserId == 2666421392 then
		Speaker:SetExtraData("Tags", {{TagText = "Developer", TagColor = Color3.fromRGB(181, 46, 222)}})
	end
end)

SpeakerAdded returns the name of the speaker that has been added, you’re trying to get a UserId from a string basically, just do game:GetService("Players")[Player].UserId in this case

That’s why the chat tag didn’t work . Thanks

1 Like

Please mark their reply as a solution so that others can see it’s been solved

1 Like

ChatService also has a :GetPlayer() method for getting the player instance.

1 Like