Wait Time System - For Theme Park?

Heya! I’m hoping to create a system that does the following:

  • Detects the amount of players in a game
  • For every 5 players in game it’ll +1 number that will display onto a ‘textlabel’ (for example, if 10 players are in game the sign would say “2”, I’m hoping to allow this to update so if 5 people left the game it’d be back to ‘1’ etc…

This system would be used for a theme park game to have a ‘rough estimate’ wait time for a ride depending on the amount of players in-game.

I’m unsure how to go by this and what method is best to achieve what I want.
Thanks! :slight_smile:

2 Likes

You should probably use a player added and player removed events and do the calculations in those functions.

1 Like

You can do #game.Players:GetChildren() to get the number of players, and then divide it by 5 and round it to get the count you want. You can use PlayerAdded and PlayerRemoving to update the text.

1 Like

Yes, have a function that you attach to PlayerAdded and PlayerRemoving.

You can also use CollectionService and tags to update all of your signs.

(Do these things in a server script)

1 Like

Assuming the text label is placed in Starter Gui this is how I’d do it:

  1. Place a server script within server script service
  2. Add player added and player removing functions attached to those events
  3. When they fire, check if the number of players via #game.Players:GetPlayers(), and check if the number is below five
  4. If it’s 5, fire a remote event using FireAllClients() within replicated storage with an argument (what you want to show, in this case 1). Do the same with if there were 10 players.
  5. Place a local script within the text label and listen for the event using OnClientEvent. receive the first parameter and set the text label’s text to the number.

If it’s on a surface gui, Don’t use a remote event and just get a path to it. Once you found it, set it’s text to what you want.

1 Like