Trails and spectators

Hi all. I have a problem with the trails. What do I need to write that the spectators could not fly trails? But only while they are the spectators.


ITEM.Name = "LOL Trail"
ITEM.Enabled = true
ITEM.Description = "Gives you a team colored LOL trail."
ITEM.Cost = 100
ITEM.Material = "trails/lol"

ITEM.Functions = {
        OnGive = function(ply, item)
                item.Hooks.PlayerSpawn(ply, item)
        end,
        
        OnTake = function(ply, item)
                SafeRemoveEntity(ply.Trail)
        end
}

ITEM.Hooks = {
        PlayerSpawn = function(ply, item)
                ply.Trail = util.SpriteTrail(ply, 0, Color(255,255,255,255), false, 15, 1, 4, 0.125, "trails/lol.vmt")
        end
}

if(ply:Team() == TEAM_SPECTATOR) then return end, something like that.

[lua]
hook.Add(“Think”, “Think.RemoveMyTrail”, function()
for k, v in pairs(player.GetAll()) do
if v:Team() == TEAM_SPECTATOR then
if IsValid(v.Trail) then
v.Trail:Remove()
end
end
end
end)

hook.Add(“PlayerDeath”, “PlayerDeath.RemoveMyTrail”, function( p )
if p:Team() == TEAM_SPECTATOR then
if IsValid(p.Trail) then
p.Trail:Remove()
end
end
end)
[/lua]

Thx, helped