Hi Everyone! I have a shop system for chat tags where players can buy chat tags and they change in chat. However, I don’t know how to make the chat tag change every-time they purchase a new tag. This is an example checking if a dev has a chat tag. Heres my code:
local function setTags(PlrName)
if game.Players:FindFirstChild(PlrName) then
if game.Players[PlrName]:GetRoleInGroup(9150979) == "Developer" or game.Players[PlrName]:GetRoleInGroup(9150979) == "Executive" then
table.insert(other, PlrName)
end
local Speaker = cs:GetSpeaker(PlrName)
for i , v in pairs(other) do
if players[PlrName].Name == v then
if players[PlrName].TagsFolder.selectedTag.Value ~= "" then
local DevTags = {
{TagText = players[PlrName].TagsFolder.selectedTag.Value, TagColor = Color3.fromRGB(255, 255, 255), TagGradient = game.ReplicatedStorage.Tags[players[PlrName].TagsFolder.selectedTag.Value].Gradient}, --1st tag
{TagText = "Developer", TagColor = Color3.fromRGB(255, 255, 255), TagGradient = script.DeveloperGradient}, --2nd tag
}
Speaker:SetExtraData("Tags", DevTags)
else
Speaker:SetExtraData('Tags', {{TagText = "Developer", TagColor = Color3.fromRGB(255, 255, 255), TagGradient = script.DeveloperGradient}})
end
end
end
end
end
cs.SpeakerAdded:Connect(function(player)
setTags(player)
end)
local function onPlayerAdded(player)
player.Chatted:Connect(function()
setTags(player)
end)
end
for _, player in pairs(game.Players:GetPlayers()) do
onPlayerAdded(player)
end
Thanks!