Hello! In my game there is a shop where you can buy gear, and chat tags. You can unequip tags and gear so you are not stuck with it. However, I have ran into a slight issue on removing the tag.
This is what happens when it is equipped and then unequipped:
Here is my tag script:
game.Players.PlayerAdded:Connect(function(player)
while true do
wait(5)
if (player:FindFirstChild("Tag")) then
if player.Tag.Value == nil then
local tags = {
{
TagText = player.Tag.Value,
TagColor = Color3.fromRGB(46, 255, 238)
}
}
local ChatService = require(game:GetService("ServerScriptService"):WaitForChild("ChatServiceRunner").ChatService)
local speaker = nil
while speaker == nil do
speaker = ChatService:GetSpeaker(player.Name)
if speaker ~= nil then break end
wait(0.01)
end
speaker:SetExtraData("Tags")
speaker:SetExtraData("ChatColor",Color3.fromRGB(255, 255, 255))
else
local tags = {
{
TagText = player.Tag.Value,
TagColor = Color3.fromRGB(46, 255, 238)
}
}
local ChatService = require(game:GetService("ServerScriptService"):WaitForChild("ChatServiceRunner").ChatService)
local speaker = nil
while speaker == nil do
speaker = ChatService:GetSpeaker(player.Name)
if speaker ~= nil then break end
wait(0.01)
end
speaker:SetExtraData("Tags",tags)
speaker:SetExtraData("ChatColor",Color3.fromRGB(213, 155, 40))
end
end
end
end)
What am I doing wrong? Thanks for any help!