How to script a simple chat tag system in local script only

Hello,
Is it possible to make a chat tag system in a local script only? I want it to be simple.
Thanks

2 Likes

Script is here:

local Players = game:GetService("Players")
local ChatService = game:GetService("ChatService")

Chatservice.SpeakerAdded:Connect(function(Player)
    local Speaked = ChatService:GetSpeaker(Player)
    
    Speaked:SetExtraData("Tags",{{TagText = "WHATEVER TAG YOU WANT",TagColor = Color3.fromRGB("SELECT COLOR")}})
end)

Also here is the script that only for the given UserID:

local Players = game:GetService("Players")
local ChatService = game:GetService("ChatService")

local Tags = {
    ["YOUR USER ID OR GROUP RANK"] = TagText = "WHATEVER TAG YOU WANT",TagColor = Color3.fromRGB("SELECT COLOR")
    
} -- name whatever you want

Chatservice.SpeakerAdded:Connect(function(Player)
    local Speaked = ChatService:GetSpeaker(Player)
    
    if Tags[Player.UserId] then
    Speaked:SetExtraData("Tags",{{Tags[Player.UserId]}})
    end
end)

The script does not work. It says β€œExpected β€˜{’ (to close β€˜{’, got β€˜=’”.

Can you try this:

local Players = game:GetService("Players")
local ChatService = game:GetService("ChatService")

local Tags = {
    ["YOUR USER ID OR GROUP RANK"] = {TagText = "WHATEVER TAG YOU WANT",TagColor = Color3.fromRGB("SELECT COLOR")},
    
} -- name whatever you want

Chatservice.SpeakerAdded:Connect(function(PlayerN)
    local Speaked = ChatService:GetSpeaker(PlayerN)
    local Player = game.Players[PlayerN]
    
    if Tags[Player.UserId] then
    Speaked:SetExtraData("Tags",{Tags[Player.UserId]})
    end
end)
1 Like