getMaxPlayers
Client-side
Server-side
Shared
Manual Review Required
Please finish this page using the corresponding Old Wiki article. Go to Contribution guidelines for more information.
This function returns the maximum number of player slots on the server.
Syntax
int getMaxPlayers ( )Returns
- int: value
Returns the maximum number of players allowed on the server.
Code Examples
shared
This example outputs the current number of players together with the maximum number of players when a player joins.
function showPlayers() outputChatBox("There are "..getPlayerCount().."/"..getMaxPlayers().." players playing.",source) --output a message to the joined player informing the player count and max players.endaddEventHandler("onPlayerJoin",root,showPlayers) --Add an event handler to call the function when a player joins.