Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Round ends if 1 player dies?

I have a round script, inside the round script I have a table: alive = {} And when the round starts, it adds all the players to that table.

Then later along the script, I have this code to end it if only 1 or no players are alive:

		for time = 1,120 do
    		wait(1)
			if breakable == true then
				break
			end
			
			if #alive == 1 then
            	breakable = true
			        	end
			if #alive == 0 then
            	breakable = true
			        	end
			
    		for i,v in pairs(game.Players:GetPlayers()) do
       	 		if v.InGame.Value == false then
            		table.remove(alive, i)
        		end
    		end
		end
		

It works, but if there are 3 players in the server, and 1 person dies, it ends the round. How can I fix that?

1 answer

This discussion is preserved as it was. New answers, comments, and votes are closed.