How would I math.floor with 2 decimals remaining?
I have a math.floor script which rounds the number and adds SI prefixes at the end, but im trying to figure out to leave 2 decimals remaining. For example 1240.1245435, would be 1.24k+, instead of 1k+. Please help!
01 | local plr = game.Players.LocalPlayer |
02 | local lstats = plr:WaitForChild( "leaderstats" ) |
03 | local doritos = lstats:WaitForChild( "Doritos" ) |
04 | local coinslabel = script.Parent |
09 | if doritos.Value > = 1000000000000000000000000000 then |
10 | coinslabel.Text = math.floor(doritos.Value / 1000000000000000000000000000 ) .. "o+ Doritos!" |
12 | elseif doritos.Value > = 1000000000000000000000000 then |
13 | coinslabel.Text = math.floor(doritos.Value / 1000000000000000000000000 ) .. "sp+ Doritos!" |
15 | elseif doritos.Value > = 1000000000000000000000 then |
16 | coinslabel.Text = math.floor(doritos.Value / 1000000000000000000000 ) .. "sx+ Doritos!" |
18 | elseif doritos.Value > = 1000000000000000000 then |
19 | coinslabel.Text = math.floor(doritos.Value / 1000000000000000000 ) .. "qn+ Doritos!" |
21 | elseif doritos.Value > = 1000000000000000 then |
22 | coinslabel.Text = math.floor(doritos.Value / 1000000000000000 ) .. "qd+ Doritos!" |
24 | elseif doritos.Value > = 1000000000000 then |
25 | coinslabel.Text = math.floor(doritos.Value / 1000000000000 ) .. "t+ Doritos!" |
27 | elseif doritos.Value > = 1000000000 then |
28 | coinslabel.Text = math.floor(doritos.Value / 1000000000 ) .. "b+ Doritos!" |
30 | elseif doritos.Value > = 1000000 then |
31 | coinslabel.Text = math.floor(doritos.Value / 1000000 ) .. "m+ Doritos!" |
33 | elseif doritos.Value > = 1000 then |
34 | coinslabel.Text = math.floor(doritos.Value / 1000 ) .. "k+ Doritos!" |
36 | elseif doritos.Value < = 1000 then |
37 | coinslabel.Text = doritos.Value .. " Doritos!" |