Player Counter GUI, a bit complicated

Hello, I’m currently making something complicated to explain,
It’s a Roblox game, but not really, it’s also about cars and stuff, Anyways.

Everybody in my community BEGGING for a Player counter, because I have like
30-40ish maps, and to find players you gotta shuffle over 40 minutes joining-leaving to see whos in and not.

The game, at least the Menu - HUB, works this way:

  • There’s a Main Place - Main game, that people join, and its basically a ‘Portal’,
    It only consists of GUI elements, and you get to join maps via The main place,

  • Every Map - Place, is actually INSIDE the main place, they aren’t separated games.

Each road category, such as mountain roads, tracks ETC, are selectable within a Gui.

What I would like to make [after 100 Billion failed attempts]
Would be a Player Counter Gui, FOR EX:

You’re at the HUB trynna join some people,
There’s 15 people on the rally map, 10 people on the track map,
I want to make the Gui to show that 10 people are in that map,20 at the other map, while you’re in the MAIN game AKA the HUB-Menu

My friend who isway better at scripting, tried but failed after 3 attempts.
I tired myself failed badly, Used GPT got nothing, I looked for the forum but aside from the fact that I got more confused.
Basically,
People here in the Forum Wanted a GUI that displays the players In the Current game they playing,
I want mine to display the players when you’re at the main game and ONLY there in a UI form, but the players are in separate places INSIDE the main game, like the picture above:


Thank you :hugs:

1 Like

you can use a proxy or use MessagingService to communicate with the main place; in this case requesting the player count.

main place pseudocode:

onMessageReceived(topic = "playerCountUpdate", message) -- equivalent to SubscribeAsync
> -- either use IntValues or use RemoteEvents to update the player count in your gui
> local PlacePlayerCountIntValue = GetPlacePlayerCountReference(message.Data.PlaceId) -- a function to get the int value for the place's player count
> PlacePlayerCountIntValue.Value = message.Data.NewPlayerCount -- set the new player count for the map

map places pseudocode:

-- because messagingservice sometimes doesn't guarantee a message deliver sucessfully, we will use intervals
onPlayerAdded(player) -- game.Players.PlayerAdded
> local CurrentPlayers = Players:GetPlayers()
> local CurrentPlayersCount = #CurrentPlayers

> MessagingService:PublishAsync("playerCountUpdate", {NewPlayerCount = CurrentPlayersCount, PlaceId = game.PlaceId}) -- send the new data with the new player count and the place id
1 Like

Because my brain melting right now :skull:
Could you like be slightly a Bit more specific, or explain a bit more, like give more context?

Where do I put each script etc etc, Ty

1 Like

all of the pseudocode should be a server-script thus should be in ServerScriptService