How to change a wait() depending on playercount?

Im using this to get a fair chance for everyone and not have everything spawn either too slow or fast

What is the idea of the game?
Any code we can work from?

wait(1*#game.Players:GetChildren())

1 Like

If you are mean that the amount of seconds you want a wait() to wait just use wait(#game.Players:GetPlayers())

@ToastEngines why would you use 1*…? And it is more useful to use getplayers instead of getchildren since somebody probably added something randoms to the player map\service

We do not know if he wants to wait 1 second per player or 0.1 or any number per player based on the question I assume he has very little understanding of programming by providing a number he can easily guess as to what its for and change it thusly

Why would anyone add an object to the player service?

O yea lol didn’t think about that

Sometimes people do it accidentally idk, but you better be safe then sorry

1 Like

You could use a repeat until function like so:

local players = game.Players:GetPlayers()

repeat
wait(1)
until #players >= 1

This post doesn’t really explain the use case or how you want it to work. Can you explain more in-depth? If you mean you want a wait to be larger depending on the number of players, you could try something like:

wait(#game.Players:GetChildren() / 10)

Or whatever you want.

1 Like