Making The Round End When There Are No More "Survivors"

My Script has a timer for intermission and game time and 5 seconds into the round will choose if your murderer or innocent, murderer gets a gun and inno gets nothing, is there a way I can make it so the timer goes to 1 second if there are no innocents left?

whenever someone is killed check if #survivors == 0, if true then that means there are no survivors left and you can then set the timer

1 Like

I saw this on devforums but don’t know what they meant, this is what I did with what I have in locals and what they said but using my survivors {}, i am getting stumped on what to put it in it though so could please go more into depth thiis is what i got ?

On line 73 instead of using wait(115) try

local timeLeft = 115
repeat
    wait(1)
    timeLeft = timeLeft - 1
until timeLeft <= 0

then you can just check for whenever there are no survivors, and set the timeLeft to 0

if #survivors == 0 then
-- everyone died
    timeLeft = 0
end
1 Like

the person alive should be the murderer so should that make it 1? because #survivors and survivors are differen’t things? also i tried it in this manner and it didn’t workCapture did i do something wrong or does it need to be changed?

try and put the if statement inside the repeat until

local timeLeft = 115
repeat
    wait(1)
    timeLeft = timeLeft - 1

    if #survivors == 0 then
        timeLeft = 0
    end
until timeLeft <= 0

if the murderer counts as a survivor then change #survivors == 0 to #survivors == 1

it isn’t giving me any errors but isn’t working, the way you have timeleft to me doesn’t look like it triggers anything it just set the number and counts down “until timeleft <= 0,” so is it just counting down or is it actually doing something the way you have its set up. (not sure if it matters how I put it but here is the way it looks) fe

should timeLeft be set to roundlength? since that is what is actually triggering controlling the round i think

Oh then yea, I don’t know how your game is structured so you have to make minor changes accordingly. Sorry for the late reply I was doing something else