I'm making a private server system, I need a way to get the players in the private server

I want to get the number of players in a reserved server. Should I use MessagingService to accomplish this? I’m having trouble with how to go about making this player count. Any help is appreciated or even examples of how I would do this, thank you.

Player creates server:

  • uses TeleportService:ReserveServer(placeid) and stores the accesscode to the player’s userid.
  • expires in a month (os.time() + seconds_in_month)
    DATASTORE:SetAsync(userid, {
    [“accesscode”] = access_from_reservedserver,
    [“expiration”] = os.time() + seconds_in_month
    })

Player joining other servers:
-Checks if username inputted has a server and it is not expired. If not expired, uses TeleportToPrivateServer(placeid, accesscode_from_players_data, {player})
-Uses :RemoveAsync(player_requested_id) if it is expired

1 Like

You could utilize MemoryStore to keep track of actively running servers.

Memory Store is great for this purpose because you can have a server update the amount of players in it anytime a player connects/disconnects (without hitting the rate limit!) and you can set them to automatically expire.

1 Like

I will definetly read on Memory Stores, I can see it has some stuff I can use. I’ll give you some more feedback after I read on it. Thank you!!

Thank you! This article helped very much