Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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

1 comment

0

Use the condition part of the repeat loop

1 answer

✓ Accepted answer

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

local bruh = game.Players:GetChildren()
if #bruh >= 2 then
	break
end

6 comments

0

Be more descriptive with your answers

0

Nice, it works, thank you!

0

"bruh"

0

lol

0

also use game.Players:GetPlayers() instead

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

This discussion is preserved as it was. New answers, comments, and votes are closed.