|
| 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 |
|
|
|
| 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
|
  |
| 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
|
  |
| 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
|
  |
| 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 |
|
|
|
| 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 |
|
|
|
| 05 Jul 2016 12:54 AM |
^^^
r+://393244197r+://393244224r+://393244262 |
|
|
| Report Abuse |
|
|
|
| 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
|
  |
| 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
|
  |
| Joined: 27 Jun 2012 |
| Total Posts: 65 |
|
|
| 05 Jul 2016 06:41 AM |
Thanks I like sarcastic compliments on theft <3
\\ |
|
|
| Report Abuse |
|
|
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
|
  |
| Joined: 20 Jun 2008 |
| Total Posts: 3944 |
|
|
| 05 Jul 2016 06:43 AM |
| dont you need a wait() or else it crashes? |
|
|
| Report Abuse |
|
|
|
| 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 |
|
|
|
| 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
|
  |
| 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
|
  |
| Joined: 27 Jun 2012 |
| Total Posts: 65 |
|
| |
|