|
| 14 May 2014 08:22 PM |
How do I make it so when someone buys a Dev. product, it does some code
Ex.
Player buys a developer product for 10 robux and gets 50 in game currency
How do I make it give them the currency when they buy it? |
|
|
| Report Abuse |
|
|
|
| 14 May 2014 08:37 PM |
| http://wiki.roblox.com/index.php?title=ProcessReceipt_(Callback) |
|
|
| Report Abuse |
|
|
|
| 14 May 2014 08:38 PM |
| Would I just put this in a normal script, or would I put it with the button that buys the product. |
|
|
| Report Abuse |
|
|
|
| 14 May 2014 08:39 PM |
| Just a normal script inside of ServerScriptService. |
|
|
| Report Abuse |
|
|
|
| 14 May 2014 09:02 PM |
Ok so for the ID in that script, I put this in 19338332 which is the ID on the Dev. Product of the game (Its page)
and apparently it isnt for sale? |
|
|
| Report Abuse |
|
|
| |
|
|
| 14 May 2014 09:13 PM |
local mService = game:GetService("MarketplaceService") local ItemId = 0000 --ID here
function getPlayerById(id) for i,v in pairs(game.Players:GetPlayers()) do if v.userId == id then return v end end end
mService.ProcessReceipt = function(info) if info.ProductId == ItemId then local player = getPlayerById(info.PlayerId) if player then --script here return Enum.ProductPurchaseDecision.PurchaseGranted end end end |
|
|
| Report Abuse |
|
|
|
| 15 May 2014 02:20 PM |
The only problem is that when it goes to buy the developer product, it says it is "No Longer For Sale"
I used the script from the Bloxy Cola Machine, here is the script:
local bloxyColaId = 19338329
-- when a player clicks on the vending machine, ask if they want to buy bloxy cola script.Parent.ClickDetector.MouseClick:connect(function(player) Game:GetService("MarketplaceService"):PromptPurchase(player, bloxyColaId) end)
I customized it to fit the developer product that I have. Is there another way I should do this? |
|
|
| Report Abuse |
|
|
|
| 15 May 2014 02:35 PM |
Nevermind, it should have been this
local productId = 19338332 script.Parent.ClickDetector.MouseClick:connect(function(player) Game:GetService("MarketplaceService"):PromptProductPurchase(player, productId) -- should pop up a dialog that prompts the player end) |
|
|
| Report Abuse |
|
|