When I access game.Players.MaxPlayers
right away, I expect it to return the Maximum Player Count selected within the place’s configuration page. However, the property only returns 12
no matter what is actually set. It only works if I delay for a frame or so.
This can be reproduced from Studio or a live server. The screenshot below is from a live server, which is simply running this line of code from a server-side script:
print(game.Players.MaxPlayers)
However, my Max Player Count is set to 6
within the place’s configuration:
If I stick a wait()
before printing out MaxPlayers
, it properly prints out 6
. This is arbitrary and I don’t understand why. Is it doing a network call? Is wait()
always going to be enough? How can I guarantee that the value has been set? I can’t just wait for the value to change, because what if the actual max amount is 12?
This is undocumented and unexpected behavior, and thus I am reporting this as a bug.