Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do you code player count?

Asked by 9 years ago

I have a question about coding player count,I used Players.NumPlayer but it says NumPlayer not part of Players so how do I count players?

0
It's NumPlayers. Make sure that you're trying to use the right property. M39a9am3R 3210 — 9y

1 answer

Log in to vote
0
Answered by 9 years ago
--\\ Services //--
local players = game:GetService("Players")
--\\ Values //--
local numPlayers = players.NumPlayers -- does the same thing below but in 1 line of code
local player_tab = players:GetPlayers() -- returns a table/array of players
local numPlayers2 = (#player_tab) -- get the number of players from the table/array
Ad

Answer this question