Answered by
8 years ago Edited 8 years ago
That's because math.random()
is not truly random. You will want to set math.randomseed()
to a value that will be new or different each time the function is run. To accomplish this, you can set math.randomseed()
to tick()
.
Tick is defined as:
Returns the number of seconds that have elapsed since the UNIX epoch (January 1st, 1970), on your computer.
Since time is constantly moving forward, tick() will give you a different value every time it is used. Therefore, it is a good value to set as math.randomseed().
It would look like this:
You would put this at the beginning of your function, so that is is called prior to math.random()
.
Below is a link to a Roblox Wiki page regarding random numbers. I highly suggest you read it.
Random numbers
I hope this helps!
If this answer helped you or solved your issue, don't forget to upvote and confirm the answer.