Stopping the player from spawning until a variable is true

As you can see I am already over-doing this as player.CanSpawn would be nil(equal to false) without me setting the variable in PlayerInitialSpawn.
[lua]function GM:PlayerInitialSpawn( player )
player.CanSpawn = false;
player.KillSilent();
end
function GM:PlayerDeathThink( player )
if ( !player.CanSpawn ) then
return true;
else
player:Spawn();
end
end;[/lua]

For some reason it won’t work when I spawn, though when I type kill in console it works just fine…

[editline]Fixed it…[/editline]
Fixed it already. PlayerInitialSpawn is called when the player is spawned. I am killing the player too early. I have set a 2 second simple timer to kill the player.

It works fine now.