Need help fixing script

Here is the script:

local ChatService = require(game.ServerScriptService:WaitForChild("ChatServiceRunner"):WaitForChild("ChatService"))

local MPS = game:GetService("MarketplaceService")

local groupTags = {
    {"Trainee", 10880254, Color3.new(1, 1, 0.498039), 6, 7} 
    {"Lobby", 10880254, Color3.new(1, 1, 0.498039), 6, 8} 
    {"Creative", 10880254, Color3.new(1, 1, 0.498039), 6, 9} 
    {"Technology", 10880254, Color3.new(1, 1, 0.498039), 6, 10} 
    {"Theatrical", 10880254, Color3.new(1, 1, 0.498039), 6, 251} 
    {"Trainee", 10880254, Color3.new(1, 1, 0.498039), 6, 251} 
}
local nameColour = false 
local chatColour = true 





local function addTag(tag, color, speaker)

    if(tag and color and speaker) then

        speaker:SetExtraData('Tags', {{TagText = tag, TagColor = color}}) 

        if(nameColour) then
            speaker:SetExtraData('NameColor', color) 
        end

        if(chatColour) then
            speaker:SetExtraData('ChatColor', Color3.fromRGB(255, 255, 255)) 
        end
    end
end



ChatService.SpeakerAdded:Connect(function(playerN)
    local speaker = ChatService:GetSpeaker(playerN)
    local player = game.Players:FindFirstChild(playerN)

    if(speaker) then
        local weight = 0
        local chosenTag

        for i, rank in pairs(groupTags) do
            if(player:GetRankInGroup(rank[2]) == rank[5] and rank[4] > weight) then
                weight = rank[4]
                chosenTag = rank
            end
        end

        if(chosenTag) then
            addTag(chosenTag[1], chosenTag[3], speaker) 
        end
    end
end)```
And there is one error in the picture. ![image|549x124](upload://11bycb3izUjjUNw5LdxP5bLAynf.png) so I need help fixing the error.

Here is the picture. image

Please change it like this :wink:

1 Like