Sorry for the weird question. If you didn’t know, Roblox has a rounding feature that is implemented in the leaderboard. My question is: how do I gain access to it to use it myself, or is that even possible?
I tried searching through CoreScripts, but it just lead me through a rabbit hole of requiring other modules.
Also, I meant the rounding feature that adds a letter to the end of the number, representing which illion it’s on. (such as M, B, T, Qd etc…)
The traditional way (before UICorners existed) was to use a technique called 9-slicing, where parts of an image only scale in certain directions. A plugin called Roundify exists to make this a lot easier. Explained more in detail here
The easiest and most robust way is to use the newly-introduced UICorner. It works on images and gradients, making it infinitely more useful in certain situations, albeit at a minor performance loss.
Aha…it was hard to tell since it’s a vague question. My apologies.
As for simplifying numbers using suffices, there’s no need for a library. Here’s some code I came up with in five minutes:
local N = {"k", "M", "B", "T", "Qd", --[[...for every power of 3]] }
local function format_number(n)
local zeros = math.floor(math.log10(n)) -- counts the number of zeros
local suffix = math.floor(zeros / 3) -- each suffix is every 3rd power
return string.format("%0.1f%s",
n / 10^(suffix*3),
N[suffix] or ""
)
end
format_number(100) -- 100.0
format_number(1337) -- 133.7k
format_number(10000000) -- 10.0M