These scripts are supposed to add 1 to the Value of Stage when one buys the developer product but so far it is loading to purchase but** nothing is happening after you pay**.
I have 2 scripts, this one is placed inside the player:
local MarketplaceService = game:GetService("MarketplaceService")
local ds = game:GetService("DataStoreService"):GetDataStore("PurchaseHistory")
local player = game.Players.LocalPlayer
local stage = player.leaderstats:findFirstChild("Stage")
CASHID = 24397415 -- Put the Developer Product ID here
MarketplaceService.ProcessReceipt = function(receiptInfo)
local playerProductKey = "player_" .. receiptInfo.PlayerId .. "_product_" .. receiptInfo.ProductId
local numberBought = ds:IncrementAsync(playerProductKey, 1)
for i,v in pairs (game.Players:GetChildren()) do
if v.userId == receiptInfo.PlayerId then
if receiptInfo.ProductId == CASHID then
if stage.Value < 25 then
stage.Value = stage.Value + 1
wait(1)
player.Character.Head:Remove()
end
end
end
end
end
return Enum.ProductPurchaseDecision.PurchaseGranted
This one is placed in the button of the GUI
local productId = 24397415
local player = game.Players.LocalPlayer
script.Parent.MouseButton1Click:connect(function()
game:GetService("MarketplaceService"):PromptProductPurchase(player, productId)
end)

1 comment
I'm not sure of it yet, but it seems that instead of creating this stage variable, rather use the v variable which stand for the player that bought the product, I'm not 100% sure but if you look at the tutorial on the roblox wiki (http://wiki.roblox.com/index.php/Developer_product) it references the player's leaderstats by using the for loop, otherwise good luck, someone will figure it out :P