Hello, i am trying to stop this loop when a table is empty, how would i do this? The way im doing it doesn’t work
local playersInRound = {}
repeat
ti = ti -1
status.Value = ti.." seconds left!"
wait(1)
until ti == 0 or #playersInRound == 0
Hello, i am trying to stop this loop when a table is empty, how would i do this? The way im doing it doesn’t work
local playersInRound = {}
repeat
ti = ti -1
status.Value = ti.." seconds left!"
wait(1)
until ti == 0 or #playersInRound == 0
A very basic way of achieving what you want:
local PlayersInRound = {}
local RoundTime = 60
while #PlayersInRound >= 1 and RoundTime >= 1 do
print(RoundTime .. "s left!")
RoundTime -= 1
wait(1)
end
There are other ways of doing this, but those get more complex.
I haven’t tested this in studio so reply to me if it doesn’t work!