Sorry for the scuffed title, but what i'm trying to do here is pick a random number that isn't a whole number, i checked the wiki and stuff and apparently math.random only produces a number that is a unit of 1, for example, 0,1,2,3,4,5 are whole numbers and 0.5,1.5,2.5,3.5 are not whole numbers.
local Pos = math.random(0.02,0.897)
i did this but of course the number was only ever Zero, (because none of these numbers are higher than 1) so i'm kinda stuck here, this is very important to my game so if anyone can help it'd be really appreciated
The number generated by math.random()
is always an integer, so if you want a floating-point number (a.k.a a decimal) you would have to perform some math.
To get a random number from 0.02 to 0.897 as according to your code, do math.random(20, 897)
and divide that number by 1000 (not 100). This will move the decimal point back three spaces. Here is what the code would look like:
local Pos = math.random(20, 897) / 1000
That's basically it.
local Pos = math.random(20, 897) / 100
that would be your answer, just dont use decimals in it, its really stupid but this is roblox so expect it