Can anyone explain this? I've been trying to figure this out for a while. I know I have to use math.random's
✓ ANSWER ACCEPTED
How would I make a chance script? Like, a 0.05 chance that you will spawn with a disease.
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.

1 comment
Post your current attempt