Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to break loop if is just 2 players on the server?

Asked by 4 years ago

Hello! I maked this simple timer but I don't how can I break this loop if will be just 2 players on the game. Anyone know what can I add?

while true do
    t = 10
    repeat
        t = t-1
        s.Value = "Time Left: " ..t
        wait(1)
    until t==0
end
0
Use the condition part of the repeat loop hiimgoodpack 2009 — 4y

1 answer

Log in to vote
-2
Answered by
Benbebop 1049 Moderation Voter
4 years ago
Edited 4 years ago

Place all of this in the spot where you want to break.

local bruh = game.Players:GetChildren()
if #bruh >= 2 then
    break
end
0
Be more descriptive with your answers maumaumaumaumaumua 628 — 4y
0
Nice, it works, thank you! ThadonROOX 47 — 4y
0
"bruh" fanofpixels 718 — 4y
0
lol 123nabilben123 499 — 4y
View all comments (2 more)
0
also use game.Players:GetPlayers() instead 123nabilben123 499 — 4y
0
Downvoted because this doesn't use the condition part of the repeat loop, bad variable names, not actually solving the question (it will exit the loop if there's more than 1 player and not just if there's 2 players), and usage of GetChildren instead of GetPlayers hiimgoodpack 2009 — 4y
Ad

Answer this question