Skip to content
Tutorials Center
My learning

Topics

Lesson 33 of 37 ยท Publishing and Monetization

Monetization: Gamepasses, Developer Products and Premium

Learn how to earn Robux with gamepasses, developer products and Premium payouts, prompt purchases with MarketplaceService, and process receipts safely so players never lose purchases.

Many creators build Roblox experiences as a hobby, and some earn real income from them. Roblox lets you sell things inside your experience for Robux, its virtual currency, and creators can convert earnings into real money through the Developer Exchange program if they meet its requirements. This lesson focuses on the technical side of selling: the kinds of purchases, how to prompt them, and how to grant them safely.

Prices, revenue shares and eligibility rules change over time, so check the Creator Hub for current figures. The Roblox code is shown read-only. The runnable examples are JavaScript stand-ins that model purchase processing, including the tricky retry case.

Ways to earn

Method What it is Typical use
Gamepass A one-time purchase that a player owns permanently in your experience VIP area, double coins, special tool
Developer product A purchase that can be bought many times In-game currency packs, extra lives, revives
Premium Payouts Robux earned based on time Premium subscribers spend in your experience Passive, from engagement
Paid access / Private servers Charge to enter, or let players pay for private servers Early access or community servers
Avatar items Sell clothing or accessories on the marketplace Creator economy outside the experience
Ads / sponsored experiences Advertising features offered by Roblox Promotion

Everything players buy must follow Roblox's rules: do not sell anything that gives a misleading promise, do not use random chance in a way that breaks the platform's policy on paid random items, and be honest about what the purchase gives.

Gamepass or product?

Gamepass Buy once, own forever.
Product Buy again and again.
Premium payouts Earn from Premium time spent.

Pick by asking, "should the player be able to buy it twice?"

1 / 2

Creating a gamepass or product

You create these on the Creator Hub (not in a script): open your experience, go to Monetization, create a Pass or a Developer Product, set a name, a description, an icon and a Robux price. Each has a numeric ID that you copy into your scripts. Keep IDs together in one module so they are easy to update.

Gamepasses in code

A gamepass is ownership. Check it when the player joins, and prompt a purchase when they click your button.

LUA
local MarketplaceService = game:GetService("MarketplaceService")
local Players = game:GetService("Players")

local VIP_PASS_ID = 123456789 -- your gamepass id

local function hasVip(player)
	local ok, owns = pcall(function()
		return MarketplaceService:UserOwnsGamePassAsync(player.UserId, VIP_PASS_ID)
	end)
	return ok and owns
end

Players.PlayerAdded:Connect(function(player)
	if hasVip(player) then
		-- give the VIP perk
	end
end)

-- Ask the player to buy (usually from a RemoteEvent the client fired)
MarketplaceService:PromptGamePassPurchase(player, VIP_PASS_ID)

-- Grant it immediately if they buy while playing
MarketplaceService.PromptGamePassPurchaseFinished:Connect(function(player, passId, wasPurchased)
	if wasPurchased and passId == VIP_PASS_ID then
		-- give the VIP perk now
	end
end)

As always, the client may only ask to prompt; the purchase check and the perk happen on the server. And wrap the ownership call in pcall, because it hits the network.

Developer products and ProcessReceipt

Developer products are more delicate, because players can buy them repeatedly and you must grant each purchase exactly once, even if the server crashes or the player leaves mid-purchase. Roblox solves this with a callback named ProcessReceipt. You assign it once, on the server:

LUA
local PRODUCTS = {
	[111111] = function(player) -- 100 coins
		player.leaderstats.Coins.Value += 100
		return true
	end,
	[222222] = function(player) -- 500 coins
		player.leaderstats.Coins.Value += 500
		return true
	end,
}

MarketplaceService.ProcessReceipt = function(receiptInfo)
	local player = Players:GetPlayerByUserId(receiptInfo.PlayerId)
	if not player then
		return Enum.ProductPurchaseDecision.NotProcessedYet
	end

	local handler = PRODUCTS[receiptInfo.ProductId]
	if not handler then
		return Enum.ProductPurchaseDecision.NotProcessedYet
	end

	local ok, success = pcall(handler, player)
	if ok and success then
		return Enum.ProductPurchaseDecision.PurchaseGranted
	end
	return Enum.ProductPurchaseDecision.NotProcessedYet
end

Key rules:

  • Return PurchaseGranted only after the item is really granted, and ideally after your data is saved.
  • Return NotProcessedYet when something went wrong (player left, save failed). Roblox will call ProcessReceipt again later, possibly in another server, until you succeed.
  • Because the callback can run more than once for the same purchase, record each receiptInfo.PurchaseId and ignore duplicates. Store processed ids in the player's saved data, so a retry cannot give the reward twice.
  • Only one script may set ProcessReceipt. Put it in a single module that handles every product.
  • The callback may yield (for example, to save), but should not take very long.

Idempotent receipts you can run

"Idempotent" means doing the same thing twice has the same result as once. This stand-in processes a receipt twice and shows why the purchase id matters.

JS ProcessReceipt and duplicate purchases (JavaScript stand-in)

Press Run (or Ctrl + Enter) to see the console output here.

No output.

The retry returns PurchaseGranted without adding coins again, so the player gets 100 plus 500, not 200 plus 500. Without the processed set a Roblox retry could double-reward the player.

Fair and safe selling

  • Tell players exactly what they get; show the item and its effect before the prompt.
  • Do not sell unfair advantages that make the game unplayable for non-payers; most successful experiences sell speed, style and convenience.
  • Never trust the client's word that it paid; only ProcessReceipt and UserOwnsGamePassAsync on the server are truth.
  • Test with a free-priced item first, or use Studio's test purchases, which do not charge Robux.
  • Keep prices easy to change in a module, and track which products sell using analytics (see the next lesson).
  • Respect young players: Roblox has rules about marketing to children and spending controls; follow the Creator Hub policies.
JS Which purchase type? A small chooser

Press Run (or Ctrl + Enter) to see the console output here.

No output.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. Which purchase type can a player buy many times?

    Developer products are repeatable, which makes them right for currency packs or revives. A gamepass is owned once.
  2. 2. When should ProcessReceipt return PurchaseGranted?

    Returning PurchaseGranted tells Roblox the purchase is complete. If you return it too early, a crash can lose what the player paid for.
  3. 3. Why record each PurchaseId in ProcessReceipt?

    Retries are possible, so an id set makes the handler idempotent.
  4. 4. Why should ownership checks use pcall?

    UserOwnsGamePassAsync contacts Roblox's servers, so errors must be handled.

Summary

  • Gamepasses are one-time ownership; developer products are repeatable; Premium payouts reward engagement.
  • Create passes and products in the Creator Hub and keep their IDs in one module.
  • Prompt purchases with MarketplaceService, but decide and grant on the server, with pcall around network calls.
  • Assign ProcessReceipt once, grant exactly once by tracking PurchaseId, and return NotProcessedYet on failure.
  • Sell honestly and fairly; check the Creator Hub for current prices, payouts and policies.

Next: Live Operations: Analytics, Performance and Updates