Madified
|
  |
| Joined: 19 Apr 2011 |
| Total Posts: 5292 |
|
|
| 28 Nov 2014 01:35 AM |
I did something like this
for _, Players in pairs(game.Players:GetPlayers()) do GWin = Players:FindFirstChild("PlayerIsIn") print(#GWin) end |
|
|
| Report Abuse |
|
|
Madified
|
  |
| Joined: 19 Apr 2011 |
| Total Posts: 5292 |
|
| |
|
ALGO160
|
  |
| Joined: 26 Mar 2012 |
| Total Posts: 397 |
|
|
| 28 Nov 2014 02:02 AM |
Invalid Syntax. I don't think there is a "#" operator in Lua.
I love Ruby, and LUA sucks. Let's replace Lua with ruby! |
|
|
| Report Abuse |
|
|
vlekje513
|
  |
| Joined: 28 Dec 2010 |
| Total Posts: 9057 |
|
|
| 28 Nov 2014 02:07 AM |
local function GetNumberOfPlayers() return #game:GetService("Players"):GetPlayers end
print(GetNumberOfPlayers()) |
|
|
| Report Abuse |
|
|
Goulstem
|
  |
| Joined: 04 Jul 2012 |
| Total Posts: 7177 |
|
|
| 28 Nov 2014 04:58 AM |
| print(#game.Players:GetPlayers()) |
|
|
| Report Abuse |
|
|
128GB
|
  |
| Joined: 17 Apr 2014 |
| Total Posts: 8056 |
|
|
| 28 Nov 2014 08:39 AM |
ALGO, Lua does have #
local tab = {1, 2, "lol"} print(#tab) -->3 local s = "Hello!" print(#s) -->6
I think this is what OP wants
local function getPlayersIn(f) local output = {} for _, player in next, game.Players:GetPlayers() do if player:FindFirstChild(f or "PlayerIsIn") then table.insert(output, player) end end return output end
print(#getPlayersIn()) -->number of in players
also if you want players with say, a backpack print(#getPlayersIn("Backpack")) -->number of players with a backpack |
|
|
| Report Abuse |
|
|
Madified
|
  |
| Joined: 19 Apr 2011 |
| Total Posts: 5292 |
|
|
| 28 Nov 2014 01:15 PM |
| Thanks 128GB, you da real mvp |
|
|
| Report Abuse |
|
|