Hey! I am currently making a server list system for my game. Inside of asset manager and inside of the Player folder I made another place. To get to this place you use TeleportService. On my server list it displays the number of players that are inside of the current server. 0/15. How can I get the number of players inside of that place? Any help would be great! Thanks!!!
This will return the amount of players in the server
local Players = game:GetService('Players')
local PlayerInServer = #Players:GetPlayers()
That’s not what I’m asking, I’m wondering how i can get the number of players inside of a places place.
You could use MessagingService.
When a player loads up your server list, that server (which I’ll refer to as Server A for clarity) will send a message to all existing servers (Server Ns).
When Server Ns receive the message, they’ll get their own player count, and then send it back to Server A, all through MessagingService.
When Server A receives those messages, it’ll display them on the server list.
Just a few pointers:
- You should also include the JobIds of the Server Ns in the message to Server A, so it can identify the server messages.
- There are rate limits to this, so you shouldn’t expect the server list to update itself dynamically. Consider adding a refresh button with your own rate limit logic into the server list, so a player can’t spam refresh and hit a MessagingService rate limit.
This is not quite how I would do it myself - it’s a rudimentary system and probably won’t scale too well, but it’ll work just fine.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.