So I made a mini game script that works well, but the problem is, I do not know how to add a countdown timer. Because they both could be moving around doing nothing and the game will never end, basically if a player dies or a player left, the other player would get the victory and the game would end, help? Didn't want to put whole script having you look line to lines, so I added the main part. Usually game does not end until someone dies or someone leaves, but I want to add a timer. Appreciate it!
repeat
wait()
if not Players:FindFirstChild(f1.Name) or (f1.Character.Humanoid.Health <= 0) then
winner = f2
elseif not Players:FindFirstChild(f2.Name) or (f2.Character.Humanoid.Health <= 0) then
winner = f1
end
until winner ~= nil
if winner:findFirstChild("leaderstats") then
if winner.leaderstats:findFirstChild(stat) then
winner.leaderstats[stat].Value = winner.leaderstats[stat].Value + 1
end
end
m.Value = "The winner is... "..winner.Name.."!"
wait(1)
game.Workspace.Crowd1:Play()
wait(10)
game.Workspace.Crowd1:Stop()
wait(1)
winner.Character:BreakJoints()
winner = nil
end
