Answers for "how to round numbers roblox studio"

1

how to round numbers roblox studio

local roundDecimals = function(num, places) --num is your number or value and places is number of decimal places, in your case you would need 2
    
    places = math.pow(10, places or 0)
    num = num * places
   
    if num >= 0 then 
        num = math.floor(num + 0.5) 
    else 
        num = math.ceil(num - 0.5) 
    end
    
    return num / places
    
end

print(roundDecimals(142.165, 2)) --> 142.17
Posted by: Guest on August-22-2020
0

how to round numbers roblox studio

player.PlayerGui.Stats.Frame.Upgrades.UpgradeSpeed.Text = math.floor((player.Stats.Speed.Value / 100)) * 100
Posted by: Guest on August-21-2020
0

how to round numbers roblox studio

local Number = 0  -- put your number here
TextLabel.Text = string.format('%.2f%% of Speed', Number)
Posted by: Guest on August-22-2020

Browse Popular Code Answers by Language