generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Get Players?

Previous Thread :: Next Thread 
Surgo is not online. Surgo
Joined: 11 Jan 2011
Total Posts: 2748
19 Apr 2014 07:33 PM
[ Content Deleted ]
Report Abuse
JimmyChance is not online. JimmyChance
Joined: 01 Nov 2009
Total Posts: 3681
19 Apr 2014 07:41 PM
Use NumPlayers, if anyone posted that before me, then I did not see it.
Report Abuse
JimmyChance is not online. JimmyChance
Joined: 01 Nov 2009
Total Posts: 3681
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
JimmyChance is not online. JimmyChance
Joined: 01 Nov 2009
Total Posts: 3681
19 Apr 2014 07:45 PM
e.e remove hashtag
Report Abuse
Surgo is not online. Surgo
Joined: 11 Jan 2011
Total Posts: 2748
19 Apr 2014 08:00 PM
[ Content Deleted ]
Report Abuse
JimmyChance is not online. JimmyChance
Joined: 01 Nov 2009
Total Posts: 3681
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 is not online. Surgo
Joined: 11 Jan 2011
Total Posts: 2748
19 Apr 2014 08:46 PM
[ Content Deleted ]
Report Abuse
Surgo is not online. Surgo
Joined: 11 Jan 2011
Total Posts: 2748
19 Apr 2014 09:19 PM
[ Content Deleted ]
Report Abuse
TxOreo1 is not online. 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
Scriptural is not online. Scriptural
Joined: 06 Sep 2013
Total Posts: 2979
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 is not online. Surgo
Joined: 11 Jan 2011
Total Posts: 2748
19 Apr 2014 09:39 PM
[ Content Deleted ]
Report Abuse
Surgo is not online. Surgo
Joined: 11 Jan 2011
Total Posts: 2748
20 Apr 2014 01:42 PM
[ Content Deleted ]
Report Abuse
YaYaBinks3 is not online. YaYaBinks3
Joined: 05 Jun 2009
Total Posts: 2631
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 is not online. Surgo
Joined: 11 Jan 2011
Total Posts: 2748
20 Apr 2014 02:29 PM
[ Content Deleted ]
Report Abuse
FauxHawke is not online. 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 is not online. Surgo
Joined: 11 Jan 2011
Total Posts: 2748
20 Apr 2014 06:06 PM
[ Content Deleted ]
Report Abuse
McChicken72 is not online. McChicken72
Joined: 09 Feb 2013
Total Posts: 1115
20 Apr 2014 06:08 PM
for i,v in pairs(game.Players:GetChildren())do
-- Do Stuff.
end
Report Abuse
Surgo is not online. Surgo
Joined: 11 Jan 2011
Total Posts: 2748
20 Apr 2014 06:31 PM
[ Content Deleted ]
Report Abuse
FauxHawke is not online. FauxHawke
Joined: 08 Jun 2012
Total Posts: 2190
20 Apr 2014 06:56 PM
Put "do" before (game.Players:GetPlayers())
Report Abuse
McChicken72 is not online. McChicken72
Joined: 09 Feb 2013
Total Posts: 1115
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
warspyking is not online. warspyking
Joined: 15 Nov 2011
Total Posts: 13947
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 is not online. 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 is not online. 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 is not online. Surgo
Joined: 11 Jan 2011
Total Posts: 2748
20 Apr 2014 08:02 PM
[ Content Deleted ]
Report Abuse
YaYaBinks3 is not online. YaYaBinks3
Joined: 05 Jun 2009
Total Posts: 2631
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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image