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: Random

Previous Thread :: Next Thread 
TameDrone is not online. TameDrone
Joined: 09 Dec 2010
Total Posts: 1006
28 Dec 2011 01:48 PM
To make something randomly happen would it be:

Math.Random()?
Report Abuse
TameDrone is not online. TameDrone
Joined: 09 Dec 2010
Total Posts: 1006
28 Dec 2011 01:48 PM
Without the question mark at the end?
Report Abuse
ggfunny1234 is not online. ggfunny1234
Joined: 09 Jul 2010
Total Posts: 3432
28 Dec 2011 01:51 PM
You have to specify what is going to 'randomly happen'.

Such as a random brickcolor, random part, etc..
Report Abuse
L2000 is not online. L2000
Joined: 03 Apr 2008
Total Posts: 77448
28 Dec 2011 02:07 PM
It should be math.random(). I don't think it works if you have either word as starting with a capital.

What that does is return a random number, specified by the first and second parameters in the brackets. For example, math.random(5, 10) would return a random number between five and ten. Then, you can use if's to have that as a larger random effect.
Report Abuse
TameDrone is not online. TameDrone
Joined: 09 Dec 2010
Total Posts: 1006
28 Dec 2011 02:16 PM
math.random(5, 10)


Wouldn't that make it to where it either picks 5 or 10 rather than a number between them?
Report Abuse
ggfunny1234 is not online. ggfunny1234
Joined: 09 Jul 2010
Total Posts: 3432
28 Dec 2011 02:17 PM
It could pick 5 or 10, but it would most likely pick a number between the two.
Report Abuse
TameDrone is not online. TameDrone
Joined: 09 Dec 2010
Total Posts: 1006
28 Dec 2011 02:19 PM
What if I want it to be either 5 or 10, but no number between them?
Report Abuse
ggfunny1234 is not online. ggfunny1234
Joined: 09 Jul 2010
Total Posts: 3432
28 Dec 2011 02:20 PM
If your using math.random(5, 10) you wouldn't be able to control whether it picked a number between them or not.

The only way to do that is to do math.random(9, 10)

^
Or something in that format.
Report Abuse
TameDrone is not online. TameDrone
Joined: 09 Dec 2010
Total Posts: 1006
28 Dec 2011 02:32 PM
Ok then how would I make it pick one out of the two numbers, 5 or 10 if I only wanted one of those numbers to picked?
Report Abuse
ggfunny1234 is not online. ggfunny1234
Joined: 09 Jul 2010
Total Posts: 3432
28 Dec 2011 02:34 PM
print(5)
print(10)

:P

You can't do what your asking with math.random
Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
28 Dec 2011 02:36 PM
Put them in a table. Randomly pick one out of the table.

~ [I don't script scripts; I script IMPORTED scripts.] [The inner machinations of my mind are an enigma.] ~
Report Abuse
TameDrone is not online. TameDrone
Joined: 09 Dec 2010
Total Posts: 1006
28 Dec 2011 02:40 PM
So there's no way I can make it randomly pick one of those two different numbers?
Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
28 Dec 2011 02:40 PM
Like I said, put them in a table. ​>.<

~ [I don't script scripts; I script IMPORTED scripts.] [The inner machinations of my mind are an enigma.] ~
Report Abuse
RATEXmegaGAMER is not online. RATEXmegaGAMER
Joined: 10 Dec 2010
Total Posts: 4046
28 Dec 2011 02:43 PM
local number = math.random(10) <= 5 and 5 or 10
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