Higher crit chance with stats

I want to make the chance of getting a crit for damage greater the more of a crit stat someone has. How can I do this?

Like if their crit stat is higher than 2 how can I make it cause more of a chance to be crit?

multiply the crit chance by the crit stat

You can use math.random() to grab a psuedorandom number, I’d get it out of 1, 100.
Then check if the number picked is less than or equal to their crit stat.
You can use this like a percentage, 2 crit stat = 2%
ie.

local rand = math.random(100) -- If one interval is taken then a number is picked between [1, n]

if rand <= crit_stat then
    --critical damage!
else
    --normal damage
end
2 Likes

You would use math.random to get a percentage from 1 to 100 (or really depends on what you want it to be), then check if the percentage is less than the crit stat. return_end1 explained it pretty well.