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: My last noob question, sorry for my spam threads.

Previous Thread :: Next Thread 
superspy468 is not online. superspy468
Joined: 29 May 2009
Total Posts: 53408
16 Jul 2014 04:46 PM
I want test to be < to 3.
But I get errors, how do I make this work?

local test < (1+2)
if test == 1 then
print ("True")
elseif test == 2 then
print ("False")
elseif test == 3 then
print ("Unknown")
end
Report Abuse
CodyTheBuildingKid is not online. CodyTheBuildingKid
Joined: 13 Dec 2011
Total Posts: 4399
16 Jul 2014 04:48 PM
local test = (1+2) --you can only define variables by =
if test > 3 then
test = test - 1
print(test)
end

Maybe that's what you want?
Report Abuse
superspy468 is not online. superspy468
Joined: 29 May 2009
Total Posts: 53408
16 Jul 2014 04:50 PM
Oh, I think I got it it.
So you can't have you're output state two if statements, right?

local test = (1+2)
if test < 3 then
print ("True or False")
elseif test == 3 then
print ("Equal")
end
Report Abuse
CoolioTree is not online. CoolioTree
Joined: 26 Dec 2012
Total Posts: 2509
16 Jul 2014 04:52 PM
You need to define an absolute value to the variable since a computer is dumb and needs you to tell it what to do.
Report Abuse
superspy468 is not online. superspy468
Joined: 29 May 2009
Total Posts: 53408
16 Jul 2014 04:53 PM
Okay, thanks again. :P
Report Abuse
CoolioTree is not online. CoolioTree
Joined: 26 Dec 2012
Total Posts: 2509
16 Jul 2014 04:54 PM
Math.random () could help with what you want to do. Search it on the wiki.
Report Abuse
superspy468 is not online. superspy468
Joined: 29 May 2009
Total Posts: 53408
16 Jul 2014 04:55 PM
I've seen scripts with that before, does that just output a random if value?
Report Abuse
islandmaker2012 is online. islandmaker2012
Joined: 07 Nov 2012
Total Posts: 9327
16 Jul 2014 04:56 PM
num = math.random(1,3)--will pick a number between one and 3
Report Abuse
superspy468 is not online. superspy468
Joined: 29 May 2009
Total Posts: 53408
16 Jul 2014 04:58 PM
I saw the (), I think that's a function.
I haven't got to those yet though.
Report Abuse
islandmaker2012 is online. islandmaker2012
Joined: 07 Nov 2012
Total Posts: 9327
16 Jul 2014 04:59 PM
math.random is a function, which returns a number between startnumber and endnumber

math.random(startnumber,endnumber)
Report Abuse
superspy468 is not online. superspy468
Joined: 29 May 2009
Total Posts: 53408
16 Jul 2014 04:59 PM
Thanks, I'm sure that I'll get to those soon. :P
Report Abuse
CoolioTree is not online. CoolioTree
Joined: 26 Dec 2012
Total Posts: 2509
16 Jul 2014 05:00 PM
Functions are awesome! And the best part is that they're easy to learn about! :D
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