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: HELP! I need help to make this script!!

Previous Thread :: Next Thread 
FallenTacoz is not online. FallenTacoz
Joined: 05 Aug 2013
Total Posts: 328
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 is not online. 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 is not online. 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 is not online. 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
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