Traitor Glow

I’m looking for a script for glow traitors.
I used this before but it crashes players client


local msg_name = "Halos_inform"

if SERVER then
	util.AddNetworkString(msg_name)
	
	hook.Add("PlayerDeath", "PlayerDeathHalos", function(ply)
		net.Start(msg_name)
		net.WriteEntity(ply)
		net.Send(GetTraitors())
	end)
	
else

	local rolestable = {}

	hook.Add("TTTEndRound", "TTTEndRoundResetTable", function()
		table.Empty(rolestable)
	end)

	hook.Add("TTTBeginRound", "TTTBeginRoundHalos", function()
		for k,v in pairs(player.GetAll()) do
			if v:GetRole() != ROLE_TRAITOR then continue end
			table.insert(rolestable, v) 
		end
	end)
	
	hook.Add("PreDrawHalos", "AddTraitorHalos", function()
		if LocalPlayer():IsActiveTraitor() then
			halo.Add(rolestable, Color(255,50,50), 2, 2, 2, true, true)
		end
	end)
	
	net.Receive(msg_name, function()
		local ent = net.ReadEntity()
		for k,v in pairs(rolestable) do
			if v == ent then
				table.remove(rolestable, k)
			end
		end
	end)
end

Try this script, it’s an old one I made a while back but no one has mentioned any crashes yet. If it does, it most likely has to do with “halo.Add”.

[lua]
if SERVER then
AddCSLuaFile()
util.AddNetworkString(“TTTG.UpdateTraitors”)
hook.Add(“DoPlayerDeath”, “TTTG.DoPlayerDeath”, function(ply, attacker, dmginfo)
if !ply:GetTraitor() then return end

	net.Start("TTTG.UpdateTraitors")
		net.WriteEntity(ply)
	net.Broadcast(GetTraitors())
end)

else
local TraitorsOutline = {}
net.Receive(“TTTG.UpdateTraitors”, function(len, ply)
local deadTraitor = net.ReadEntity()
if !IsValid(deadTraitor) then return end
local key = table.KeyFromValue(TraitorsOutline, deadTraitor)
local traitor = TraitorsOutline[key]
if traitor then
table.remove(TraitorsOutline, key)
end
end)

hook.Add("TTTBeginRound", "TTTG.TTTBeginRound", function()
    table.Empty(TraitorsOutline)
    local ply = LocalPlayer()
    if !ply:GetTraitor() then return end
	
	for k,v in ipairs(player.GetAll()) do
        if v:GetTraitor() and v != ply then
            table.insert(TraitorsOutline, v)
        end
    end
end)

hook.Add("PreDrawHalos", "TTTG.PreDrawHalos", function()
    if !TraitorsOutline or #TraitorsOutline < 1 then return end
    halo.Add(TraitorsOutline, Color(255, 0, 0), 2, 2, 2, false, false)
end)

end
[/lua]