I'm trying to make a chat tag toggling system so for example, when I say "/tog" it turns the chat tag on/off depending if it is already on or off. There was no error, it's in server script service. Please help.
local Players = game:GetService('Players')
local ServerScriptService = game:GetService('ServerScriptService')
local ChatService = require(ServerScriptService:WaitForChild('ChatServiceRunner'):WaitForChild('ChatService'))
ChatService.SpeakerAdded:Connect(function(PlayerName, plr)
local Speaker = ChatService:GetSpeaker(PlayerName)
if (Players[PlayerName].UserId == game.CreatorId) then
Speaker:SetExtraData('NameColor', Color3.fromRGB(255, 255, 255))
Speaker:SetExtraData('ChatColor', Color3.fromRGB(255, 255, 255))
Speaker:SetExtraData('Tags', {{TagText = 'Owner', TagColor = Color3.fromRGB(255, 0, 0)}})
plr.Chatted:Connect(function(msg)
if string.sub(msg,1,4) == "/tog" then
local Value = Instance.new("BoolValue")
if Value.Value == true then
Value.Value = false
if Value.Value == false then
if (Players[PlayerName].UserId == game.CreatorId) then
Speaker:SetExtraData('NameColor', Color3.fromRGB(255, 134, 136))
Speaker:SetExtraData('ChatColor', Color3.fromRGB(255, 134, 136))
Speaker:SetExtraData('Tags', nil)
else
Value.Value = true
if Value.Value == true then
Speaker:SetExtraData('NameColor', Color3.fromRGB(255, 255, 255))
Speaker:SetExtraData('ChatColor', Color3.fromRGB(255, 255, 255))
Speaker:SetExtraData('Tags', {{TagText = 'Owner', TagColor = Color3.fromRGB(255, 0, 0)}})
end
end
end
end
end
end)
end
end)

3 comments
.SpeakerAdded only returns speaker name
Your script didnt work
What's the problem? Did it print any errors? I tested my script and it's all working...