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

Did i use the math.random correctly?

i put this in a script (along with other stuff) and it isnt giving me the money, please tell me why, i think i used the math.random wrong

if stats ~= nil then local cash = stats:findFirstChild("Money") cash.Value = cash.Value + math.random(5,10) end

1 answer

✓ Accepted answer
if stats ~= nil then

local randomNumber = math.random(5, 10)

local cash = stats:FindFirstChild("Money")
cash.Value = cash.Value + randomNumber
end

And yes. You did use it correctly. It's just the way you put it inside the script. Try to use my layout next time.

5 comments

0

thanks!

0

Welcome. Can you accept my question? Thank you :)

0

im sorry, im new to this site, how do i do that?

0

you forgot math.randomseed(tick())

0

Nathan, just hover your mouse over my answer, and you will see "Accept Answer" near the top right corner.

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