I'm trying to make a game where the round ends after five minutes or after everyone but one player's score is 0, then identify that player as the winner.
this is a timer:
local players = {}
game.ReplicatedStorage.RemoteEvents.GAMETIMER.OnClientEvent:Connect(function()
local sec = 0
local min = 5
while wait(1) do
sec = sec - 1
if sec <= 0 then
sec = 59
min = min - 1
end
if sec <= 9 and min <= 9 then
script.Parent.Text = min..":0"..sec..""
elseif min <= 9 then
script.Parent.Text = min..":"..sec..""
end
if min <= 0 and sec <= 0 then
game.ReplicatedStorage.Bindables.End:Fire()
break
else
for _,v in pairs(game.Players:GetPlayers()) do
if v.leaderstats.Lives.Value == 0 then
table.insert(players,v)
-- if all but one player's Lives are 0 then
game.ReplicatedStorage.Bindables.End:Fire()
end
end
end
end
end)
please help
