Friday, May 3, 2013

Sell Game Passes and Gear in Your Game Today!


ROBLOX has had its own virtual economy since 2007 and, last year, we introduced two new features–Game Passes and Affiliate Gear Sales–that started to close the gap between the economy and building. We promised then that we’d eventually complete the circle and implement the ability for builders to sell items in-game. Today, after a lengthy public test in ROBLOX Battle, we’ve successfully enabled in-game transactions across all games in ROBLOX.

Builders can implement in-game sales by utilizing “MarketplaceService”, a new addition to ROBLOX’s Lua API. This new service features several useful aspects, the main one being the “PromptPurchase” function, which will allow you to prompt players to buy items in your games. Another useful aspect is the “GetProductInfo” function, which will allow you to see various stats of in-game sale items, including a description and cost of the item. We tested this API in ROBLOX Battle in the form of a store, though how you choose to implement the code is entirely your decision.

You could script a store in your game. You could create bots that have the ability to chat with other users about selling gear or items. You could even program a single brick to bring up a catalog of your items as soon as it’s touched. The possibilities are endless.


To make it easy for you to get a start, we’ve developed this model of a vending machine that has all the necessary code needed for you to start selling Game Passes and gear in your game. To start out, it’s worth opening the model in Studio to take a better look.

Here’s how to do it:

  • Click “Take one” at the Bloxy Cola Model page
  • Open ROBLOX Studio
  • Click “View” then click “Toolbox Objects”
  • Sort by “Recent Models” to find the vending machine, which should be at the top of that list
  • Drag the model into your place
  • In your Explorer window, double click the item called “BloxyColaVendingMachine” to access its drop-down menu
  • To look at/manipulate the script, double click “Script”
Once you’ve opened the script, you can manipulate the code to attach the “PromptPurchase” function to whatever part or model you’d like.
This is the untouched script using the “PromptPurchase” function:


Though in these examples we’re calling “PromptPurchase” server-side, it also works when called from a “LocalScript” as well.
We’re hoping this gives you a general idea of how to manipulate this new feature. As we stated before, you can go far beyond this with a little scripting knowledge. We encourage builders to take this code and find unique ways to leverage it.

New Feature, Same Rules

All of the current financial rules of ROBLOX apply to the in-game sales as well–selling Game Passes in-game will earn you 70% of the total cost of the pass, while you still get to keep 10% of affiliate gear sales (also known as our Add Gear to Game feature). We’re excited to see how users will leverage this ability inside their virtual worlds, and are eager to see what form factors become popular.


1 comment: