Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Make number only go up to a tenth of a percent. Any help?

Is there a way of getting a number to only go to a tenth of a percent. I have this leaderboard with your kd in it and if its something like 23k/3d its 7.66666667, is there a way of making it so it makes it 7.7 instead?

Here is my script:

wait(6)
local player = game.Players.LocalPlayer
local death = player.playerstats.deaths
local kill = player.playerstats.kills
while true do
	wait()
	script.Parent.Text = kill.Value/death.Value
end

1 answer

✓ Accepted answer
local player = game.Players.LocalPlayer
repeat wait() until player.Character
local death = player.playerstats.deaths
local kill = player.playerstats.kills

function tenth(number)
snum = tostring(number)
endnum = 0
if snum:find(".") then
found=snum:find(".")
snum:sub(1,found+1)
end
return tonumber(snum)
end


end
while true do
    wait()
    script.Parent.Text = tenth(kill.Value/death.Value)--this should round the number to the tenth!
end

4 comments

0

ill check it out thanks!

0

accept and +1 if it works :)

0

What about 67.io? You'll get "67." out. Conversely, .025 will be "025".

0

@BlueTaslem Fixed.

This discussion is preserved as it was. New answers, comments, and votes are closed.