#decimal numbers doesn't work

13 messages · Page 1 of 1 (latest)

young notch
#

when i try to put decimal numbers in my script it doesn't work, when i change them to full numbers it works. how can i fix it?

local player = game.Players.LocalPlayer
local mouse = player:GetMouse()

local Money = player.leaderstats.Money
local XP = player.leaderstats.Experience

mouse.Move:Connect(function()
    Money.Value = Money.Value + 1
    XP.Value = XP.Value + math.random(0.1, 0.7)
end)
worldly parrot
#

@young notch math.random only returns whole numbers

#

So now it tries to pick a number between 0 and 0

young notch
#

so how do i fix that?

worldly parrot
#

I recommend doing (math.random(1,7)/10)

quartz scarab
#

/10

young notch
#

so it picks between 1,7 and 10?

worldly parrot
#

No

#

It picks between 1 and 7

quartz scarab
#

Pick between 1 and 7 then divide by 10

worldly parrot
#

Then devides it with 10

young notch
#

oh alright

#

thanks for help!