Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 8 years ago

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

Log in to vote
0
Answered by 8 years ago
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
0
ill check it out thanks! CarterTheHippo 120 — 8y
0
accept and +1 if it works :) User#5978 25 — 8y
0
What about 67.io? You'll get "67." out. Conversely, .025 will be "025". BlueTaslem 18071 — 8y
0
@BlueTaslem Fixed. User#5978 25 — 8y
Ad

Answer this question