How would I go about formatting text, like turning “12,500” into “12.5K?”
kozak456pl
(FrancoFontana)
July 17, 2022, 7:05pm
2
local Input = 1321312312
if Input < 1e6 and Input >= 1e3 then
local text = tostring(Input/1e3):sub(1,5) .. "K"
elseif Input < 1e9 and Input >= 1e6 then
local text = tostring(Input/1e6):sub(1,5) .. "M"
end
you can use something like this
1 Like
4SHN
(EatTheLocalLibrarian)
July 17, 2022, 7:10pm
3
there are some public resources on that
This is an all-in-one number formatting module designed for displaying numbers in a more user-friendly way.
Why this module?
Aside from being the more known module (with over 100 likes), this is a solid tested module with many features included. Whether you insert a number large enough that some other number formatting module/snippets breaks, or you insert negative numbers or infinity, this module accounts for it.
As this is a module, you do not have to copy and paste any snippets, but you do…
General notice:
This module may not work as well as you might want it to. While using this module, I have found certain issues that can be annoying to work around at times. While the metatables can help out, when using more complicated methods of storing data, such as using a table and sending that table to the client, the metatables will most likely not be carried over to the client, so you’ll need to convert the numbers on the client using number_module.new(number). Issues like these are why …
https://devforum.roblox.com/search?q=number%20suffix%20%23resources%3Acommunity-resources
1 Like