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

How would I make a chance script? Like, a 0.05 chance that you will spawn with a disease.

Can anyone explain this? I've been trying to figure this out for a while. I know I have to use math.random's

1 comment

0

Post your current attempt

1 answer

✓ Accepted answer

Pretty much, what you have to do is make a math.random that arranges the amount of numbers that you need and then make an if condiction which will decide whether to return true or false. Per example, to make a 10% chance you would do something like this:

local chance = math.random(1, 10)

if chance == 1 then
print("won the 10% chance")
end

just remember that math.random can only give int values, therefore you will need to increase the number range as the percentage lowers

1 comment

0

honestly just do math.random() < 0.05

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