Pra evitar esses erros no calculo, você pode fazer uma verificação nas kills/deaths. E para funcionar com números fracionados use a função math.round.
Um código de exemplo:
local kills, deaths = 1, 0
print( math.round( getPlayerRatio( kills, deaths ), 2 ) ) --> 0
kills, deaths = 13, 6
print( math.round( getPlayerRatio( kills, deaths ), 2 ) ) --> 2.16
function getPlayerRatio( kills, deaths )
return (kills == 0 or deaths == 0) and 0 or (kills / deaths)
end
-- math.round(valor, casas_decimais)
function math.round(number, decimals, method)
decimals = decimals or 0
local factor = 10 ^ decimals
if (method == "ceil" or method == "floor") then return math[method](number * factor) / factor
else return tonumber(("%."..decimals.."f"):format(number)) end
end