How can I make a system that shows all of the active players number?

Greetings, how can I make it so that a player can see how many players are playing at the time?

2 Likes

If you just need the method of HOW for future use in code:

local numberOfPlayers = #game:GetService("Players"):GetChildren()

Using the # operator returns the length of a string or table.

If you want it in a GUI solely for client-side use only, create a GUI customized to your liking, and then add a local script inside of the ‘TextLabel’ with the following code.

--Services
local players = game:GetService("Players")

--Variables
local currentPlayerCount = #players:GetChildren()
local textLabel = script.Parent

while true do
	task.wait(1) --How long you want to wait before each refresh
	currentPlayerCount = #players:GetChildren()
	textLabel.Text = "Player Count: "..currentPlayerCount
end