The repeat block keeps repeating even though the until block met the condtions

repeat
    print("Waiting...")
    wait(5)
until game.Players.NumPlayers >= 2

In the above line, the code that’s below the repeat block will stop until the number of players in the server have at least 2 players. However, it keeps repeating even though the server has 2 players. Someone help?

repeat
    print("Waiting...")
    wait(5)
until #game.Players:GetChildren() >= 2
1 Like

That is the solution?

Also, why did you add # before game.Players?

:GetChildren() is a table and when you use # before a table it gives the number of elements within the table

1 Like

Okay, I will try it out. I hope it works!

1 Like

Players.NumPlayers is deprecated and shouldn’t be used.

1 Like

Welp, it didn’t work. Still repeating.

image

Can I see the output?

After the MatchManager.preperation, it will print out like this.
Starting intermission…
Intermission over!
Game is starting…
Starting intermission…

The next Starting intermission appears right after the preparation() function.

while #game.Players:GetChildren() < GameSettings.MinimumPlrs do
    print("Starting intermission...")
    wait(GameSettings.Intermission)
end

Try it with this while loop

Your not breaking the while true after you finish, there for it’s jumping back up

-- 0x1 cmp byte ptr [reg+0x2],0x1 ; Compare a boolean to true
-- 0x2 je 0x1

Ok it worked, but now the line starting from Game starting to tping players to the map is keep looping because of while true do, how may I pause this?

Intermission over to the last message of the output is now looping.

break

You need to break after the loop finishes

Okay, but before the script meets the break line, will it pause the rest of the script?

It will only stop the while true loop and continue with the next line

Okay, if I managed to worked everything out with your solution, then I will mark your comment. Thanks for helping!

1 Like