#Round needs to end when everyone is dead.

28 messages · Page 1 of 1 (latest)

hidden kindle
#

Why don’t you compare a list of all players who were spawned into the game. To a list of those who haven’t died or left. You can do this in multiple ways but this was my first thought. Once everyone is dead or how you want it, make the adjustments to the time.

plush vale
#
players = {player1, player2}

player.Died:Connect(function()
   table.remove(players, player)
  if #players == 0 then 
    -- everyone died
  end
end)
#

this is the basic idea

#

on game start add every player into the table

dense rune
#

Well i tried something with that, but the thing is poeple join midround

#

and there already is a table indicating if they are alive or dead

#

or have escaped/won

plush vale
#

people can join midround?

dense rune
#

yea

plush vale
#

then just add them into the table

dense rune
#

it does

#

the problem is stopping the timer

#

once thay all died

#

the table is fine

plush vale
#

you shouldve had put that into the forum name

dense rune
#

i have a table

plush vale
#

you could add a flag

dense rune
#

and i quote "second script had around 13 versions but this one stays the best, but i need the clock to go to 5 when everyone is dead. and then play the cutscene... can yall help a brother out?"

plush vale
#
local everyoneDead = false

-- in your clock loop
for i = Clock, 1, -1 do
        wait(1)
        if everyoneDead then 
          roundInfo.Timer.Value = 5
          continue 
        end
        roundInfo.Timer.Value = roundInfo.Timer.Value - 1
    end
    wait(1)
dense rune
#

Second script is

function roundModule.Countdown(Status, Clock)
    local roundInfo = game.ReplicatedStorage:WaitForChild("RoundInfo")
    roundInfo.Status.Value = Status
    roundInfo.Timer.Value = Clock
    for i = Clock, 1, -1 do
        wait(1)
        roundInfo.Timer.Value = roundInfo.Timer.Value - 1
    end
    wait(1)
end

if you really want to go for a table there is a table in
Roundinfo.players

modest umbraBOT
#

studio** You are now Level 2! **studio

plush vale
#

cause i aint reading allat

#

also do this

dense rune
#

if that is what u prefer fine

plush vale
#

i dont really get what you are implying

#

you said you got a trouble for your timer

dense rune
#

You already said it yourself you aint reading all of that, so it would indeed be hard for you to get the problem. thank you for your help.