Greetings, how can I make math.random create a new number in a period of time?
Fire it again. Math.random will always be different once u fire it. So use a loop.
math.random is always random unless you make it a local in which case you will have to re-set it as math.random every time
It would be something like this.
While True Do
Wait(5) -- Change the wait time to how long you want it.
Local Number = Math.Random(1, 10) -- Change the numbers to what number you want it to generate between.
Print(Number)
End
yes, using “Number” in that loop will always provide the same number because the random has already been chosen. In a new loop it would be a different number, if you place it outside the loop it will be the same number every time unless you use Number = math.random(min,high)
again, then number will be a different number
with “In that loop” i mean tha run through when it has waited 5 seconds and restart the loop it’s a new number
Consider using math.randomseed(os.time())
, which will change the seed function.
You can also use Random | Roblox Creator Documentation, if you’d like, which is approximately the same.
Thank you for your help. Have a nice day.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.