Chat tag script is not working

I would like to get my admin chat tag script working…
The issue is that it does not appear in the chat when I am trying it. I have tried changing lines and fixing the script for about an hour.

The chat tag should appear infront the name as “[ADMIN]”, but it does not seem to work.

local plrs = game.Players
local sss = game.ServerScriptService
local chatService = require(sss:WaitForChild('ChatServiceRunner'):WaitForChild('ChatService'))

chatService.SpeakerAdded:Connect(function(plr)
    
    local speaker = chatService:GetSpeaker(plr)    
    
    if plr.UserId == 584039135 or plr.UserId == 1322163667 or plr.UserId == 361542322 then
        speaker:SetExtraData('NameColor', Color3.fromRGB(255, 12, 203))
        speaker:SetExtraData('ChatColor', Color3.fromRGB(255,220,0))
        speaker:SetExtraData('Tags', {{TagText = 'ADMIN', TagColor = Color3.fromRGB(255,220,0)}})    
        print("Gave an admin special chat tag and chat color!")        
    end
end)

SpeakerAdded returns the name of the speaker, not the player instance, try this

local plrs = game.Players
local sss = game.ServerScriptService
local chatService = require(sss:WaitForChild('ChatServiceRunner'):WaitForChild('ChatService'))

chatService.SpeakerAdded:Connect(function(name)
    local plr = plrs:FindFirstChild(name)
    local speaker = chatService:GetSpeaker(plr)    
    
    if plr.UserId == 584039135 or plr.UserId == 1322163667 or plr.UserId == 361542322 then
        speaker:SetExtraData('NameColor', Color3.fromRGB(255, 12, 203))
        speaker:SetExtraData('ChatColor', Color3.fromRGB(255,220,0))
        speaker:SetExtraData('Tags', {{TagText = 'ADMIN', TagColor = Color3.fromRGB(255,220,0)}})    
        print("Gave an admin special chat tag and chat color!")        
    end
end)

Hello, how are you doing?

SpeakerAdded returns the name of the speaker, not the actual player.
Also, is that being called from a local or a server script?

Did not work, caused an error with ChatService. “lower is not a valid member of Player “Players.MasterTiitus” - Server - ChatService:169”

Doing good but I hope to get this fixed. Also this is being called from a server script.

Is it giving another error at which the script is erroring from your chat tag script? I have never seen that error before

Actually he is doing it right here is a video of a guy using the same method as him

No it is not giving any other error.

How old is that video?
Sometimes one of the things he used may be deprecated.

Tried to modify the script and add some better whitelist as that whitelist did not seem to work.

It was working but the chat tags appeared for everyone so I tried remaking the whitelist system.

Just 7 month a item/function may take more than a year to be deprecated

Try something like this perhaps?

local plrs = game:GetService("Players")
local scriptservice = game:GetService("ServerScriptService")
local chatservice = require(scriptservice:WaitForChild("ChatServiceRunner",10):WaitForChild("ChatService",10))

local whitelist = {
	584039135,
	1322163667,
	361542322
}

chatservice.SpeakerAdded:Connect(function(name)
	local plr = plrs:FindFirstChild(name)
	local id = plr.UserId
	local speaker = chatservice:GetSpeaker(name)
	
	if table.find(whitelist, id) then
		speaker:SetExtraData('NameColor', Color3.fromRGB(255,12,203))
        speaker:SetExtraData('ChatColor', Color3.fromRGB(255,220,0))
        speaker:SetExtraData('Tags', {{TagText = 'ADMIN', TagColor = Color3.fromRGB(255,220,0)}})    
        print("Gave an admin special chat tag and chat color!") 
	end
end)

Also now I see the issue you were having before,

local speaker = chatService:GetSpeaker(plr)  

This was being given a plr rather than the name, it was meant to be

local speaker = chatService:GetSpeaker(name)
2 Likes

Well, I tried it before but it did not work, however now it does work! Thank you a lot.

1 Like

Anytime! if you have anymore issues don’t be afraid to make another post! And I recommend using a whitelist via table like how I did, it’s more organized and doesn’t require a lengthy if statement!

1 Like