Help with custom chat tags for specific players

Hello developers,

Upon editing a custom chat tag script (originally made by TwinPlayzDev_YT) and by adding more UserIds and following his steps on his video, the script seems to only work for one person while the others get an error saying “ServerScriptService.CustomChat:27: attempt to call a nil value”.

I’ve been altering the script (changing “ifs” to “elseifs”, etc) however the same error is still shown in the output.
Any help on this is greatly appreciated!

The edited script below:

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 plrs[plr].UserId == 1695475049 then 
		speaker:SetExtraData("NameColor", Color3.fromRGB(172, 144, 255))
		speaker:SetExtraData("Tags", {{TagText = "Developer", TagColor = Color3.fromRGB(103, 13, 229)}})
		print("Special rank done")
	end
	---
	---
	
	if plrs[plr].UserId == 1854677039 then 
		speaker:SetExtraData("NameColor", Color3.fromRGB(23, 147, 255))
		speaker:SetExtraData("Tags", {{TagText = "Developer", TagColor = Color3.fromRGB(0, 0, 255)}})
		print("Special rank done")
	end
	---
	---
	
	if plrs[plr].UserId == 1216008488 then 
		speaker:SetExtraData("NameColor", Color3.fromRGB(255, 145, 10))
		speaker:SetExtraDat("ChatColor", Color3.fromRGB(255, 178, 110))
		speaker:SetExtraData("Tags", {{TagText = "Owner", TagColor = Color3.fromRGB(255, 0, 4)}})
		print("Special rank done")
	end

	
	
end)

Remove the first line then do this:

1- press CRTL + F
2- enter plrs to first box
3- enter game.Players to second box
4- click replace all

You may have misspelt a part of the script on line 27.

speaker:SetExtraDat(“ChatColor”,Color3.fromRGB(255,178,110))

It’s meant to say

speaker:SetExtraData(“ChatColor”,Color3.fromRGB(255,178,110))

I copied the script into a baseplate and tested it out and it worked for me.

Now it works for the players specified, thank you so much for pointing that out!

1 Like