The script is supposed to round a number to the nearest hundredths place. However, it rounds to a whole number, and sometimes that whole number is incorrect.
Can someone please help me?
Here's the code:
local Player = game.Players.LocalPlayer
local Stats = Player.leaderstats
while wait(0.1) do
if Player ~= nil then
if Stats ~= nil then
local Number = math.floor((Stats.Kills.Value/math.max(1,Stats.Deaths.Value)))
function round(x,near)
return math.floor(x/near+.5)*near
end
wait(0.1)
script.Parent.Text = "Ratio: "..round(Number,2)..""
end
end
end

5 comments
Well then. I also asked on the Scripters forum on ROBLOX and the person that helped me out there used non-decimals
math.floor(x*100+.5)/100 also rounds to the nearest hundredth.
It still isn't working for me. Might it possibly be that I'm trying to project the results in GUI in a text box?
You're already rounding down on line 7.
Now it works. Thanks!