New Death error

im getting a error with my Deathrun gamemode for new death heres the code

[lua]function GM:Think()

for _, pl in pairs( player.GetAll() ) do
	pl:AFK()
	if pl:IsAFK() then
		if pl:Team() != TEAM_SPEC then
			pl:SetTeam( TEAM_SPEC )
			pl:Spawn()
		end
	end
end

if team.NumPlayers( TEAM_RUN ) > 0 then
	if team.NumPlayers( TEAM_DEATH ) > 0 then
		local alive = false
		for _, pl in pairs( team.GetPlayers( TEAM_RUN ) ) do
			if pl:Alive() then
				alive = true
				break
			end
		end
		if !alive and RESTARTING < 0 then
			RESTARTING = CurTime() + 5
			for _, pl in pairs( player.GetAll() ) do
				pl:ChatPrint( "Death has triumphed. New Round in 5 seconds." )
			end
		elseif alive then
			alive = false
			for _, pl in pairs( team.GetPlayers( TEAM_DEATH ) ) do
				if pl:Alive() then
					alive = true
					break
				end
			end
			if !alive and RESTARTING < 0 then
				RESTARTING = CurTime() + 5
				for _, pl in pairs( player.GetAll() ) do
					pl:ChatPrint( "The Runners prevailed. New Round in 5 seconds." )
				end
			end
		end
	else
		local alive = false
		for _, pl in pairs( team.GetPlayers( TEAM_RUN ) ) do
			if pl:Alive() then
				alive = true
				break
			end
		end
		if alive and RESTARTING < 0 then
			RESTARTING = CurTime() + 5
			for _, pl in pairs( player.GetAll() ) do
				pl:ChatPrint( "The Runners prevailed. New Round in 5 seconds." )
			end
		end
	end
end
self:NewRound()

end

function GM:NewDeath()
local count = 0
for _, pl in pairs( player.GetAll() ) do
if pl:Team() == TEAM_DEATH then
count = count + 1
elseif pl.ChangeTeam == TEAM_DEATH then
count = count + 1
end
end
if !(count * 7 < team.NumPlayers( TEAM_RUN )) then return end
for _, pl in rpairs( team.GetPlayers( TEAM_RUN ) ) do
if !pl:IsAFK() and _ >= team.NumPlayers( TEAM_RUN ) * 0.5 then
if team.NumPlayers( TEAM_DEATH ) == 0 and RESTARTING < 0 then
RESTARTING = CurTime() + 5
for _, pl in pairs( player.GetAll() ) do
pl:ChatPrint( “Starting a New Round.” )
end
end
pl:SetTeam( TEAM_DEATH )
pl:Spawn()
pl:ChatPrint( “You’ve been randomly selected to be Death” )
break
end
end
self:NewDeath()
end [/lua]

Error: When someone joins i get an error saying GM.Think a nil value then it says “Death has triumphed. New Round in 5 seconds.” and it keeps on repeating that with errors

offering leaked gamemodes will not make people help you anymore
also may help if you give us the error or tell us the problem

He already gave you the error…

any other errors? that error cant be the only one, also you cant create a infinite loop like you do in your NewDeath function

[editline]08:29AM[/editline]

oh damn i missread code a bit but try to call your newdeath function in the gamemodes think function instead

[editline]08:31AM[/editline]

also: is the code supposed to call the NewRound function every frame?

yes the NewRound function is giving me error.