Economy design: sources, sinks and the spreadsheet

Balance a live Roblox economy before writing shop code: build a multi-archetype sources-and-sinks spreadsheet, compute Expected Value, control inflation and simulate 30 days in Luau.

Project lesson, about 75 minutes, 6 steps

By the end you can

  • Model currency sources and sinks across casual, regular and grinder player types in a spreadsheet
  • Estimate event impact with Expected Value (EV) and spot virtual inflation before shipping
  • Separate soft earned currency, premium purchases and event currency without breaking the core shop
  • Simulate 30 days of Beacon Yard's economy in Luau and tune its sinks until every player type is healthy

Before this: Prototype fast: paper, greybox, blockout, Monetization: products, passes, subscriptions, economy, Analytics: funnels, economy events, retention

1Mapping Beacon Yard's real faucets and drains

Roblox's virtual economy guide frames balance around four habits: data-driven content, resource planning, impact estimation, and resource sinks1. Before inventing prices, audit every place your server creates coins (sourcesCurrency source (faucet)Any mechanic that creates currency and adds it to a player's wallet.Think of it as a tap pouring water into the player's tub.) and destroys coins (sinksCurrency sinkAny mechanic that permanently removes currency from circulation.Think of it as the drain at the bottom of the tub.).

Look at Beacon Yard's main coin faucet in CoinService.luau at m14-ship:

		-- The Scrap Rush event multiplies every pickup. It is 1 when off.
		local amount = math.floor(base * FlagService.coinMultiplier() + 0.5)
		local balance = DataService.addCoins(player, amount)
		Analytics.coinSource(player, amount, balance, Enum.AnalyticsEconomyTransactionType.Gameplay.Name, "CoinPickup")
		Analytics.onboarding(player, "FirstCoin")
Figure 1.1

And look at the only coin sinks in ShopService.luau:

	Analytics.coinSink(player, Config.SPEED_PRICE, balance, Enum.AnalyticsEconomyTransactionType.Shop.Name, "Speed")
	Analytics.onboarding(player, "FirstPurchase")
	feedback(player, "buy", "Speed")
end
 
local function buyShield(player: Player)
	if shieldCharges(player) >= 1 then
		feedback(player, "deny", "Shield already up")
		return
	end
	if not DataService.trySpend(player, Config.SHIELD_PRICE) then
		feedback(player, "deny", "Not enough coins")
		return
	end
	player:SetAttribute("ShieldCharges", 1)
	local balance = DataService.get(player).coins
	Analytics.coinSink(player, Config.SHIELD_PRICE, balance, Enum.AnalyticsEconomyTransactionType.Shop.Name, "Shield")
	Analytics.onboarding(player, "FirstPurchase")
	feedback(player, "buy", "Shield")
Figure 1.2

Count every tap and drain at m14-ship:

  • Four sources: coin pads (5 * FlagService.coinMultiplier()), drill survival (+10 in RoundService), crawler bounty (+8 in CrawlerService), and the Robux Coin Pack (+50 in MonetizationService).
  • Two sinks: Speed (25 coins, once forever) and Shield (40 coins, only when ShieldCharges == 0).
Stored dataVirtual economy sources and sinks is a bathtub with taps and a drain.
In the pictureIn Roblox
The tapsCurrency sources: coin pads, survival bonuses, crawler bounties and Coin Packs
The water levelCoins sitting unspent in a player's saved profile
The drainCurrency sinks: upgrades, shields, wrench repairs and event shop items

See the whole analogy cast

Think of a virtual economy as a bathtub with taps (sources) and a drain (sinks). When taps stay wide open and the drain closes after 65 coins, water spills over the rim: that surplus is virtual inflationVirtual inflationA runaway surplus of currency when sources outpace sinks across player wallets.Think of it as a tub filling faster than it drains until coins spill over the rim..

Think of it as A bathtub with taps and a drain

Beacon Yard currency flowGameplay sources (pads, drill survival, crawlers) and the paid Coin Pack feed the Profile Wallet, which drains into one-time sinks (Speed, upgrade tiers, Rebuild) and repeatable sinks (wrench repair, shields).sourceIAPtiersupkeepSources (taps)pads, drill, crawlerPaid sourceCoin Pack (+50)Profile Walletdata.coinsOne-time sinksSpeed, tiers, RebuildRepeatable sinksRepair, Shields
Figure 1.3. Healthy economies pair every faucet with permanent and repeatable sinks.

Which of these create new coins (call Analytics.coinSource) in Beacon Yard at m14-ship?

  1. Picking up a coin pad in CoinService (+5 times FlagService.coinMultiplier)
  2. Surviving a 40-second drill in RoundService (+10)
  3. Defeating a scrap crawler in CrawlerService (+8)
  4. Buying Speed at the Quartermaster in ShopService
Answer

Picking up a coin pad in CoinService (+5 times FlagService.coinMultiplier); Surviving a 40-second drill in RoundService (+10); Defeating a scrap crawler in CrawlerService (+8). Pads, survival bonuses and crawler bounties all inject new coins into wallets. Buying Speed calls Analytics.coinSink and removes 25 coins.

Open this step in lesson mode · Link to this step · This confused me

2The spreadsheet: model by player archetype

Stored dataRemember: Virtual economy sources and sinks is a bathtub with taps and a drain.

One mistake sinks beginner spreadsheets: computing a single "average player." Beacon Yard's economy.json (you add it in this lesson's BuildAlong) models three player types instead. A Casual player runs 3 drills a day and grabs 4 pads a drill, a Regular runs 8 drills with 6 pads, and a Grinder runs 20 drills with 8 pads. If you tune prices for the average, casual players hit a wall while grinders buy out the shop in two afternoons.

Download the spreadsheet template built from Beacon Yard's data files and open it in Google Sheets, Excel or LibreOffice Calc:

The sheet adds a Payer row (a Regular who buys one Coin Pack a week) and has five sections. Edit only column B of Section 1 and the player rows of Section 2; every other cell is a formula.

  1. Levers: coin rewards, EVENT_MULTIPLIER and EVENT_DAYS, WRENCH_REPAIR_PER_DRILL, one pass of the upgrade tracks, REBUILDS_PER_30_DAYS and an event shop sink.
  2. Daily sources per player type, on a normal day and an event day.
  3. Daily upkeep: the forced sinks, wrench repair and shields.
  4. 30-day projection: earned, spent, ending balance, Sink Ratio (spent / earned), upkeep share and a Verdict.
  5. Expected Value (EV) of a drop table, base and event versions.
spreadsheet
Beacon Yard economy spreadsheet template open in a spreadsheet grid: the 30-day projection rows for Casual, Regular, Grinder and Payer show earned, upkeep paid, ending balance, Sink Ratio, upkeep share and a Verdict column reading HEALTHY, INFLATION or STARVED.

Select a numbered pin, or a row below, to read what it marks.

Figure 2.1.

The downloadable economy sheet tracks each player type separately so a healthy total never hides a starved casual player or an inflated grinder wallet.

What does healthy mean? Roblox's Economy dashboard guidance is that total sources minus total sinks "should be close to zero", and that a growing net total or a growing average wallet balance means you need more sinks2. So a Sink Ratio near 1.0 is the target: players spend roughly what they earn. Spending everything is not a problem when the spending is on things players want. The sheet's Verdict column checks the two ways an economy fails instead:

  • Inflation: the Sink Ratio falls below a floor (0.4 for Casual and Regular, 0.3 for Grinder in economy.json), or the ending balance passes the type's cap. Coins pile up because there is nothing left worth buying.
  • Starved: forced upkeep (wrench repair and shields) takes more than half of a player's income (maxUpkeepShare = 0.5 in economy.json), so the money goes to staying afloat instead of to goals. There is no maximum Sink Ratio: a player who spends everything on things they chose is healthy.
Where does it break?“A bathtub with taps and a drain” is a good picture of virtual economy sources and sinks. Where does it stop being true?

It breaks here. A bathtub holds one shared pool of water, whereas a game has thousands of separate player wallets; the server average can look healthy while newcomers are starved and veterans hoard ten thousand coins.

The true model. A live economy must be modeled per player archetype (casual, regular, hardcore, payer) over days and weeks. Healthy design matches sources with permanent and repeatable sinks for each cohort and isolates temporary events with their own sinks or event currency.

Creator Hub shows total sinks at 0.82 of total sources across all players, so the economy looks close to even. Yet veterans say coins are useless while Day-1 players say upgrades cost too much. Why did the total mislead you?

  1. Players have separate wallets, not one shared pool: newcomers can spend almost everything on forced repairs while veterans spend a third of their income and hoard the rest, and the total lands in between
  2. AnalyticsService rounds all economy events to the nearest hundred
  3. A ratio of 0.82 is already inflation, so the dashboard was warning you all along
  4. CoinService only logs sources on mobile devices
Answer

Players have separate wallets, not one shared pool: newcomers can spend almost everything on forced repairs while veterans spend a third of their income and hoard the rest, and the total lands in between. Every player has their own wallet. Model Casual, Regular, Grinder and Payer rows separately so neither extreme hides behind a total.

Open this step in lesson mode · Link to this step · This confused me

3Expected Value and separating event currency

Roblox's economy guide illustrates inflation with an event that adds a rare high-value drop without modeling its Expected ValueExpected value (EV)The probability-weighted average payout of a random reward over many trials.Think of it as what one pull pays on average if you play a thousand times. (EV)1. Even a tiny drop chance multiplies across thousands of drills:

text
EV = sum(probability_i * payout_i)

Suppose Beacon Yard adds a bonus scrap roll after every drill: 70% Scrap Bolt (5 coins), 20% Copper Coil (15 coins), 10% Beacon Core (30 coins). Its baseline EV is 0.70 * 5 + 0.20 * 15 + 0.10 * 30 = 9.5 coins per drill. If a weekend event adds a 2% chance at a 500-coin Golden Rotor (taking 2% from Scrap Bolt), that single 2% drop adds 0.02 * (500 - 5) = +9.9 coins per drill, which more than doubles what the drop table pays out.

When you run a temporary event like Scrap Rush (FlagService.coinMultiplier()), Roblox's guide gives the cleanest safeguard: give the event its own event currency and event shop, or pair the boosted faucet with an equally sized limited-time sink1. Otherwise the event's surplus stays in wallets after the event ends, the base shop feels cheap, and fewer players need a Coin Pack. The Economy dashboard has a matching check: if players stop sourcing coins from purchases, Roblox suggests lowering prices or offering new options2.

A drill bonus roll pays 5 coins at 70%, 15 coins at 20%, and 30 coins at 10%. What is the Expected Value (EV) of one roll?

local ev = 0.70 * 5 + 0.20 * 15 + 0.10 * 30
print(string.format('%.1f', ev))
  1. 9.5
  2. 16.7
  3. 50.0
  4. 15.0
Answer

9.5. 0.70 * 5 (3.5) + 0.20 * 15 (3.0) + 0.10 * 30 (3.0) = 9.5 coins. Always weight outcomes by probability before judging an event's impact.

A pity rule changes the EV again. Suppose the Golden Rotor is guaranteed on the 50th roll without one (hard pity). The average wait is then (1 - 0.98 ^ 50) / 0.02 rolls instead of 50, so the real drop rate is higher than the 2% on the label. Model pity with the guarantee included. In a game with player trading, a market fee that removes a share of every trade is a sink that grows with trade volume.

Before you run this cell, guess the average wait. Then change PITY to 20 and see how much the guarantee moves the real rate.

Luau
local CHANCE = 0.02 -- Golden Rotor chance per roll
local PITY = 50 -- the roll that is guaranteed to drop it
 
-- Average rolls until the drop, with the guarantee on roll PITY.
local wait = (1 - (1 - CHANCE) ^ PITY) / CHANCE
print(string.format("Average wait: %.1f rolls", wait))
print(string.format("Real drop rate: %.1f%%", 100 / wait))
Figure 3.1. Expected output: Average wait: 31.8 rolls Real drop rate: 3.1%

Open this step in lesson mode · Link to this step · This confused me

4Interactive 30-day economy simulator

A spreadsheet gives you totals; a short Luau simulator follows the order things happen in. Each day the player earns, pays forced upkeep, then buys the next thing they can afford, so you see the day the shop runs out.

Start with the simulator below. It runs Beacon Yard's real numbers with no rebuild loop, so once a player owns Speed and every upgrade tier, nothing is left to buy and all three player types end outside their health bands. Change the knobs until all three end inside their bands, and notice which type is fixed last. The Price hike scenario shows the other failure: upkeep that eats over half of a player's income.

The economy bathtub

The economy bathtub: a still of the simulation
Figure 4.1.

Now do it in code. This cell starts from the same data with the same sink missing. Press Run and every player type reads INFLATION. Then tune TUNING until all three read HEALTHY in a normal month and in a month with a 3-day x2 Scrap Rush. Two levers to try:

  • repairPerDrill: forced upkeep. Raise it to 30 and watch the light players starve before the grinder is fixed.
  • rebuilds: how many times a player may reset both upgrade tracks and buy them again. That is the Rebuild prestige you build in the next lesson, and it is a sink players choose.
Luau
-- 30-day Beacon Yard economy, one row per player type in economy.json.
-- Edit TUNING and press Run. The tests pass when every type ends HEALTHY,
-- in a normal month and in a month with a 3-day x2 Scrap Rush.
local TUNING = {
	coinValue = 5, -- rewards.json CoinPickup
	survivalBonus = 10, -- rewards.json SurvivalBonus
	crawlerBounty = 8, -- enemies.json Crawler bounty
	eventDays = 3, -- the last N days of the month run at the event multiplier
	speedPrice = 25, -- items.json Speed, bought once
	shieldPrice = 40, -- items.json Shield
	repairPerDrill = 4, -- items.json Repair: 20 coins every 5 drills
	tracks = { -- upgrades.json: tier n costs base * growth ^ (n - 1)
		{ base = 200, growth = 2, maxTier = 2 }, -- Wrench
		{ base = 60, growth = 1.8, maxTier = 3 }, -- Drone shield
	},
	rebuilds = 0, -- times a player may reset both tracks and buy them again
}
 
local ARCHETYPES = {
	{ name = "Casual", drills = 3, pads = 4, crawlers = 0.5, shieldsPerDay = 0, maxBalance = 800, minRatio = 0.4 },
	{ name = "Regular", drills = 8, pads = 6, crawlers = 1, shieldsPerDay = 1, maxBalance = 1500, minRatio = 0.4 },
	{ name = "Grinder", drills = 20, pads = 8, crawlers = 2, shieldsPerDay = 2, maxBalance = 4000, minRatio = 0.3 },
}
local MAX_UPKEEP_SHARE = 0.5 -- economy.json maxUpkeepShare: forced upkeep above half of income starves a player
 
local function shoppingList(): { number }
	local pass = {}
	for _, track in TUNING.tracks do
		for tier = 1, track.maxTier do
			table.insert(pass, math.floor(track.base * track.growth ^ (tier - 1) + 0.5))
		end
	end
	table.sort(pass)
	local list = { TUNING.speedPrice }
	for _ = 0, TUNING.rebuilds do
		for _, cost in pass do
			table.insert(list, cost)
		end
	end
	return list
end
 
local function simulate(a, multiplier: number)
	local list = shoppingList()
	local balance, earned, spent, upkeepPaid, nextBuy = 0, 0, 0, 0, 1
	for day = 1, 30 do
		local m = if day > 30 - TUNING.eventDays then multiplier else 1
		local dayIn = a.drills * (a.pads * TUNING.coinValue * m + TUNING.survivalBonus + a.crawlers * TUNING.crawlerBounty)
		earned += dayIn
		balance += dayIn
		-- Forced upkeep first, capped at what the player holds.
		local upkeep = math.min(balance, a.drills * TUNING.repairPerDrill + a.shieldsPerDay * TUNING.shieldPrice)
		balance -= upkeep
		spent += upkeep
		upkeepPaid += upkeep
		-- Then everything the player wants, in price order.
		while nextBuy <= #list and balance >= list[nextBuy] do
			balance -= list[nextBuy]
			spent += list[nextBuy]
			nextBuy += 1
		end
	end
	local ratio = spent / earned
	local verdict = if ratio < a.minRatio or balance > a.maxBalance
		then "INFLATION"
		elseif upkeepPaid / earned > MAX_UPKEEP_SHARE then "STARVED"
		else "HEALTHY"
	return verdict, ratio, balance, upkeepPaid / earned
end
 
for _, multiplier in { 1, 2 } do
	print(if multiplier == 1 then "Normal month" else "Month with a 3-day x2 Scrap Rush")
	for _, a in ARCHETYPES do
		local verdict, ratio, balance, share = simulate(a, multiplier)
		print(string.format("  %-8s ratio %.2f  balance %5d  upkeep %3.0f%%  %s", a.name, ratio, balance, share * 100, verdict))
	end
end
Figure 4.2. Run it in the lesson view or in the Studio command bar. The lesson view checks it with tests.

Level 2, Builder

Challenge

Tune TUNING in the economy-sim-30d cell above until every player type ends HEALTHY, with and without the Scrap Rush.

Start from
The game at milestone m14 (download)
Check it here
Run the code cell in the lesson view; the challenge completes when it passes. No Studio needed.

Done means

  • Every player type ends HEALTHY in a normal month
  • Every player type ends HEALTHY in a month with a 3-day x2 Scrap Rush
  • Forced upkeep stays under half of every type's income
  • All tests in economy-sim-30d pass

Hints

  1. Try repairPerDrill = 30 first and read the upkeep column: forced upkeep alone starves the light players before it fixes the Grinder.
  2. The Grinder sets the answer. Raise rebuilds until its balance ends under 4000 coins with the event on; 34 is the smallest count that works.
Solution
luau
-- 30-day Beacon Yard economy, one row per player type in economy.json.
-- Edit TUNING and press Run. The tests pass when every type ends HEALTHY,
-- in a normal month and in a month with a 3-day x2 Scrap Rush.
local TUNING = {
	coinValue = 5, -- rewards.json CoinPickup
	survivalBonus = 10, -- rewards.json SurvivalBonus
	crawlerBounty = 8, -- enemies.json Crawler bounty
	eventDays = 3, -- the last N days of the month run at the event multiplier
	speedPrice = 25, -- items.json Speed, bought once
	shieldPrice = 40, -- items.json Shield
	repairPerDrill = 4, -- items.json Repair: 20 coins every 5 drills
	tracks = { -- upgrades.json: tier n costs base * growth ^ (n - 1)
		{ base = 200, growth = 2, maxTier = 2 }, -- Wrench
		{ base = 60, growth = 1.8, maxTier = 3 }, -- Drone shield
	},
	rebuilds = 34, -- times a player may reset both tracks and buy them again
}
 
local ARCHETYPES = {
	{ name = "Casual", drills = 3, pads = 4, crawlers = 0.5, shieldsPerDay = 0, maxBalance = 800, minRatio = 0.4 },
	{ name = "Regular", drills = 8, pads = 6, crawlers = 1, shieldsPerDay = 1, maxBalance = 1500, minRatio = 0.4 },
	{ name = "Grinder", drills = 20, pads = 8, crawlers = 2, shieldsPerDay = 2, maxBalance = 4000, minRatio = 0.3 },
}
local MAX_UPKEEP_SHARE = 0.5 -- economy.json maxUpkeepShare: forced upkeep above half of income starves a player
 
local function shoppingList(): { number }
	local pass = {}
	for _, track in TUNING.tracks do
		for tier = 1, track.maxTier do
			table.insert(pass, math.floor(track.base * track.growth ^ (tier - 1) + 0.5))
		end
	end
	table.sort(pass)
	local list = { TUNING.speedPrice }
	for _ = 0, TUNING.rebuilds do
		for _, cost in pass do
			table.insert(list, cost)
		end
	end
	return list
end
 
local function simulate(a, multiplier: number)
	local list = shoppingList()
	local balance, earned, spent, upkeepPaid, nextBuy = 0, 0, 0, 0, 1
	for day = 1, 30 do
		local m = if day > 30 - TUNING.eventDays then multiplier else 1
		local dayIn = a.drills * (a.pads * TUNING.coinValue * m + TUNING.survivalBonus + a.crawlers * TUNING.crawlerBounty)
		earned += dayIn
		balance += dayIn
		-- Forced upkeep first, capped at what the player holds.
		local upkeep = math.min(balance, a.drills * TUNING.repairPerDrill + a.shieldsPerDay * TUNING.shieldPrice)
		balance -= upkeep
		spent += upkeep
		upkeepPaid += upkeep
		-- Then everything the player wants, in price order.
		while nextBuy <= #list and balance >= list[nextBuy] do
			balance -= list[nextBuy]
			spent += list[nextBuy]
			nextBuy += 1
		end
	end
	local ratio = spent / earned
	local verdict = if ratio < a.minRatio or balance > a.maxBalance
		then "INFLATION"
		elseif upkeepPaid / earned > MAX_UPKEEP_SHARE then "STARVED"
		else "HEALTHY"
	return verdict, ratio, balance, upkeepPaid / earned
end
 
for _, multiplier in { 1, 2 } do
	print(if multiplier == 1 then "Normal month" else "Month with a 3-day x2 Scrap Rush")
	for _, a in ARCHETYPES do
		local verdict, ratio, balance, share = simulate(a, multiplier)
		print(string.format("  %-8s ratio %.2f  balance %5d  upkeep %3.0f%%  %s", a.name, ratio, balance, share * 100, verdict))
	end
end

The shipped game answers this with the Rebuild: EconomyModel lets a player rebuild up to 80 times a month, and lune run scripts/lune/economy-report ends 30 days at a Sink Ratio of 0.94 for Casual, 0.99 for Regular and 1.00 for Grinder, all healthy. That is on purpose. Every player keeps finding something worth buying, upkeep stays under a fifth of income, and no wallet grows month over month, which is what "sources minus sinks close to zero" looks like per player.

Now write the simulator the game will use. Do this challenge before the BuildAlong below, because the BuildAlong copies your passing file into the game.

Level 3, Professional

Challenge

Implement the 30-day economy simulator and target-band validator in challenges/work/economy_sim.luau. The written solution is challenges/solutions/economy-design.md. In Play on the server, run game.ServerScriptService.RunGameTests:Invoke("economy-design", "economy-design-sim") and paste the pass code here.

Start from
The game at milestone m14 (download)
Grade it
In Studio, press Play, then run game.ServerScriptService.RunGameTests:Invoke("economy-design", "economy-design-sim") in the server command bar. Copy the pass code from Output.

Done means

  • expectedValue computes the probability-weighted sum of outcomes
  • dailySource computes one day of pad, survival and crawler coin income using eventMultiplier on pads
  • simulateDays advances day by day, pays upkeep up to available balance, buys affordable upgrades in order, and returns totalEarned, totalSpent, balance, upgradesBought, sinkRatio and upkeepSpent
  • inTargetBands returns (ok, reason) in this order: inflation below minSinkRatio, balance-high over maxBalance, starved when upkeepSpent / totalEarned is above maxUpkeepShare, balance-low under minBalance, otherwise ok
  • A 0.98 Sink Ratio with low upkeep passes, because there is no maximum Sink Ratio: spending what you earn is the target
  • challenges/economy-design.luau prints TEST PASS for every check

Hints

  1. Only pads multiply by eventMultiplier (matching CoinService.luau line 136); survival bonus and crawler bounty stay flat.
  2. Follow the doc comment order in work/economy_sim.luau each day: earn, then upkeep, then buy upgrades in order.
  3. starved compares upkeep with income, not total spending: guard the division when totalEarned is 0.
  4. Pure Luau: test with the Luau runner or in Studio with RunGameTests:Invoke('economy-design', 'economy-design-sim').
  • src/shared/data/items.json
  • src/shared/data/economy.json
  • src/shared/Config.luau
  • src/shared/EconomySim.luau
  1. Add the two new item kinds to src/shared/data/items.json (the data-driven content layout from Module 13). In Config.luau, set WRENCH_REPAIR_COST = Content.price("Repair") and WRENCH_REPAIR_EVERY = 5: after 5 drills the wrench is worn and its upgrade damage stops until the player pays the repair. The shop handles these rows in the next lesson, when UpgradeService exists.

    You should see items.json has a Repair row (kind upkeep, 20 coins) and a Rebuild row (kind rebuild, price 0). Config.WRENCH_REPAIR_COST reads the Repair price and Config.WRENCH_REPAIR_EVERY is 5.

  2. Create src/shared/data/economy.json from your spreadsheet's player rows. There is no maximum Sink Ratio, because spending what you earn is the goal; maxUpkeepShare catches the starved case instead. Upgrade prices do not go here: they come from the curves in upgrades.json, which the next lesson adds.

    You should see economy.json holds three rows: Casual (3 drills, 4 pads, 0.5 crawlers, 0 shields), Regular (8, 6, 1, 1) and Grinder (20, 8, 2, 2), each with minBalance 0, a maxBalance of 800, 1500 or 4000, a minSinkRatio of 0.4, 0.4 or 0.3, and maxUpkeepShare 0.5.

  3. Copy your passing challenges/work/economy_sim.luau into src/shared/EconomySim.luau. In the next lesson, EconomyModel feeds it the real prices and lune run scripts/lune/economy-report checks every economy.json row before a balance change ships.

    You should see src/shared/EconomySim.luau matches your passing challenges/work/economy_sim.luau, with the Starts from comment replaced by a note that it is the finished version of the economy-design challenge.

In the simulator with rebuilds = 0, why can no repairPerDrill value make the Grinder healthy without starving Casual or Regular players?

  1. Once the upgrade list runs out, only forced upkeep is left to absorb 20 drills of income, and upkeep big enough for that takes most of a lighter player's income too
  2. The Grinder earns fewer coins per drill than a Casual player, so upkeep hits the Grinder hardest
  3. repairPerDrill only applies on Scrap Rush days
  4. The sink ratio cannot rise above 0.5 while upkeep is paid first
Answer

Once the upgrade list runs out, only forced upkeep is left to absorb 20 drills of income, and upkeep big enough for that takes most of a lighter player's income too. Forced upkeep is a tax: raise it enough to drain the heaviest player and it crushes the lightest. A repeatable sink players choose, like rebuilding the yard to buy the tiers again, absorbs a grinder's income without touching a casual player's.

Open this step in lesson mode · Link to this step · This confused me

5Currency splits and alternatives

Studios rarely rely on a single currency forever, because each currency answers a different design problem:

Other ways pros do this

OptionWhat it isWhen pros pick itTrade-offs
Single soft currency (Beacon Yard m14-ship)One Coin balance earned in drills and optionally topped up by a Robux Coin Pack.Small games with simple shops and cooperative play where players never trade.Every event boost or veteran hoard directly affects the same shop that paid Coin Packs buy from.
Soft currency + separate Event currencyCore drills pay Coins; Scrap Rush pays Event Tokens spent only in a temporary Event Shop.Any live game running double-reward weekends or seasonal events (Roblox's recommended safeguard).Needs a second balance field, HUD counter and end-of-event expiry rule.
Dual economy (Soft Coins + Premium Gems)Gameplay earns Coins for core upgrades; Robux or rare milestones grant Gems for cosmetics and convenience.Large games protecting cosmetic prestige and monetization from gameplay inflation.Harder to explain to new players; can feel greedy if core power is locked behind Gems.

Beacon Yard runs a 72-hour Scrap Rush weekend. According to Roblox's virtual economy guide, what is the safest way to keep the event exciting without inflating the permanent Quartermaster shop?

  1. Have Scrap Rush award a separate Scrap Token currency spendable only in a limited-time event shop, leaving base Coins untouched
  2. Set EVENT_MULTIPLIER to 2 on base Coins and raise every permanent shop price for the weekend
  3. Cap how many Coins a player can earn per day while the event runs
  4. Disable Coin Packs during the weekend so nobody can spend Robux
Answer

Have Scrap Rush award a separate Scrap Token currency spendable only in a limited-time event shop, leaving base Coins untouched. An isolated event currency lets you hand out generous event rewards and cool limited cosmetics without breaking base shop prices for the next six months.

Open this step in lesson mode · Link to this step · This confused me

6Challenges and recap

Fix checkHealth in this cell. It takes one player type's 30-day totals and the type's bands, and must report the first problem it finds in the same order as EconomySim.inTargetBands: a Sink Ratio below the floor is inflation, an ending balance above the cap is balance-high, and forced upkeep above half of income is starved. A month that spends almost everything it earns on things the player wants is ok.

Luau
local MAX_UPKEEP_SHARE = 0.5
 
local function checkHealth(earned: number, upkeep: number, purchases: number, minRatio: number, maxBalance: number): (boolean, string)
	local spent = upkeep + purchases
	local balance = earned - spent
	local ratio = if earned > 0 then spent / earned else 0
	-- Fix: in this order, return
	--   false, "inflation"    when ratio is below minRatio
	--   false, "balance-high" when balance is above maxBalance
	--   false, "starved"      when upkeep is more than MAX_UPKEEP_SHARE of earned
	-- Otherwise return true, "ok".
	return true, "ok"
end
 
-- The shipped Regular month: 11520 earned, 2160 on upkeep, 9245 on tiers and rebuilds.
print(checkHealth(11520, 2160, 9245, 0.4, 1500))
Figure 6.1. Run it in the lesson view or in the Studio command bar. The lesson view checks it with tests.

Level 1, Apprentice

Challenge

Fix checkHealth in the sink-balance-check cell above so all four assertions pass.

Start from
The game at milestone m14 (download)
Check it here
Run the code cell in the lesson view; the challenge completes when it passes. No Studio needed.

Done means

  • Returns false and 'inflation' when the Sink Ratio is below minRatio
  • Returns false and 'balance-high' when the ending balance is above maxBalance
  • Returns false and 'starved' when upkeep is more than half of earned
  • Returns true and 'ok' for the shipped Regular month at a 0.99 Sink Ratio
  • All four assertions in sink-balance-check pass

Hints

  1. The upkeep share is upkeep / earned. A starved player can still show a high ratio, so the ratio alone cannot catch it.
  2. A high ratio on its own is not a problem: Roblox's guidance is that sources and sinks should roughly match.
Solution
luau
local MAX_UPKEEP_SHARE = 0.5
 
local function checkHealth(earned: number, upkeep: number, purchases: number, minRatio: number, maxBalance: number): (boolean, string)
	local spent = upkeep + purchases
	local balance = earned - spent
	local ratio = if earned > 0 then spent / earned else 0
	if ratio < minRatio then
		return false, "inflation"
	end
	if balance > maxBalance then
		return false, "balance-high"
	end
	if earned > 0 and upkeep / earned > MAX_UPKEEP_SHARE then
		return false, "starved"
	end
	return true, "ok"
end
 
-- The shipped Regular month: 11520 earned, 2160 on upkeep, 9245 on tiers and rebuilds.
print(checkHealth(11520, 2160, 9245, 0.4, 1500))

Take the same question to the spreadsheet, where you can see every total at once. In the downloadable CSV:

  1. Turn on a 3-day Scrap Rush (EVENT_MULTIPLIER 2, EVENT_DAYS 3) and read the drop-table EV before and after the 2% Golden Rotor from the two Section 5 totals. Both tables must sum to 1.00.
  2. With REBUILDS_PER_30_DAYS at 0, try WRENCH_REPAIR_PER_DRILL from 1 to 30. Low values leave INFLATION, and high values STARVE the lighter players first.
  3. Use REBUILDS_PER_30_DAYS and EVENT_SHOP_PER_EVENT_DAY to bring every row to HEALTHY with the event on. With no event shop, 34 rebuilds is the smallest count that works (the Grinder ends near 3505 coins at a 0.92 ratio); the shipped model allows 80.
  4. Write your tuned rows as a short JSON table in the shape of data/economy.json.

Why does a per-drill wrench repair (4 coins per drill) fit Beacon Yard better than raising Speed's one-time price from 25 to 500 coins?

  1. Per-drill upkeep scales with play volume, so a 20-drill Grinder pays more in total while Speed stays affordable for a Day-1 Casual player
  2. Per-drill upkeep costs nothing for Grinder players
  3. A 500-coin Speed would be a repeatable sink, so it would keep draining grinders
  4. Speed is a repeatable consumable sink
Answer

Per-drill upkeep scales with play volume, so a 20-drill Grinder pays more in total while Speed stays affordable for a Day-1 Casual player. Early permanent unlocks should stay fast. Keep forced upkeep small (Beacon Yard's stays under a fifth of income) and let sinks players choose, like the Rebuild, absorb the rest.

Retiring the analogy

You no longer need “a bathtub with taps and a drain”. A live economy must be modeled per player archetype (casual, regular, hardcore, payer) over days and weeks. Healthy design matches sources with permanent and repeatable sinks for each cohort and isolates temporary events with their own sinks or event currency.

Recap

  1. Audit every Analytics.coinSource (pads, survival, crawlers, Coin Packs) and Analytics.coinSink before setting prices.
  2. Model Casual, Regular, Grinder and Payer rows separately; a total across all players hides starved newcomers and hoarding veterans.
  3. Compute Expected Value (sum of chance * payout, pity included) before launching any random drop or event, and isolate temporary events with an event currency or a matching event shop.
  4. Healthy means sources and sinks roughly match: Beacon Yard ships at a 30-day Sink Ratio of 0.94 to 1.00. Inflation is a ratio below the floor or a balance over the cap; starved is forced upkeep above half of income.
  5. Finite upgrades only delay inflation. Keep forced upkeep small and give players a repeatable sink they choose, like the Rebuild, then check every player type in Luau before a balance change ships.

Virtual economy sources and sinks is a bathtub with taps and a drain, until a bathtub holds one shared pool of water, whereas a game has thousands of separate player wallets; the server average can look healthy while newcomers are starved and veterans hoard ten thousand coins.

Next Progression: curves, unlocks and prestige

Open this step in lesson mode · Link to this step · This confused me