Surgo
|
  |
| Joined: 11 Jan 2011 |
| Total Posts: 2748 |
|
| |
|
|
| 19 Apr 2014 07:41 PM |
| Use NumPlayers, if anyone posted that before me, then I did not see it. |
|
|
| Report Abuse |
|
|
|
| 19 Apr 2014 07:43 PM |
And to make sure it updates, you can loop it or put it in a function:
while wait(2) do local a = game.Players.NumPlayers if #a==4 then --code end end |
|
|
| Report Abuse |
|
|
| |
|
Surgo
|
  |
| Joined: 11 Jan 2011 |
| Total Posts: 2748 |
|
| |
|
|
| 19 Apr 2014 08:24 PM |
while wait(2) do local t = script.Parent local a = game.Players.NumPlayers if a == 1 then t.Text = 'Activate to 4 players.' else print 'Something went wrong.' end end
Works fine in the form :
ScreenGui
--Frame
>TextLabel |
|
|
| Report Abuse |
|
|
Surgo
|
  |
| Joined: 11 Jan 2011 |
| Total Posts: 2748 |
|
| |
|
Surgo
|
  |
| Joined: 11 Jan 2011 |
| Total Posts: 2748 |
|
| |
|
TxOreo1
|
  |
| Joined: 13 Apr 2014 |
| Total Posts: 34 |
|
|
| 19 Apr 2014 09:27 PM |
| Jimmy's works fine. Where is the path of your textbox or label? |
|
|
| Report Abuse |
|
|
|
| 19 Apr 2014 09:36 PM |
Don't use NumPlayers it glitches to much
#Game.Players:GetPlayers() is how you get the number of players |
|
|
| Report Abuse |
|
|
Surgo
|
  |
| Joined: 11 Jan 2011 |
| Total Posts: 2748 |
|
| |
|
Surgo
|
  |
| Joined: 11 Jan 2011 |
| Total Posts: 2748 |
|
| |
|
|
| 20 Apr 2014 01:49 PM |
NumPlayers isn't glitchy. And that should work. But -
function thisfunction() local a = game.Players.NumPlayers end
is a inside an actual function? If it's a global variable, it may not work as it needs to be 'updated'. |
|
|
| Report Abuse |
|
|
Surgo
|
  |
| Joined: 11 Jan 2011 |
| Total Posts: 2748 |
|
| |
|
FauxHawke
|
  |
| Joined: 08 Jun 2012 |
| Total Posts: 2190 |
|
|
| 20 Apr 2014 02:34 PM |
| for i, v in pairs do(Game.Players:GetPlayers()) |
|
|
| Report Abuse |
|
|
Surgo
|
  |
| Joined: 11 Jan 2011 |
| Total Posts: 2748 |
|
| |
|
|
| 20 Apr 2014 06:08 PM |
for i,v in pairs(game.Players:GetChildren())do -- Do Stuff. end |
|
|
| Report Abuse |
|
|
Surgo
|
  |
| Joined: 11 Jan 2011 |
| Total Posts: 2748 |
|
| |
|
FauxHawke
|
  |
| Joined: 08 Jun 2012 |
| Total Posts: 2190 |
|
|
| 20 Apr 2014 06:56 PM |
| Put "do" before (game.Players:GetPlayers()) |
|
|
| Report Abuse |
|
|
|
| 20 Apr 2014 07:00 PM |
@Above
GTFO your wrong.
go die piece of crap you dont know l;earn pairs idiot FLAME HIM EVERYONE HE GAVE FALSE ADVICE TRYIN TO SOUND SMART! say [i].Agree = true to agree wit meh :D |
|
|
| Report Abuse |
|
|
|
| 20 Apr 2014 07:01 PM |
game:GetService("RunService").RenderStepped:connect(function() _G.Players = game.Players:GetPlayers() end)
Seems to be the most efficient way of getting up to date players. |
|
|
| Report Abuse |
|
|
FauxHawke
|
  |
| Joined: 08 Jun 2012 |
| Total Posts: 2190 |
|
|
| 20 Apr 2014 07:08 PM |
| Saying I suck won't make you better. |
|
|
| Report Abuse |
|
|
FauxHawke
|
  |
| Joined: 08 Jun 2012 |
| Total Posts: 2190 |
|
|
| 20 Apr 2014 07:08 PM |
| Also, chill, I'm just trying to help. The people these days...god dang. |
|
|
| Report Abuse |
|
|
Surgo
|
  |
| Joined: 11 Jan 2011 |
| Total Posts: 2748 |
|
| |
|
|
| 21 Apr 2014 04:08 AM |
Surgo, the last few solutions here are a bit silly. I mean, RunService? You need all this for getting the number of players? xD
Most of these solutions would work perfectly, so I believe the problem is where your script is, how it's ran or something else. |
|
|
| Report Abuse |
|
|