Function in round script glitches out and I don't know why

HAHA! Another Kool Killer post? I must be insane! Anyways in my 2012 version of Kool Killer, which I fixed a while ago, A new bug appeared. Basically at the end of the round when the game is checking for how many players are still alive, The function is interfered by another function and the game thinks all of the players are dead and Kool Killer wins. I don’t know how to explain it right now but I know it has to do with the function I posted at the bottom.

Working function (until interfered with):

function CheckFailure()
	if script.SurvivorAmmount.Value > 0 then
		h.Value = h.Value.." Survivors Left alive: "..script.SurvivorAmmount.Value
	elseif script.SurvivorAmmount.Value == 0 then
		alldead = true
		local sounds = h:GetChildren()
		for i = 1,#sounds do 
			sounds[i]:Stop()
		end
		h.Value = ""
		h.RoundTheme4:Play()
		h.Value = "All of the survivors have died."
		wait(5)
		h.Value = "KOOL KILLER recieves 100 points"
		local badgeservice = game:GetService("BadgeService")
		if game.Players:findFirstChild(game.Workspace.KOOLKILLER.Value) then 
			game.Players:findFirstChild(game.Workspace.KOOLKILLER.Value).leaderstats.Points.Value = game.Players:findFirstChild(game.Workspace.KOOLKILLER.Value).leaderstats.Points.Value + 100
			game.Players:findFirstChild(game.Workspace.KOOLKILLER.Value).leaderstats.Wins.Value = game.Players:findFirstChild(game.Workspace.KOOLKILLER.Value).leaderstats.Wins.Value + 1
			badgeservice:AwardBadge(game.Players:findFirstChild(game.Workspace.KOOLKILLER.Value).userId,60508777) 
			print("I awarded UserID: "..game.Players:findFirstChild(game.Workspace.KOOLKILLER.Value).userId.." The badge: 60508777 for ''Killing all survivors!''")
		end
		script.KillCode.Value = true
		wait(5)
		h.Value = "You tried your best survivors! Now gear up for the next round!"
		wait(5)
		if game.Players:findFirstChild(game.Workspace.KOOLKILLER.Value) then 
			game.Players:findFirstChild(game.Workspace.KOOLKILLER.Value).Character.Humanoid.Health = 0
		else
			print("KOOL KILLER LEFT THE GAME")-- :/
		end
		local spwns2 = game.Workspace.LobbyReturn:GetChildren() 
		for i = 1, #people do 
			local item = math.random(1,#spwns2)
			people[i].Character.Torso.CFrame = CFrame.new(spwns2[math.random(1, #spwns2)].Position) 
			people[i].Character.Head.Transparency = 0 
		end
		for i = 1,100 do
			h.Value = "Reloading game: "..i.."%"
			wait()
		end
		if script.SurvivorAmmount.Value == 0 then -- Since the logic of my script apparently doesn't think I'll make it think :P
			local trollingStatement = true
			if trollingStatement == true then
				h.RoundTheme4:Stop()
				CleanTheMess()
				GameRun()
			end
		else
			error("Game_Main's Logic got stupid :P")
		end
	end
end

Broken Function:

game.Players.PlayerAdded:Connect(function(player)	
	player.CharacterAdded:Connect(function(char)
		char.Humanoid.Died:Connect(function()
			for i = 1,#people do
				if people[i]:findFirstChild("Dead") then
					people[i].Dead.Value = true
				end
			end
			if player.OnField.Value == true and player.Dead.Value == false then
				script.Parent.SurvivorAmmount.Value = script.Parent.SurvivorAmmount.Value - 1
			end
		end)
	end)
end)

what is the “people” in the script

try this

for i,v in pairs(people) do
	if if v:FindFirstChild("Dead") then
        v.Dead.Value = true
	end
end

That wasn’t the problem of the function, it’s to do with this part of it

if player.OnField.Value == true and player.Dead.Value == false then
    script.Parent.SurvivorAmmount.Value = script.Parent.SurvivorAmmount.Value - 1
end

is the SurvivorAmmount an int or number value?