|
| 01 Feb 2014 09:12 PM |
Okay, So I need this chunk of code to be in my game script.
I need my script to check if the number of players in the game is less than 2. If it is, it will say "Must have at least 2 players to play!" And if there are 2 or more players, it continues on with the script. Here is the script I have:
local found = game.Players.NumPlayers if found == <2 then msg.Text = "Must have at least 2 players to play!" else end
|
|
|
| Report Abuse |
|
|
Dinizterz
|
  |
| Joined: 08 Oct 2008 |
| Total Posts: 4193 |
|
|
| 01 Feb 2014 09:15 PM |
if found >= 2, use that instead
"greater than or equal to" is represented by ">=" "less than or equal to" is represented by "<=" "is equal to" is represented by "==" "is not equal to" is represented by "~=" "greater than" is represented by ">" "less than" is represented by "<"
Just a refresher. |
|
|
| Report Abuse |
|
|
Dinizterz
|
  |
| Joined: 08 Oct 2008 |
| Total Posts: 4193 |
|
|
| 01 Feb 2014 09:17 PM |
| Wait, use "if found < 2 then", instead, since if there's not enough players your message will say "need 2 or more players", which is what "if found < 2 then" means. |
|
|
| Report Abuse |
|
|
Tyler2D
|
  |
| Joined: 23 Jan 2014 |
| Total Posts: 2106 |
|
|
| 01 Feb 2014 09:18 PM |
while wait(.25) do local num = game.Players.GetChildren() if #num <2 then game.Workspace.MAINSCRIPT.Disabled = true local m = Instance.new("Message",game.Workspace) m.Text = "Need at least 2 players to start.." elseif #num >= 2 then game.Workspace.MAINSCRIPT.Disabled = false end end
probs very inefficient but meh |
|
|
| Report Abuse |
|
|