Monetization: products, passes, subscriptions, economy

Sell things in a Roblox game the right way with Beacon Yard's Coin Pack and Speed Pass, covering products, passes, subscriptions, payouts, price testing and the basics of balancing an economy.

Concept lesson, about 90 minutes, 13 steps

By the end you can

  • Choose between a developer product, a game pass and a subscription, and grant each one correctly on the server
  • Explain why ProcessReceipt returns PurchaseGranted only after the grant is saved, using Beacon Yard's Coin Pack
  • Describe how Roblox pays creators (sales, Creator Rewards, Roblox Plus incentives, DevEx), how price testing works, and design a small coin economy

Before this: ProfileStore: the library pros use, Security: never trust the client

1One button spends coins, two spend Robux

Open the shop at m12-money. Speed and Shield cost coins you earned in play. The Coin Pack and the Speed Pass cost Robux, the platform's paid currency. They look the same on screen, and they are three different mechanisms underneath.

Speed and Shield call DataService.trySpend on the server. The Coin Pack opens a Roblox purchase prompt for a developer product, and the Speed Pass opens one for a game pass. Roblox takes the Robux and tells your server afterwards. Your server never sees a card or a price it can trust from the client.

Roblox Studio
Beacon Yard's Quartermaster shop open in a Studio playtest with 5 coins: Speed at 25 coins and Shield at 40 coins each show how many coins are missing, below them the Coin Pack button reading 50 coins and the Speed Pass button reading +4 speed for good, Robux, then Close.

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

Figure 1.1.

The shop at m12-money. Speed and Shield are paid in coins; the Coin Pack and the Speed Pass are the two Robux buttons.

Match each shop button to how it is paid for.

  1. Speed (25 coins)
  2. Shield (40 coins)
  3. Coin Pack
  4. Speed Pass
Answer

Speed (25 coins): DataService.trySpend on the server, in coins; Shield (40 coins): DataService.trySpend on the server, in coins; Coin Pack: A developer product, bought with Robux and granted in ProcessReceipt; Speed Pass: A game pass, bought once with Robux and checked with UserOwnsGamePassAsync. Coins are your own currency, so the server spends them. Anything bought with Robux goes through MarketplaceService, and Roblox tells the server what was bought.

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

2Products, passes and subscriptions

Roblox has three things a player can buy inside your game with Robux123.

Developer productGame passSubscription
BoughtMany timesOnce, owned for goodMonthly, renews until cancelled
Typical useCurrency, a potion, a reviveA permanent perk, VIP areaOngoing perks, a battle pass
You checkA receipt, once per purchaseOwnership, at joinStatus, at join and on change
Beacon YardCoin Pack (+50 coins)Speed Pass (+4 speed)Not used

A developer product is repeatable, so it has no "owned" state. Roblox sends a receipt each time, and you must grant the item and acknowledge it. A game pass is a permanent unlock and Roblox remembers it for you. A subscription is a permanent unlock that can end, so you check its status when the player joins and whenever it changes.

You want players to pay 99 Robux once for a golden wrench trail they keep forever. Which fits best?

  1. A game pass
  2. A developer product
  3. A subscription
  4. A badge
Answer

A game pass. A pass is a one-time permanent unlock. A developer product would let players buy the trail repeatedly with no owned state, and a subscription would end after a month if cancelled.

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

3The Coin Pack: grant, record, save, then say yes

MarketplaceService.ProcessReceipt is a callback you set once, from one server script. Roblox calls it with a receipt: a purchase id, the player id and the product id. You return PurchaseGranted only when the player really has the item and the purchase is recorded. Return NotProcessedYet and the receipt stays unresolved. There is no timer: Roblox hands it back when the player joins any server of your experience again, or when they start another developer product purchase1. Never grant items from PromptProductPurchaseFinished: that event does not retry.

Stored dataProcessReceipt is a courier who keeps coming back until you sign.
In the pictureIn Roblox
The parcelA purchase receipt with a PurchaseId
Signing for itReturning PurchaseGranted
RedeliveryRoblox calling ProcessReceipt again when the player rejoins or starts another purchase, or on a second server

See the whole analogy cast

The receipt is a courier who keeps coming back with the parcel until you sign for it. He does not follow a timetable: he knocks when the player joins a server, or buys something else. Sign too early, before the coins are saved, and a crash leaves the player charged with nothing to show. Sign only after the save.

Think of it as A courier who keeps coming back until you sign

Roblox's own recipe for this has five steps, and the safe version keeps the last three in one player record4:

  1. Check the purchase id is not already recorded. If it is, and that record was saved, return PurchaseGranted.
  2. Add the 50 coins to the player's data in memory.
  3. Write the purchase id into that same player data.
  4. Save the player data once and wait for the save to land.
  5. Return PurchaseGranted only if the save worked. If it failed, return NotProcessedYet.

The coins and the purchase id travel in one write, so they are saved together or not at all. A crash cannot leave one without the other.

Beacon Yard's MonetizationService.process keeps the same order of "check, grant, save, record, sign", with one difference. Its receipt record is a separate DataStore row, r_<purchaseId>, and not a field inside the profile. So it looks for the row, adds 50 coins, saves the profile, writes the row, and only then returns PurchaseGranted. If a step fails, it takes the coins back and returns NotProcessedYet.

	DataService.addCoins(player, Config.COIN_PACK_COINS)
	if not DataService.save(player) then
		DataService.addCoins(player, -Config.COIN_PACK_COINS)
		return Enum.ProductPurchaseDecision.NotProcessedYet
	end
 
	local wrote = false
	local writeOk, stored = pcall(function()
		return dataStore:UpdateAsync(receiptKey(receipt.PurchaseId), function(previous: unknown): ReceiptRecord?
			if typeof(previous) == "table" and (previous :: { granted: unknown }).granted == true then
				return previous :: ReceiptRecord
			end
			wrote = true
			return {
				granted = true,
				userId = receipt.PlayerId,
				productId = receipt.ProductId,
				coins = Config.COIN_PACK_COINS,
				at = os.time(),
			}
		end)
	end)
 
	if not writeOk or typeof(stored) ~= "table" then
		DataService.addCoins(player, -Config.COIN_PACK_COINS)
		DataService.save(player)
		return Enum.ProductPurchaseDecision.NotProcessedYet
	end
 
	local record = stored :: { granted: unknown }
	if record.granted ~= true then
		DataService.addCoins(player, -Config.COIN_PACK_COINS)
		DataService.save(player)
		return Enum.ProductPurchaseDecision.NotProcessedYet
	end
 
	-- Another server stored the receipt first. This server already added
	-- coins, so take them back and keep the recorded grant.
	if not wrote then
		DataService.addCoins(player, -Config.COIN_PACK_COINS)
		DataService.save(player)
	else
		local balance = DataService.addCoins(player, 0)
		Analytics.coinSource(
			player,
			Config.COIN_PACK_COINS,
			balance,
			Enum.AnalyticsEconomyTransactionType.IAP.Name,
			"CoinPack"
		)
		Analytics.onboarding(player, "FirstPurchase")
		Remotes.fireClient("Feedback", player, "buy", "Coin Pack")
	end
 
	grantedIds[receipt.PurchaseId] = true
	return Enum.ProductPurchaseDecision.PurchaseGranted
Figure 3.1

That is two durable writes, and there is a gap between them. If the server stops after the profile save and before the row write, the 50 coins are saved and no record exists. When Roblox delivers the receipt again, the check finds nothing and grants another 50. The coin takeback on the failure paths is a second save, and it can fail too. The lesson keeps this version because it is the one you build along with here, and it names the gap so you can see it.

The m14-ship tag closes it. ReceiptRules is a plain module with no Roblox services in it, and it has its own Jest specs. Its applyReceipt adds the coins and writes the purchase id into the profile's recentPurchaseIds list (the last 50 ids) in one step, and returns nothing at all when the id is already in the list.

MonetizationService then follows the safe order from the steps above: look the id up in the profile, apply the receipt, call DataService.save and wait, and take the grant back with undoReceipt if the save failed. PurchaseGranted goes out only after the save landed. One save holds the coins and the id, so a server that stops leaves both or neither. The old r_<purchaseId> rows are no longer written. The handler still reads one once for an id that is missing from the profile, because a receipt an older server recorded but did not finish can still be delivered again.

	local applied = ReceiptRules.applyReceipt(data, receipt, Config.COIN_PACK_COINS)
	if applied == nil then
		-- The id appeared in the profile while the old row was being read.
		return granted
	end
	DataService.syncCoins(player)
 
	if not DataService.save(player) then
		ReceiptRules.undoReceipt(data, receipt, Config.COIN_PACK_COINS, applied)
		DataService.syncCoins(player)
		return notYet
Figure 3.2

Put MonetizationService.process in order.

  1. Look up the purchase id; return PurchaseGranted if it was already granted
  2. Add the 50 coins to the profile
  3. Save the profile and wait for it to land
  4. Return PurchaseGranted
  5. Write the r_<purchaseId> receipt record
Answer

1. Look up the purchase id; return PurchaseGranted if it was already granted 2. Add the 50 coins to the profile 3. Save the profile and wait for it to land 4. Write the r_<purchaseId> receipt record 5. Return PurchaseGranted. Duplicate check, grant, save, record, sign. The same purchase id arriving twice finds the record and grants nothing, which is why a retry is safe. This is the order of the m12-money code, whose record is a separate row.

The server stops right after the profile save and before the r_<purchaseId> row is written. Roblox delivers the receipt again. What does the m12-money handler do?

  1. It finds no record, so it grants another 50 coins
  2. It finds the saved coins and grants nothing
  3. It returns PurchaseGranted without checking anything
  4. Roblox refunds the purchase automatically
Answer

It finds no record, so it grants another 50 coins. The check reads only the r_ row. With two separate writes, a stop between them leaves coins saved and no record. Storing the purchase id in the same profile save removes the gap.

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

4Where the courier breaks

Stored dataRemember: ProcessReceipt is a courier who keeps coming back until you sign.

In m12-money, the Coin Pack handler looks up the purchase ID before granting 50 coins. If it finds a saved receipt record, it acknowledges the purchase without granting coins again.

Where does it break?“A courier who keeps coming back until you sign” is a good picture of processreceipt. Where does it stop being true?

It breaks here. You decide what a duplicate looks like: without a stored purchase id, a redelivered receipt grants twice, and a record saved apart from the coins leaves a gap.

The true model. ProcessReceipt is one callback, set once from a server script (BindReceiptHandler is the newer route). Record the purchase id in the same save as the grant, then return PurchaseGranted. NotProcessedYet leaves the receipt unresolved: it returns on a rejoin or the next purchase, not on a timer.

Roblox can send the same receipt again after a NotProcessedYet, after a server that stopped mid-handler, or on a second server if the player joins it before the first handler has returned1. If the handler simply adds 50 coins each time it is called, the player gets paid twice for one purchase. A stored purchase id is what makes a redelivery harmless, as long as it is saved together with the coins. Studio simulates the purchase prompt in Play, so you can test ProcessReceipt without spending Robux.

In m12-money, the same receipt arrives again after a successful grant. What stops the second delivery from granting 50 more coins?

  1. The handler finds the r_<purchaseId> record and returns PurchaseGranted without adding coins
  2. Roblox never delivers a receipt twice
  3. The client checks before sending
  4. The shop disables the button
Answer

The handler finds the r_<purchaseId> record and returns PurchaseGranted without adding coins. alreadyGranted reads the record before anything is added, and the same purchase id in a second call returns PurchaseGranted immediately.

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

5The Speed Pass: ask Roblox who owns it

A pass needs no receipt. PassService asks MarketplaceService:UserOwnsGamePassAsync(userId, passId) when a player joins, writes the answer to a server-set player attribute named SpeedPass, and DataService.applySpeed adds Config.PASS_SPEED_BONUS (4) on top of the normal walk speed. When a purchase happens in this session, PromptGamePassPurchaseFinished fires on the server and the check runs again2.

function PassService.refresh(player: Player): boolean
	if Ids.SPEED_PASS_ID <= 0 then
		player:SetAttribute(ATTRIBUTE, false)
		return false
	end
	local ok, owned = pcall(function()
		return MarketplaceService:UserOwnsGamePassAsync(player.UserId, Ids.SPEED_PASS_ID)
	end)
	if not ok then
		return PassService.owns(player)
	end
	if player.Parent ~= Players then
		return false
	end
	player:SetAttribute(ATTRIBUTE, owned == true)
	DataService.applySpeed(player)
	return owned == true
Figure 5.1

Two details matter. The result is stored on the server, so a client cannot give itself the pass: a client cannot set a server attribute. And a failed web call keeps the old answer, so a Roblox hiccup never takes a pass away mid-session.

Predict the four speeds before you run the cell. What does the pass add with and without the coin-shop Speed upgrade?

Luau
-- WALK_SPEED 16, BOOST_SPEED 24, PASS_SPEED_BONUS 4 (from Config).
local function speed(boostOwned, passOwned)
	local base = boostOwned and 24 or 16
	return base + (passOwned and 4 or 0)
end
print(speed(false, false) .. " " .. speed(false, true))
print(speed(true, false) .. " " .. speed(true, true))
Figure 5.2. Expected output: 16 20 24 28

An exploiter runs player:SetAttribute("SpeedPass", true) in their own client. What changes?

  1. Nothing for the server: the client's attribute change is not sent up, so the speed bonus is not applied
  2. They get the pass for free
  3. Every player gets the pass
  4. The pass is revoked
Answer

Nothing for the server: the client's attribute change is not sent up, so the speed bonus is not applied. Replication runs from server to client. The server's own SpeedPass value, written after UserOwnsGamePassAsync, is what applySpeed reads.

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

6Subscriptions

A subscription is an auto-renewing monthly purchase. It can be priced in Robux (at least 49 Robux) or in local currency at set price points such as $2.99, $4.99, $7.99, $9.99 or $14.99, and all of a game's subscriptions can be owned at once. They are not mutually exclusive tiers3. You check status with MarketplaceService:GetUserSubscriptionStatusAsync(player, subscriptionId) on the server, listen for Players.UserSubscriptionStatusChanged, and prompt with PromptSubscriptionPurchase.

The rules matter as much as the code: benefits must be the same on every platform, honoured for the full term, and not locked behind extra tasks once paid.

Beacon Yard does not sell one. A subscription would fit a "Quartermaster's Club" perk such as a free Shield every round.

Which of these would break Roblox's subscription guidelines?

  1. Giving iPhone buyers a perk that Xbox buyers do not get
  2. Requiring a social media post before the paid benefit unlocks
  3. Honouring a perk for the whole month
  4. Telling players in-game to buy on a website instead
Answer

Giving iPhone buyers a perk that Xbox buyers do not get; Requiring a social media post before the paid benefit unlocks; Telling players in-game to buy on a website instead. Benefits must match across platforms, cannot require extra tasks after payment, and you may not direct players to purchase elsewhere. Honouring the full term is required, not forbidden.

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

7How you get paid

Money reaches a creator in several ways, and one of the old ones has ended.

  • Sales. You earn Robux from products, passes, subscriptions, paid private servers and paid access. Earned Robux can be exchanged for real money through DevEx5.
  • Premium payouts. Engagement-based payouts, which paid by how much time Roblox Premium members spent in your game, were deprecated on 24 July 2025 and replaced by Creator Rewards6.
  • Creator Rewards. For example, Daily Engagement Rewards pay 5 Robux for each Active Spender who plays your game for at least 10 minutes in a day, when it is one of the first three they visit that day. A second part rewards new users brought to the platform7.
  • Roblox Plus. Roblox covers the 10 to 20 percent discount that Plus subscribers get on your items, so your earnings per sale do not drop. You can earn up to 750 Robux for each new Plus subscriber you bring in with PromptRobloxSubscriptionPurchase; check Player.HasRobloxSubscription first so you only prompt players who are not already subscribed, and confirm status changes on the server before granting any subscriber perk8.

DevEx requires a minimum age of 13 and at least 30,000 Earned Robux. The standard rate is $0.0038 per Earned Robux. Eligible spending by US adults can earn a higher rate5.

At the standard rate, what dollar value would 30,000 Earned Robux represent? What about 5,000? Predict both before you run the cell.

Luau
local RATE = 0.0038 -- US dollars per Earned Robux, the standard rate
local function usd(robux)
	return math.round(robux * RATE)
end
print("30000 Robux -> $" .. usd(30000))
print("5000 Robux -> $" .. usd(5000))
Figure 7.1. Expected output: 30000 Robux -> $114 5000 Robux -> $19

A blog post says Premium members' playtime pays you automatically through engagement-based payouts. What do you tell a teammate?

  1. That programme was deprecated in July 2025 and replaced by Creator Rewards
  2. It is still the main payout
  3. It only applies to games with passes
  4. It pays in real money directly
Answer

That programme was deprecated in July 2025 and replaced by Creator Rewards. The docs say Engagement-Based Payouts were deprecated on 24 July 2025 and replaced by Creator Rewards. Always check the date of a monetization post.

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

8Testing prices

A price is a guess. Managed pricing lets Roblox test it for you. Price optimization shows different groups different prices for the same pass or product, measures how many buy, and applies a new price only if revenue goes up. It needs real traffic: in most cases at least 60,000 transactions in the previous 30 days, and tests run at least every 90 days9. Beacon Yard is nowhere near that, which is the honest answer for most new games: you cannot test prices until you have players.

Two rules hold even before then. Prices must be read from MarketplaceService:GetProductInfoAsync (with Enum.InfoType.Product for a developer product or Enum.InfoType.GamePass for a pass), not hard-coded, or price tests, regional pricing and Roblox Plus discounts will show the wrong number in your UI. And regional pricing never discounts more than 70 percent of your default price10.

A pass has a default price of 250 Robux. What is the lowest regional price it can have?

Answer

75 Robux. 30 percent of 250 is 75. The docs give the same example with a 100 Robux item: the lowest is 30 and the highest is 100.

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

9Economy design: sources and sinks

Beacon Yard has a small economy with coins as the currency. Sources put coins in: a pickup is 5 coins (COIN_VALUE), surviving a round is 10 (SURVIVAL_BONUS) and the Coin Pack is 50. Sinks take them out: Speed costs 25 and Shield 40. A healthy economy keeps the two roughly in balance, so players always have something to want and something to afford11.

A player collects four pickups and survives each round. Predict their coins after one round and how many rounds they need to buy Speed, then to buy both Speed and Shield. Run the cell to check.

Luau
-- Config: COIN_VALUE 5, SURVIVAL_BONUS 10, SPEED_PRICE 25, SHIELD_PRICE 40.
local COIN_VALUE, SURVIVAL_BONUS = 5, 10
local SPEED, SHIELD = 25, 40
 
-- Assume a new player picks up 4 coins and survives each round.
local perRound = 4 * COIN_VALUE + SURVIVAL_BONUS
print("one round: " .. perRound .. " coins")
print("rounds to Speed: " .. math.ceil(SPEED / perRound))
print("rounds to Speed and Shield: " .. math.ceil((SPEED + SHIELD) / perRound))
Figure 9.1. Expected output: one round: 30 coins rounds to Speed: 1 rounds to Speed and Shield: 3

One round earns 30 coins in this assumption, so a first upgrade takes a single round and both items take three. That is quick. The Coin Pack at 50 coins is under two rounds of play, so it sells almost nothing the shop does not already give away. A designer would raise prices, lower earnings or add a bigger sink, then watch the economy events in the analytics lesson to see whether it worked. Never change a price blindly in a live game: use Experiments to test and Configs to adjust without a restart11.

Be careful with random rewards. If a game sells random items for Robux, or for coins that were bought with Robux, a regional policy may restrict them. PolicyService:GetPolicyInfoForPlayerAsync returns ArePaidRandomItemsRestricted, and Beacon Yard's PolicyProbe stores it on the player so any future loot box can check it12.

A new player earns about 30 coins a round, and the Coin Pack grants 50. What does that tell a designer?

  1. The pack saves less than two rounds of play, so test whether players value that time saving
  2. The pack is priced perfectly
  3. Coins should be removed from the game
  4. Robux prices should be hard-coded
Answer

The pack saves less than two rounds of play, so test whether players value that time saving. If two rounds buy the same coins for free, few players will pay. Tune the sinks (prices) or the pack, and measure with economy events.

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

10How studios think about it

Other ways pros do this

OptionWhat it isWhen pros pick itTrade-offs
Developer productsRepeatable purchases granted in a receipt handler (ProcessReceipt or BindReceiptHandler).Currency, consumables, revives, anything bought more than once.You must record each purchase id with the grant and handle redelivery.
Game passesA one-time permanent unlock that Roblox remembers.VIP areas, permanent perks, cosmetic trails.Cannot be bought twice; changing a pass later upsets owners.
SubscriptionsMonthly auto-renewing perks, in Robux or local currency.Ongoing benefits and battle passes with a steady audience.You must honour the full term and keep platform parity.
Roblox Plus incentives and Creator RewardsRoblox pays for engagement and for bringing new subscribers or users.Always on in the background; Plus is worth a prompt in a good moment.You do not control the amounts, and the rules change.

You want to add a Roblox Plus perk to your game. Which practice matches what this lesson teaches?

  1. Check Player.HasRobloxSubscription on the server and offer a fair cosmetic or convenience perk
  2. Hard-code the discounted Plus price on the shop button
  3. Give subscribers an unbeatable weapon that free players can never earn
  4. Trust the client to tell the server when a player subscribed
Answer

Check Player.HasRobloxSubscription on the server and offer a fair cosmetic or convenience perk. Check Player.HasRobloxSubscription on the server before prompting or granting, read live prices with GetProductInfoAsync, and keep perks cosmetic or fair so retention does not suffer.

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

11Build along: the Speed Pass

  • src/server/PassService.luau
  • src/shared/Ids.luau
  • src/shared/Config.luau
  • src/server/ShopService.luau
  • src/client/ShopGui.luau
  1. In Creator Hub, open your test experience, go to Monetization, then Passes, and create a pass with a 512 by 512 icon. The place must be published first.

    You should see Creator Hub lists a pass named Speed Pass on your test experience, with its id on the page.

  2. Add SPEED_PASS_ID = 0 to Ids.luau, PASS_SPEED_BONUS = 4 to Config.luau, and put your real id in Ids.local.luau, which Git ignores.

    You should see Ids.luau has SPEED_PASS_ID defaulting to 0, and your id is only in Ids.local.luau.

  3. Create PassService.luau: UserOwnsGamePassAsync in pcall on join, write the SpeedPass attribute, and refresh on PromptGamePassPurchaseFinished.

    You should see Output shows no errors and the player has SpeedPass false until you own the pass.

  4. Make DataService.applySpeed add the bonus when the attribute is true, route a SpeedPass item in ShopService to PassService.prompt, and add the button to ShopGui.

    You should see After a Studio test purchase, the player walks 4 studs per second faster, and the shop button says owned.

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

12Challenges

Level 3, Professional

Challenge

Add a second developer product (granting 20 coins) to MonetizationService. The test is challenges/monetization.luau and the solution is challenges/solutions/monetization.md. Do not create a product in Creator Hub for the test. Run the test with the command in the footer. Keep the safe order of m14-ship: the id goes into the profile with the coins, one save waits, and the purchase is still recorded once. The test reads the profile, and no r_<purchaseId> row is written.

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

Done means

  • A second developer product grants 20 coins (SECOND_PACK_COINS = 20) through the same ProcessReceipt
  • The same purchase id delivered twice grants once, and the id is in the profile's recentPurchaseIds exactly once, in the live profile and in the saved copy, with the same coins
  • The test product id comes from workspace:GetAttribute("TestSecondProductId"), and the Coin Pack still grants 50
  • Self-check, the test does not grade it: the Coin Pack id is read from Ids, and the product is off when its id is 0
  • challenges/monetization.luau prints TEST PASS for every check

Hints

  1. Look up the grant amount by product id in a table, not in an if chain: 50 for COIN_PACK_PRODUCT_ID and 20 for the second product.
  2. Pass the amount you looked up to ReceiptRules.applyReceipt and undoReceipt, so the profile gets the coins you actually added and the id lands in the same record, not a hard-coded 50.
  3. The test sets an attribute on Workspace, so read it with workspace:GetAttribute("TestSecondProductId") instead of indexing a property.

Level 3, Professional

Challenge

Write the economy arithmetic as pure functions in the learner file. The test file (challenges/monetization-economy.luau) is in the game repo at m14-ship, and the written solution is challenges/solutions/monetization-economy.md.

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

Done means

  • challenges/work/economy_math.luau returns coins per round from pickups, survival and a Config table
  • It returns the number of rounds to afford a price, rounded up, and never loops forever on a zero income
  • It returns the lowest regional price for a default price, never below 1
  • challenges/monetization-economy.luau prints TEST PASS for every check

Hints

  1. Income per round is pickups times COIN_VALUE, plus the survival bonus when survived.
  2. If income is 0 or less, the answer is nil, not infinity.
  3. The floor is 30 percent of the default price, rounded up, at least 1.

SPEED_PASS_ID is 0 in a fresh clone. What does the shop do when a player presses the Speed Pass button?

  1. The server refuses, sends a deny message, and the game keeps working
  2. It grants the pass free
  3. It crashes the server
  4. It opens a prompt for pass 0
Answer

The server refuses, sends a deny message, and the game keeps working. PassService.prompt returns a deny message when the id is 0. Every account-bound id defaults to 0, and the feature switches off with one warning.

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

13Recap

Retiring the analogy

You no longer need “a courier who keeps coming back until you sign”. ProcessReceipt is one callback, set once from a server script (BindReceiptHandler is the newer route). Record the purchase id in the same save as the grant, then return PurchaseGranted. NotProcessedYet leaves the receipt unresolved: it returns on a rejoin or the next purchase, not on a timer.

Recap

  1. Products are repeatable and granted in a receipt handler only after the purchase id and the grant are saved, ideally in one write; a rejoin or the next purchase redelivers an unanswered receipt; passes are checked with UserOwnsGamePassAsync; subscriptions are checked by status.
  2. Creators earn from sales, Creator Rewards, Roblox Plus incentives and DevEx (0.0038 US dollars per Earned Robux at the standard rate); engagement-based Premium payouts ended in July 2025.
  3. Price testing needs real traffic (about 60,000 transactions in 30 days), and an economy is balanced by its sources and sinks, measured with analytics.

ProcessReceipt is a courier who keeps coming back until you sign, until you decide what a duplicate looks like: without a stored purchase id, a redelivered receipt grants twice, and a record saved apart from the coins leaves a gap.

Next Ads in the game: rewarded video and immersive ads

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