I had a working game chat tag system in place. However, it recently stopped performing how it had before. No code changes. It puzzles me.
Rather than assigning the correct chat tag, if you are supposed to have a tag of any sort, it just puts the “Fan” tag rather than the correct one.
I have tried different iteration methods, various checks, and more already.
The way it works, is there is a module script containing all the chat tags, colors, and requirements for those tags, respectively. The server script reads that module and sets the player’s tag accordingly.
Here is my code:
`
local Players = game:GetService(“Players”)
local ServerScriptService = game:GetService(“ServerScriptService”)
local ChatService = require(ServerScriptService:WaitForChild(“ChatServiceRunner”):WaitForChild(“ChatService”))
local TagTable = require(script:FindFirstChild(“TagModule”))
ChatService.SpeakerAdded:Connect(function(nm)
if Players:FindFirstChild(nm) then
local Player = Players:FindFirstChild(nm)
local Speaker = ChatService:GetSpeaker(nm)
local TagInfo = nil
for Tag, TagData in pairs(TagTable) do
if TagData.Requirement(Player) then
TagInfo = {Tag,TagData.Color}
break
end
end
if TagInfo ~= nil then
Speaker:SetExtraData("Tags", {{TagText = TagInfo[1], TagColor = TagInfo[2]}})
end
end
end)
And here is the module script:
local TagTable = {
[“Founder”] = {
Color = Color3.new(1,0,1),
Requirement = function(Player)
return Player.UserId == 82250066
end
},
["Developer"] = {
Color = Color3.new(1,0,1),
Requirement = function(Player)
return Player:GetRankInGroup(_G.GroupId) == 250
end
},
["Admin"] = {
Color = Color3.new(1,0,1),
Requirement = function(Player)
return Player:GetRankInGroup(_G.GroupId) >= 220
end
},
["Contributor"] = {
Color = Color3.new(1,0.65,0),
Requirement = function(Player)
return Player:GetRankInGroup(_G.GroupId) == 175
end
},
["Moderator"] = {
Color = Color3.new(0.25,0.9,0.25),
Requirement = function(Player)
return Player:GetRankInGroup(_G.GroupId) == 170
end
},
["Sibling"] = {
Color = Color3.new(1,0,0),
Requirement = function(Player)
return Player:GetRankInGroup(_G.GroupId) == 160
end
},
["Tester"] = {
Color = Color3.new(1,1,0.5),
Requirement = function(Player)
return Player:GetRankInGroup(_G.GroupId) == 150
end
},
["Fan"] = {
Color = Color3.new(0.8,0.8,0.8),
Requirement = function(Player)
return Player:GetRankInGroup(_G.GroupId) >= 1
end
},
}
return TagTable
`
Edit: The code is bugged out on my post. Some parts didn’t get counted as code?? Anyways ignore the funky looking text and random 's.
If anyone has any clue as to what could have happened here, please let me know. It would be much appreciated. Thanks for reading, and have a good day!