Lesson 1 of 6
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.
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
Step 1 of 13
One 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.

Select a numbered pin, or a row below, to read what it marks.
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.
Step 2 of 13
Products, passes and subscriptions
Roblox has three things a player can buy inside your game with Robux123.
| Developer product | Game pass | Subscription | |
|---|---|---|---|
| Bought | Many times | Once, owned for good | Monthly, renews until cancelled |
| Typical use | Currency, a potion, a revive | A permanent perk, VIP area | Ongoing perks, a battle pass |
| You check | A receipt, once per purchase | Ownership, at join | Status, at join and on change |
| Beacon Yard | Coin 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?
Press 1 to 4 to choose, Enter to check.
Step 3 of 13
The 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.
| In the picture | In Roblox |
|---|---|
| The parcel | A purchase receipt with a PurchaseId |
| Signing for it | Returning PurchaseGranted |
| Redelivery | Roblox calling ProcessReceipt again when the player rejoins or starts another purchase, or on a second server |
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:
- Check the purchase id is not already recorded. If it is, and that record was saved, return
PurchaseGranted. - Add the 50 coins to the player's data in memory.
- Write the purchase id into that same player data.
- Save the player data once and wait for the save to land.
- Return
PurchaseGrantedonly if the save worked. If it failed, returnNotProcessedYet.
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
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
Put MonetizationService.process in order.
- Look up the purchase id; return PurchaseGranted if it was already granted
- Add the 50 coins to the profile
- Save the profile and wait for it to land
- Return PurchaseGranted
- Write the r_<purchaseId> receipt record
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?
Press 1 to 4 to choose, Enter to check.
Step 4 of 13
Where 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?
Press 1 to 4 to choose, Enter to check.
Step 5 of 13
The 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
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?
An exploiter runs player:SetAttribute("SpeedPass", true) in their own client. What changes?
Press 1 to 4 to choose, Enter to check.
Step 6 of 13
Subscriptions
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?
Press 1 to 4 to choose, Enter to check.
Step 7 of 13
How 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; checkPlayer.HasRobloxSubscriptionfirst 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.
Step 8 of 13
Testing 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?
Step 9 of 13
Economy 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.
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?
Press 1 to 4 to choose, Enter to check.
Step 10 of 13
How studios think about it
Other ways pros do this
| Option | What it is | When pros pick it | Trade-offs |
|---|---|---|---|
| Developer products | Repeatable 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 passes | A one-time permanent unlock that Roblox remembers. | VIP areas, permanent perks, cosmetic trails. | Cannot be bought twice; changing a pass later upsets owners. |
| Subscriptions | Monthly 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 Rewards | Roblox 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?
Press 1 to 4 to choose, Enter to check.
Step 11 of 13
Build along: the Speed Pass
Build along
src/server/PassService.luausrc/shared/Ids.luausrc/shared/Config.luausrc/server/ShopService.luausrc/client/ShopGui.luau
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.
Add
SPEED_PASS_ID = 0toIds.luau,PASS_SPEED_BONUS = 4toConfig.luau, and put your real id inIds.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.
Create
PassService.luau:UserOwnsGamePassAsyncinpcallon join, write theSpeedPassattribute, and refresh onPromptGamePassPurchaseFinished.You should see Output shows no errors and the player has SpeedPass false until you own the pass.
Make
DataService.applySpeedadd the bonus when the attribute is true, route aSpeedPassitem inShopServicetoPassService.prompt, and add the button toShopGui.You should see After a Studio test purchase, the player walks 4 studs per second faster, and the shop button says owned.
Step 12 of 13
Challenges
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
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
SPEED_PASS_ID is 0 in a fresh clone. What does the shop do when a player presses the Speed Pass button?
Press 1 to 4 to choose, Enter to check.
Step 13 of 13
Recap
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
- 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.
- 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.
- 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.
Queued for review