I have this simple rank comparing function built into a module, which simply searches through a list of ranks to determine what rank the player needs. I keep getting the error in the title though, and it concerns this function within the module.
function module.ReturnRank(Level)
for i,v in pairs(module) do
if v <= Level then
return i
end
end
end
Actually, I may not actually need that. I beleive your error is due to the variable you have in the line:
for i,v in pairs(module) do
Since you have module as your table to loop over, it is iterating through every element of module, including the function ReturnRank, which is a function value - hence the error "attempt to compare number and function.