|
| 25 Oct 2012 12:14 PM |
Wondering how do I grab all players and put them in a table?
|
|
|
| Report Abuse |
|
|
|
| 25 Oct 2012 12:49 PM |
local HeresYourTableFullOfPlayers = game:service'Players':GetPlayers()
-- der |
|
|
| Report Abuse |
|
|
Fedorakid
|
  |
| Joined: 17 Jul 2010 |
| Total Posts: 7079 |
|
|
| 25 Oct 2012 12:57 PM |
@little, maybe he wants to do something with them? if thats the case OP then:
for _,v in pairs(game.Players:GetPlayers()) do ---stuff, the variable for all the players is v end |
|
|
| Report Abuse |
|
|
Azarth
|
  |
| Joined: 17 Aug 2012 |
| Total Posts: 2760 |
|
|
| 25 Oct 2012 01:10 PM |
--To access all players
for i,v in pairs(game.Players:GetPlayers()) do v.Character.Humanoid.Health = 0 end
--To literally put everyone in a table
plrs = {} for i,v in pairs(game.Players:GetPlayers()) do table.insert(plrs, v) end
|
|
|
| Report Abuse |
|
|
jobro13
|
  |
| Joined: 05 Aug 2009 |
| Total Posts: 2865 |
|
|
| 25 Oct 2012 02:24 PM |
FOO!
Azerth!!!
:GetPlayers() RETURNS a table...
You are just unpacking the table, then repacking it again.
Inefficiency. |
|
|
| Report Abuse |
|
|
nate890
|
  |
| Joined: 22 Nov 2008 |
| Total Posts: 21686 |
|
|
| 25 Oct 2012 02:27 PM |
players = game.Players:GetPlayers()
print(unpack(players)) |
|
|
| Report Abuse |
|
|
| |
|