Chat tags makes people alltalk - TTT

Hi everybody!

I got this script from another thread, and edited it to work with my usergroups and colors. But now for some reason the people who are in the “Regular” group is able to display their chat messages while dead.

here is the lua file

[lua]

local ranks = {
[“superadmin”] = Color(220,20,60),
[“admin”] = Color(255,20,60),
[“moderator”] = Color(238,0,238),
[“regular”] = Color(255,255,255),
[“friend”] = Color(150,255,150),

}

if (SERVER) then
AddCSLuaFile(“chat.lua”)

function CustomChat_ChatMessage(ply, msg, rank, r, g, b)
    umsg.Start("CustomChat_ChatMsg")
        umsg.Entity(ply)
        umsg.String(msg)
        umsg.String(rank)
        umsg.Short(r)
        umsg.Short(g)
        umsg.Short(b)
    umsg.End()
end

function CustomChat_Checker(ply, text, teamonly)
    local group = ply:GetUserGroup()
    local color = ranks[group]
    local txtcheck = string.sub(text,1,1)
    if txtcheck == "/" then
        return text
    else
        return "", CustomChat_ChatMessage(ply, text, "["..string.upper(string.sub(group,1,1))..string.sub(group,2).."]", color.r, color.g, color.b)
    end
end
hook.Add("PlayerSay", "WordCheck", CustomChat_Checker)

else
usermessage.Hook(“CustomChat_ChatMsg”, function(um)
local ply = um:ReadEntity()
local msg = um:ReadString()
local rank = um:ReadString()
local r = um:ReadShort()
local g = um:ReadShort()
local b = um:ReadShort()
chat.AddText(Color(r, g, b), rank, team.GetColor(ply:Team()), " "…ply:Nick(), Color(255,255,255), ": "…msg)
end)
end

[/lua]

I think maybe this line is not working proporly


function CustomChat_Checker(ply, text, teamonly)

Any help will be much apreachiated!