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)