So, I know math random selects a random number. But can you set it to select a number within a range you assign? Something like
1 | math random 10 - 20 |
Sorry about my LUA, I'm still learning! Just need this question answered, because i'm confused.
1 | math.random( 10 , 20 ) |
gets a random number from 10 - 20 as you said.
Remember to use . and ()
if this doesn't work then open the output and type this in:
1 | print (math.random( 10 , 20 )) |
Example
01 | Baseplate = game.Workspace.BasePlate |
02 |
03 | while true do |
04 | wait( 1 ) |
05 | ColorstoChooseFrom = math.random( 1 , 3 ) |
06 |
07 | if ColorstoChooseFrom = = 1 then |
08 | Baseplate.BrickColor = BrickColor.new( "Red" ) |
09 | end |
10 |
11 | if ColorstoChooseFrom = = 2 then |
12 | Baseplate.BrickColor = BrickColor.new( "Blue" ) |
13 | end |
14 |
15 | if ColorstoChooseFrom = = 3 then |
16 | Baseplate.BrickColor = BrickColor.new( "Green" ) |
17 | end |
18 | end |
Thats An Exapmple on How Math.Random Works