|
| 08 Mar 2017 03:10 AM |
| I've used math.random countless times before but for whatever reason, it wont work even if I only have print(math.random(1, 100)) in a script alone, in an empty workspace, but it keeps printing 89. |
|
|
| Report Abuse |
|
|
|
| 08 Mar 2017 03:16 AM |
| If you are using Roblox Studio to run the script, the outcome never changes. Weird, right? |
|
|
| Report Abuse |
|
|
Soybeen
|
  |
| Joined: 17 Feb 2010 |
| Total Posts: 21462 |
|
|
| 08 Mar 2017 03:18 AM |
You can't just declare it once
saying number = math.random(1,100)
print(number) wait(1) print(number)
will print
> 89 > 89
You need to spice it up. Make a function instead
math.randomseed(tick()) function GenerateRandomNumber(min,max) return math.random(min,max) end
while wait(math.random()) do print(GenerateRandomNumber(1,100)) end
|
|
|
| Report Abuse |
|
|
vlekje513
|
  |
| Joined: 28 Dec 2010 |
| Total Posts: 9057 |
|
|
| 08 Mar 2017 06:32 AM |
| You need to use math.randomseed to have a random seed to generate, otherwise it will always use the same seed and never have a different outcome. |
|
|
| Report Abuse |
|
|
| |
|