function RoundHours(playerKey) local unrHours = MinutesBank:GetAsync(playerKey) / 60; local rndHours = nil;
if(string.match(tostring(unrHours), "."))then--If it's an uneven division
local _, lop = string.find(tostring(unrHours), ".");
local strLen = string.len(tostring(unrHours));
if(tonumber(string.sub(tostring(unrHours), lop, strLen)) >= 0.5)then--Round up
rndHours = tonumber(string.sub(tostring(unrHours), 1, lop - 1)) + 1;--ERROR: attempt to perform arithmetic on nil value
else--Round down
rndHours = tonumber(string.sub(tostring(unrHours), 1, lop - 1));
end
end
if(rndHours == nil)then
return 0;
else
return rndHours;
end
end
It says that there's an attempt to perform an arithmetic on a nil value, but I can't figure out where the nil value is. I commented on the line it was on. Thanks in advance!

2 comments
Why arithmetic on a nil value?
Not sure what you mean by that, I just don't know where the nil value is on line 6.