Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why does math.random() always give me zero and never any other number?

Here is what I wrote:

local pos = math.random(0.06,0.65)

3 answers

✓ Accepted answer

math.random() only takes integers. If you wish to have a randomly generated decimal you need to divide the generated integer by a certain number. For example, to get a random decimal from 0.06 to 0.65:

local num = math.random(6, 65) / 100

1 comment

0

please use this, this is correct lol

Your script is correct.

1 comment

0

But it doesn't work it prints out 0 every time

math.Random only supports integers. You can't have decimals.

This discussion is preserved as it was. New answers, comments, and votes are closed.