Jump to content

attempt to compare number with nil


NikoLudloow

Recommended Posts

Posted

' attempt to compare number with nil '

Can anyone help me solve this problem? :?

Line:

function math.percentChance(percent, repeatTime) 
  local hits = 0 
  for i = 1, repeatTime do 
    local number = math.random(0, 200) / 2  
    if percent >= number then -- error line 
      hits = hits + 1 
    end 
  end 
  return hits 
end 

Guest Guest4401
Posted

percent is nil. You're not passing a number as first argument while calling the function.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...