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 » Scripters
Home Search
 

Re: NumPlayers bug

Previous Thread :: Next Thread 
XMegaInfernapeX is not online. XMegaInfernapeX
Joined: 20 Feb 2011
Total Posts: 488
05 Jul 2016 12:06 AM
while true do
print("rekt")
if game.Players.NumPlayers <= 1 then return end


this part of my script breaks.
I want the loop to run forever, but it doesnt b/c the if game.Players.NumPlayers <= 1 then return end line. It runs once and stops.

How to make it so it does the loop, but wait until the number of players is above 1.
Report Abuse
cntkillme1 is not online. cntkillme1
Joined: 16 Feb 2012
Total Posts: 592
05 Jul 2016 12:07 AM
while true do
if game.Players.NumPlayers > 1 then
-- your code
else
game.Players.PlayerAdded:wait() -- yield thread until someone joins to check again
end
end
Report Abuse
CowInAJar is not online. CowInAJar
Joined: 27 Jun 2012
Total Posts: 65
05 Jul 2016 12:44 AM
@Above >1 would make it impossible to print because nothing would be on the server/it would't exist

\\
Report Abuse
CowInAJar is not online. CowInAJar
Joined: 27 Jun 2012
Total Posts: 65
05 Jul 2016 12:47 AM
I read that wrong and put the wrong symbol, I'm stupid... sorry.

\\
Report Abuse
CowInAJar is not online. CowInAJar
Joined: 27 Jun 2012
Total Posts: 65
05 Jul 2016 12:48 AM
Full script

-- Made by CowInAJar

while true do
if game.Players.NumPlayers <= 1 then -- can be >=1 as well
print "rekt"
wait() -- Because crashing isn't fun
else
game.Players.PlayerAdded:wait() -- yield thread until someone joins to check again
end
end
Report Abuse
cntkillme1 is not online. cntkillme1
Joined: 16 Feb 2012
Total Posts: 592
05 Jul 2016 12:53 AM
"-- Made by CowInAJar"
Good way to steal credit moron.

Also no, you can't interchange <= and >=, learn basic algebra.
Report Abuse
iJacobness is not online. iJacobness
Joined: 20 Jan 2014
Total Posts: 4944
05 Jul 2016 12:54 AM
^^^


r+://393244197r+://393244224r+://393244262
Report Abuse
iJacobness is not online. iJacobness
Joined: 20 Jan 2014
Total Posts: 4944
05 Jul 2016 12:54 AM
cow, its hilarious how you even put your credit in a script, either way people are just gonna remove it.


r+://393244197r+://393244224r+://393244262
Report Abuse
CowInAJar is not online. CowInAJar
Joined: 27 Jun 2012
Total Posts: 65
05 Jul 2016 06:40 AM
I do it by habit I know people remove it

\\
Report Abuse
CowInAJar is not online. CowInAJar
Joined: 27 Jun 2012
Total Posts: 65
05 Jul 2016 06:41 AM
Thanks I like sarcastic compliments on theft <3

\\
Report Abuse
CowInAJar is not online. CowInAJar
Joined: 27 Jun 2012
Total Posts: 65
05 Jul 2016 06:42 AM
And technically it could be interchanged it would just have a different result.

\\
Report Abuse
KingJacko is not online. KingJacko
Joined: 20 Jun 2008
Total Posts: 3944
05 Jul 2016 06:43 AM
dont you need a wait() or else it crashes?
Report Abuse
cntkillme1 is not online. cntkillme1
Joined: 16 Feb 2012
Total Posts: 592
05 Jul 2016 06:44 AM
"it would just have a different result."
a _completely_ different result, that the op is not even looking for

And you can't go and blame habit for plagiarism, that's just a pathetic excuse
Report Abuse
cntkillme1 is not online. cntkillme1
Joined: 16 Feb 2012
Total Posts: 592
05 Jul 2016 06:44 AM
"dont you need a wait() or else it crashes?"
I expect him to have one where I put -- your code
Report Abuse
Skellobit is not online. Skellobit
Joined: 13 Apr 2016
Total Posts: 12758
05 Jul 2016 07:22 AM
cow are you AxonMega by and chance?

Formerly ToxicDominator - add 17,509 posts | :(){:|:&};:
Report Abuse
CowInAJar is not online. CowInAJar
Joined: 27 Jun 2012
Total Posts: 65
05 Jul 2016 10:34 AM
No I'm just brain dead

\\
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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