Eventive
|
  |
| Joined: 28 Jul 2011 |
| Total Posts: 9827 |
|
|
| 25 Feb 2017 09:31 PM |
before firing a function?
ATR'er since 2013. |
|
|
| Report Abuse |
|
|
|
| 25 Feb 2017 09:33 PM |
if game.Players.NumPlayers>= 2 then --fire function end |
|
|
| Report Abuse |
|
|
|
| 25 Feb 2017 09:33 PM |
Check once?
if game:GetService("Players").NumPlayers < 2 then return end
Yield?
while game:GetService("Players").NumPlayers < 2 do wait() end
|
|
|
| Report Abuse |
|
|
|
| 25 Feb 2017 09:34 PM |
| And if it is supposed to stop when there is only ### player... repeat wait() until ####################### < # |
|
|
| Report Abuse |
|
|
| |
|
|
| 25 Feb 2017 09:42 PM |
@unsub BAd
while game:GetService("Players").NumPlayers < 2 do game:GetService('Players').PlayerAdded:Wait() end
|
|
|
| Report Abuse |
|
|
|
| 25 Feb 2017 09:44 PM |
There's nothing wrong with yielding using wait(). With your method you shouldn't be using a loop. Even then, it may need to run twice because it's possible for a server to exist with 0 players.
If you want to yield, you should use a loop like I demonstrated.
|
|
|
| Report Abuse |
|
|
|
| 25 Feb 2017 09:45 PM |
Actually, I interpreted that wrong. I guess you can use that method if you want to save yourself <=1/30 seconds
|
|
|
| Report Abuse |
|
|
Wrathsong
|
  |
| Joined: 05 Jul 2012 |
| Total Posts: 22393 |
|
|
| 25 Feb 2017 10:27 PM |
I don't get why numplayers is even a thing. just do
#game.Players:GetPlayers()
Ever wanted to learn how to script? Check out my YouTube channel: youtube.com/austintheslayer Want to see me code in action? Follow me on twitch: twitch.tv/austinrblx |
|
|
| Report Abuse |
|
|