Tutorial · 10 min read · Updated October 2026
How to make a Roblox idle game with AI, step by step
An idle game (also called incremental) is a clicker that keeps going when you stop clicking: generators earn on their own, numbers grow into the billions, and players come back to collect what they earned while away. The tricky parts are the maths, the huge numbers and offline earnings, which are easy to get wrong and easy to exploit. The seven messages below build one inside your own Roblox Studio place with ForgeBlox (formerly Forge), with all of the maths on the server.
Want a clicker with a sell zone, pets and rebirths? That is the simulator guide. Pets as the main game? The pet simulator guide.
Before you start
- Roblox Studio open on a new Baseplate, saved once so it has a name.
- Studio ▸ Assistant ▸ ⋯ ▸ Manage MCP Servers ▸ Enable Studio as MCP server.
- ForgeBlox Bridge running and paired. Download.
- Model: Sonnet 5.5. Budget about 2,000 to 5,000 credits ($20–50); see pricing.
Message 1: generators and the tick
Build an idle game. ReplicatedStorage/Config/Generators is a ModuleScript
with 6 generators { id, name, baseCost, baseIncome }: Lemonade Stand
(cost 10, income 1/s), then each next one about 12x the cost and 8x the
income. Cost of the next unit = baseCost * 1.15 ^ owned. Server owns
PlayerData (Cash, generator counts). A server loop every 1 second adds
the sum of owned * baseIncome to Cash. A Buy(generatorId) remote
validates the id and the price on the server. A big Click button adds
1 Cash per click, rate-limited to 12 per second. Simple UI listing
generators with owned count, next cost and Buy. Playtest, buy 3 stands,
screenshot, stop.
1.15 per unit is the classic incremental curve: each next unit costs 15% more, so buying stays exciting without running away.
Message 2: big numbers
Add ReplicatedStorage/Shared/Format with format(n): below 1,000 show the
whole number with commas; above, show 3 significant digits with suffixes
K, M, B, T, Qa, Qi, Sx, Sp, Oc, No, Dc. Use it for every number label
in the UI. Add unit tests as a function that prints pass or fail for
999, 1000, 1234567, 1e15 and 1e33, run it with execute_luau, and fix
until all pass.
Luau numbers are 64-bit floats, which comfortably reach 1e300, so you do not need a big-number library for a normal idle game. You do need one formatter used everywhere, or the UI will show "1e+15".
Message 3: offline earnings
When the player leaves, save LastSeen = os.time() with their data. On
join, the server computes away = os.time() - LastSeen, clamps it to
between 0 and 8 hours, and grants income per second * away * 0.5 as
offline earnings. Show a Welcome Back screen with the amount and the time
away. The client never sends a time or an amount. Test by setting
LastSeen to 2 hours ago with execute_luau, rejoining in a playtest, and
screenshotting the screen.
Offline earnings must use the server's clock. A version that trusts the client's clock is a free infinite-money button.
Message 4: milestones and buy-max
Add milestones: at 25, 50, 100 and 200 owned of a generator, its income
doubles. Show progress to the next milestone on each row. Add Buy x1,
x10 and Max buttons; the server computes how many it can afford with the
1.15 geometric series and buys exactly that many. Screenshot a generator
past its first milestone.
Message 5: prestige
Track LifetimeCash on the server. Add a Prestige button that unlocks at
1e9 lifetime: it grants Stars = floor(sqrt(LifetimeCash / 1e9)) minus
Stars already earned, then resets Cash and generators. Each Star gives
+5% income permanently. Show "Prestige for N Stars" live. Playtest a
prestige with execute_luau to set lifetime cash, screenshot after.
The square root keeps each prestige worth doing without the second one being worth a thousand times the first.
Message 6: saving and the 2x pass
Save Cash, LifetimeCash, generator counts, Stars and LastSeen with
DataStoreService: session-locked with UpdateAsync, autosave every 60
seconds, save on leave and BindToClose. Add a 2x Income game pass
(placeholder id) checked on join with UserOwnsGamePassAsync in a pcall
and applied immediately on PromptGamePassPurchaseFinished; it doubles
offline earnings too. Test: buy generators, stop, start, confirm counts
and offline earnings.
Message 7: the security pass
Review every remote on the server: validate types and generator ids,
rate-limit Click and Buy, clamp Cash and LifetimeCash to a sane maximum,
and confirm no client-sent amount or time is trusted. Fix what you find
and summarise the changes.
Numbers that feel good
| Thing | Starting value | Why |
|---|---|---|
| Cost growth | ×1.15 per unit | The genre standard; steady, never stuck |
| Next generator | About 12x the cost, 8x the income | Each new tier is worth saving for |
| Offline earnings | 50%, capped at 8 hours | Rewards coming back without replacing playing |
| First prestige | 1e9 lifetime cash | Reached in the first long session |
What it costs
On Sonnet 5.5 this sequence runs about 2,000 to 5,000 credits ($20–50). Packs are $10 = 1,000 credits, $25 = 2,750, $60 = 7,200 and $150 = 19,500, and credits never expire. Builder ($19/month, 2,000 credits) and Pro ($49/month, 5,600 credits) are optional. Every message shows its price before you send it.
Common mistakes the playtests catch
- Offline earnings from a client-sent timestamp.
- Formatting only some labels, so one screen shows scientific notation.
- A buy-max loop on the server that buys one at a time and stalls at high counts (use the series formula).
- Not saving LastSeen in BindToClose, so a server shutdown gives no offline earnings.
Related guides
- How to make a Roblox tycoon with AI: droppers, conveyors and upgrades in the world.
- How to make a Roblox pet simulator with AI: eggs, rarities and golden pets.
- Game pass and developer product scripts with AI.