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

Why is rounding still giving decimal numbers?

Asked by 7 years ago

Not much to say really but just that when make my server age counter, it is not rounding the numbers, despite me using math.ceil(Number + Closest). anyway I need some hepl with this script!

local TempNumber

game.ServerStorage.ServerAge.Changed:connect(function()
    if game.ServerStorage.ServerAge.Value < 60 then
        script.Parent.Text = game.ServerStorage.ServerAge.Value .. " Seconds"
    else
        if game.ServerStorage.ServerAge.Value < 3600 then
            TempNumber = game.ServerStorage.ServerAge.Value / 60
            script.Parent.Text = math.ceil(TempNumber + 60) .. " Minutes"
        else
            if game.ServerStorage.ServerAge.Value < 86400 then
                TempNumber = game.ServerStorage.ServerAge.Value / 3600
                script.Parent.Text = math.ceil(TempNumber + 3600) .. " Hours"
            else
                if game.ServerStorage.ServerAge.Value < 604800 then
                    TempNumber = game.ServerStorage.ServerAge.Value / 86400
                    script.Parent.Text = math.ceil(TempNumber + 86400) .. " Days"
                else
                    if game.ServerStorage.ServerAge.Value < 2628000 then
                        TempNumber = game.ServerStorage.ServerAge.Value / 604800
                        script.Parent.Text = math.ceil(TempNumber + 604800) .. " Weeks"
                    else
                        TempNumber = game.ServerStorage.ServerAge.Value / 2628000
                        script.Parent.Text = math.ceil(TempNumber + 2628000) .. " Months"
                    end
                end
            end
        end
    end
end)

Thanks!

1 answer

Log in to vote
1
Answered by
farrizbb 465 Moderation Voter
7 years ago
Edited 7 years ago

Im not to sure but ya dont need

math.ceil(nubmer closest) 

just

math.ceil(number)
Ad

Answer this question