Getting player count from another place for lobby

Im making a blockate-like game and I want users to be able to see the player count in the lobby. Ive tried to use messaging service, but it doesnt work. Can you guys help me with this? Thanks!

Could you explain yourself better please :sweat_smile:

What I think they mean is they want to check the # of people in the lobby when they are in the main game. I’m not sure how to do this tho lol

I’ve check out the game the game reference, and im assuming that this is what your talking about.
image

Now, the way i have gone about doing this was using MemoryStoreService and using the PrivateServerId returned from TeleportService:ReserveServer().

  1. Create a remote function called “GetOnlinePlayers” and a MemoryStoreHashMap called “OnlinePlayers”, this remote could take a parameter called “privateServerID”. The remote would use this parameter as the key to request the online player count from the OnlinePlayersHashMap using MemoryStoreHashMap:GetAsync().
  2. Now, lets assume you have created a way for players to make there own private servers and teleport to it, in a second ROBLOX place you would need to store the players in the server using both Players.PlayerAdded and Players.PlayerRemoving to keep track of the player count, or whatever method you find suitable.
  3. Now you need to update the player count for that server so players in the lobby can see it. You would need the private server id for the specific server, this can be retrieved by using game.PrivateServerId, you would update the OnlinePlayersHashMap using the private server id for the key and the player count for the value BUT it’ll also take a third parameter called “Expiration”, you can find a time suitable for you.(I recommend 1 day, but it has to be in seconds)(Documentation for SetAsync)
  4. Now back in the main game/ lobby, you would create a way so that periodically it updates the player count for each private server created by getting the online player count from the remote function and sending the private server id as an argument.

Now this is just a rough explanation but it should give you the basis to develop a solution