Answered by
4 years ago Edited 4 years ago
Okay bro, math.random(a,b)
returns an integer
value.
So fix the code like this:
1 | math.randomseed(os.time()) |
4 | script.Parent.Position = UDim 2. new(math.random( 10 , 68 )/ 1000 , 0 ,math.random( 10 , 20 )/ 1000 , 0 ) |
If you want a more precise method then:
01 | function rand(a,b,precision) |
02 | precision = 10 ^precision |
04 | local function che(x,weight) |
05 | return math.floor(x*( 10 ^weight)) = = x*( 10 ^weight) |
07 | if che(a,w) and che(b,w) then |
09 | return math.random(a*precision,b*precision)/precision |
13 | until che(a,w) and che(b,w) |
18 | return math.random(a*precision,b*precision)/(precision*p) |
With precision before the dot! HOORAY!
P.S. Using my rand
method is more flexible then hard coding. :winks: