[Open-Source] NumberFormatter – Auto Format Large Numbers in UI & Leaderstats


Tired of seeing messy, unformatted numbers like 2352422 clutter your game UI?
Say hello to NumberFormatter, a lightweight, open-source module that automatically formats large numbers into readable, compact forms, such as 2.3M, 45.1k, or 1.2B.


:bulb: What It Does:

  • Formats numbers across TextLabels, TextButtons, TextBoxes, and leaderstats
  • Automatically converts numbers like 1000 ➝ 1k, 1500000 ➝ 1.5M, etc.
  • Supports live updating for real-time formatting (perfect for simulators & tycoons!)
  • Customizable settings for suffixes, decimal precision, comma usage, and more
  • Optional custom format function support for advanced control
  • Lightweight and beginner-friendly with a one-line setup

:hammer_and_wrench: Features:

  • :white_check_mark: Supports K, M, B, T, Qa, Qi, and beyond
  • :white_check_mark: Processes all player UIs and leaderstats automatically
  • :white_check_mark: Built-in performance optimization & debounce
  • :white_check_mark: Localization-ready (customizable separators)
  • :white_check_mark: Whitelist/blacklist support to avoid formatting unwanted text

:gear: How to Use:

:file_folder: First, drop the module into ReplicatedStorage or Shared.

local NumberFormatter = require(game.ReplicatedStorage.NumberFormatter)
local formatter = NumberFormatter.new({
    decimalPlaces = 1,
    useCommas = true,
    liveUpdate = true,
})

:package: To auto-format your entire game’s UI and leaderstats:

formatter:applyToGame()

:dart: To manually format a number:

print(formatter:formatNumber(15200)) --> "15.2k"

:control_knobs: To process a specific GUI manually:

formatter:processUIContainer(player.PlayerGui)

:bar_chart: To format a specific player’s leaderstats:

formatter:processLeaderstats(player)

:stop_sign: To stop the live update loop:

formatter:stopLiveUpdate()

:jigsaw: Perfect for:

  • Simulators
  • Tycoons
  • Obby games with leaderboards
  • Any game with currency, XP, or point systems

:link: Download

2 Likes

thanks for informing for help bro

1 Like

would this not go into the resources category? (i dont know how to link to other category)

asides from that i think this is useful if someday i would want to make a game (simulator, etc) with big numbers
1 question: does it manages higher numbers than for example 100Ce (100 centillion) or even higher, 1 millinillion? (10 with around 3,003 zeros)

2 Likes

Good point about the category — Resources or Utility would definitely make sense too, so I might consider moving it there or asking the mods for advice on the best spot.

As for really huge numbers like centillions or beyond, right now the module supports up to “Dc” (Decillion), but it’s designed to be easily extendable. If you want to add suffixes for bigger numbers like centillions or millinillions, you can just add them to the suffixes list in the config. The formatting logic will handle it just fine!.

2 Likes

Question for you all, do leaderstats automatically format huge numbers?

1 Like

I give you information for you Can Roblox Studio process huge numbers like 100Ce or 10^3003?
In Roblox Studio (Lua), numbers are limited by the numeric data type, which uses the IEEE 754 double-precision format.

Approximate maximum value: 1.7976931348623157e+308

This means you can get to numbers like 1e308, but not much beyond.

100 centillions = 1e303, so it’s possible.

10^3003 (millions): :x: This isn’t possible directly; it’s too large for a number.

:white_check_mark: How to work with huge numbers in Roblox Studio?
If you want to process numbers larger than 1e308, you need to use a custom representation. Some ideas:

Use strings to represent huge numbers and create functions that simulate operations like addition, multiplication, etc.

lua
Copy
Edit
local BigNumber = “10^3003”
Separates the number into two parts: base and exponent.

lua
Copy
Edit
local base = 1
local exponent = 3003
– And create your own comparison/addition system.
Big number libraries: Although Roblox Studio doesn’t allow you to import external libraries like other languages, you can create one or adapt it in pure Lua. There are many Lua libraries for “big numbers” on GitHub that you can translate to Roblox.

:rocket: Useful for “incremental” or “simulation” games
Yes, this approach is very common in:

Clicker games

Incremental games

Simulators where the economy grows at astronomical scales

thanks for reply, i asked that question because in one game i made i was struggling with numbers higher than 1e308 (is this written with chatgpt?)

1 Like

thanks for answering the question1!!

1 Like

I don’t copy or steal from chatgpt. My friend is a developer and he’s just making a game. He sends me information via text, and I copy it to help another player and developer. He makes games and copies them. My friends on Give do the same. :woman_facepalming:

1 Like