Player spawn invincibility glitch

In my game mode, when the player spawns, he is given invincibility for 5 seconds.
But currently, If “player1” spawns before “player2’s” invincibility is gone, player2’s invincibility is never taken away…

[lua]
local CLASS = {}

CLASS.DisplayName = “Default Class”
CLASS.WalkSpeed = 400
CLASS.CrouchedWalkSpeed = 0.5
CLASS.RunSpeed = 600
CLASS.DuckSpeed = 0.4
CLASS.JumpPower = 400
CLASS.DrawTeamRing = true

function CLASS:Loadout( pl )

pl:Give( "weapon_laserlaserrifle" )
pl:Give( "weapon_permalaser" )

end

function NoGod( pl )
pl:EmitSound(“beepbeep2.wav”, 100, math.random(99, 105))
pl:GodDisable( )
pl:SetMaterial( “” )
end

function CLASS:OnSpawn( pl )

if ( IsValid( pl.m_entTrail ) ) then
	pl.m_entTrail:Remove()
end

//local AttachmentID = pl:LookupAttachment( "chest" )
//if ( AttachmentID <= 0 ) then AttachmentID = pl:LookupAttachment( "hips" ) end
//if ( AttachmentID <= 0 ) then AttachmentID = 0 end

local AttachmentID = 0

local col = team.GetColor( pl:Team() )

pl.m_entTrail = util.SpriteTrail( pl, AttachmentID, col, true, 48, 4, 10, 0, "trails/plasma.vmt" )
pl.m_entTrail:SetParent( pl )

pl:EmitSound("beepbeep2.wav")
pl:GodEnable()

pl:SetMaterial("models/shiny")
timer.Create( "NoGod", 5, 1, NoGod, pl )

end

player_class.Register( “Default”, CLASS )[/lua]

any Ideas?

It’s because you are making a new timer with the same name every time a player spawns. Just do this.

[lua]
timer.Simple( 5, function()
if IsValid( pl ) then
NoGod( pl )
end
end )[/lua]

thanks a bunch. works fine.