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: How do I count the number of people in a game?

Previous Thread :: Next Thread 
UncleTaz is not online. UncleTaz
Joined: 19 Aug 2009
Total Posts: 12795
19 Jul 2014 02:55 AM
wait(7)

for i,v in pairs(game:GetService("Players"):GetChildren()) do
if #v < 3 then
script.Parent.Text = "Waiting for more people to enter the game"
elseif #v >= 3 then
--running game
script.Parent.Text = "Starting game..."
end
end
Report Abuse
UncleTaz is not online. UncleTaz
Joined: 19 Aug 2009
Total Posts: 12795
19 Jul 2014 02:58 AM
Nvm "NumPlayer" is a property -_-'
Report Abuse
UncleTaz is not online. UncleTaz
Joined: 19 Aug 2009
Total Posts: 12795
19 Jul 2014 03:00 AM
Got it;

if game.Players.NumPlayers < 3 then
script.Parent.Text = "Waiting for more people to enter the game"
elseif game.Players.NumPlayers >= 3 then
--running game
script.Parent.Text = "Starting game..."
end
Report Abuse
TochiWasHere is not online. TochiWasHere
Joined: 13 Mar 2013
Total Posts: 160
19 Jul 2014 04:51 AM
you know there is a shorter way

script.Parent.Text = "Waiting for more people to enter the game"
repeat wait() until game.Players.NumPlayers >= 3
script.Parent.Text = "Starting game..."


-Was Here
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