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: math.random questions

Previous Thread :: Next Thread 
jd678 is not online. jd678
Joined: 18 Apr 2008
Total Posts: 11529
10 Sep 2013 04:05 PM
i want to do math.random(10,50)

but I only want it to do 10,20,30,40, and 50. not the ones in between.

can i do this?



--@Jd678RBLX
Report Abuse
DoctorDestiny is not online. DoctorDestiny
Joined: 27 Dec 2012
Total Posts: 221
10 Sep 2013 04:07 PM
math.random(10,20,30,40,50)
Report Abuse
jd678 is not online. jd678
Joined: 18 Apr 2008
Total Posts: 11529
10 Sep 2013 04:08 PM
oh, derp thanks



--@Jd678RBLX
Report Abuse
jd678 is not online. jd678
Joined: 18 Apr 2008
Total Posts: 11529
10 Sep 2013 04:10 PM
nope

wrong number of arguments



--@Jd678RBLX
Report Abuse
Saviorofdragons is not online. Saviorofdragons
Joined: 10 Jan 2013
Total Posts: 489
10 Sep 2013 04:11 PM
local numbers={10,20,30,40,50}
print(math.random(1,#numbers)

That should work
Report Abuse
Saviorofdragons is not online. Saviorofdragons
Joined: 10 Jan 2013
Total Posts: 489
10 Sep 2013 04:13 PM
Oh woops forgot to end the print brackets on it. Just put an extra ) on the end of that print statement
Report Abuse
jd678 is not online. jd678
Joined: 18 Apr 2008
Total Posts: 11529
10 Sep 2013 04:15 PM
nope

that gets a number between 1, and #numbers

so like, 2 could be an output



--@Jd678RBLX
Report Abuse
jd678 is not online. jd678
Joined: 18 Apr 2008
Total Posts: 11529
10 Sep 2013 04:16 PM
could i do

math.random(10,50)

and round it up?



--@Jd678RBLX
Report Abuse
jd678 is not online. jd678
Joined: 18 Apr 2008
Total Posts: 11529
10 Sep 2013 04:20 PM
nvm i figured out a way to do it

local num = math.random(1,10)
local realnum = num * 10

lol



--@Jd678RBLX
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