Round System Not Working After Player Killed

Ok so I have already posted about this issue earlier here, but it’s still just not working at all. The idea of this is that when the player gets spawned in the round starts after a 20 second intermission, but when the player dies during the round and respawns, the round does not want to start at all. I know this is a logical error because there’s no errors in the output, but I’m really just fed up at this point on how it’s not working. If you guys can figure out the issue please let me know :pray:

--//variables
local RF = game:GetService("ReplicatedFirst")
local RS = game:GetService("ReplicatedStorage")
local run = game:GetService("RunService")
local players = game:GetService("Players")
local zombs = RS:WaitForChild("Dummies")
local event = RS:WaitForChild("roundEvent")
local deathMsg = RS:WaitForChild("deathMsg")
local round = RS:WaitForChild("round").Value
local dumNum = RS:WaitForChild("dumNum").Value
local startTime = 30
local interlude = 20
local inRound = false
local match = true
local dead = false
local win = false
local peds = game.Workspace:WaitForChild("Peds"):GetChildren()

players.PlayerAdded:Connect(function(plr)
	local gui = plr:WaitForChild("PlayerGui")
	local UI = RF.MainUI:Clone()

	UI.Parent = gui
	
	--//spawning the player
	RS.spawnPlr.OnServerEvent:Connect(function(plr)
		plr:LoadCharacter()
		match = true
	end)
	
	plr.CharacterAdded:Connect(function(char)
		print("character added working")
		local wins = plr.leaderstats:WaitForChild("Wins")
		local points = plr.leaderstats:WaitForChild("Points")
		
		--//starting game
		plr.CharacterAppearanceLoaded:Connect(function()
			RS:WaitForChild("ammo"):FireClient(plr)
			local hum = char:WaitForChild("Humanoid")
			dead = false
			UI.zombsLeft.Text = ""
			
			while dead == false and match == true do
				local shopModel = RS.Shop.Models.tempShop:Clone()
				wait()
				if plr:HasAppearanceLoaded() then
					--// loads temporary shop for player
					shopModel.Parent = game.Workspace
					task.wait(interlude)
					shopModel:Destroy()
					
					round += 1
					event:FireAllClients(round, inRound)

					--//spawns in zombies
					for i = 0, dumNum-1, 1 do
						local randTime = math.random(1,5)
						local wTime = randTime / 10
						local clone = zombs.Dummy:Clone()
						print(wTime)
						wait(wTime)
						clone.Parent = game.Workspace.Peds
						local rand = math.random(1, 5)

						if round >= 7 then
							local tanky = zombs.Tanky:Clone()

							if rand == 3 then
								tanky.Parent = game.Workspace.Peds
								clone:Destroy()
							end
						elseif round >= 3 then
							local speedy = zombs.Speedy:Clone()

							if rand == 1 then
								speedy.Parent = game.Workspace.Peds
								clone:Destroy()
							end
						end
					end
					if hum.Health <= 0 then				
						match = false
						inRound = false
						round = 0
						event:FireAllClients(round)
						task.wait(2)
						points.Value = 0
						for _,v in pairs(game.Workspace.Peds:GetChildren()) do
							v:Destroy()
						end
						startTime = 30
						dumNum = 10
						dead = true
						break
					end

					--//makes player in round and increases amount of zombies for next round
					inRound = true
					event:FireAllClients(round, inRound)
					dumNum += 3
					
					
					if inRound == true and dead == false then
						
						--//checks again if player has died during round
						
						for i = startTime, 0, -1 do
							peds = game.Workspace.Peds:GetChildren()
							if inRound == true and dead == false then
								UI.zombsLeft.Text = "Zombies left: "..#peds
							
								if peds == {} then
									inRound = false
									event:FireAllClients(round, inRound)
									win = true
									break
								end

								if hum.Health <= 0 then				
									match = false
									inRound = false
									round = 0
									event:FireAllClients(round)
									task.wait(2)
									points.Value = 0
									for _,v in pairs(game.Workspace.Peds:GetChildren()) do
										v:Destroy()
									end
									startTime = 30
									dumNum = 10
									dead = true
									break
								end
							end
							wait(1)
						end
						
						while not (#peds == 0) do
							peds = game.Workspace.Peds:GetChildren()

							event:FireAllClients("Over Time")
							wait()
							if #peds == 0 then
								inRound = false
								event:FireAllClients(round, inRound)
								win = true
								break
							end
							
							UI.zombsLeft.Text = "Zombies left: "..#peds
						end
						
						if #peds == 0 then
							inRound = false
							event:FireAllClients(round, inRound)
							win = true
							UI.zombsLeft.Text = ""
						end

						if inRound == false and dead == true then
							break
						else
							inRound = false
							event:FireAllClients(round, inRound)
							win = true
						end
					end
					
					--//increases amount of time per round and wins
					if win == true then
						startTime += 15
						wins.Value += 1
						win = false
					end

				end
			end
		end)
	end)
end)

Thanks,
dza