Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Help with the develeopr product thing

I went to the test place to try it out, and when I bought the sample product, it worked. So I created my own DP, and put the ID in the script. I joined a game, and when I clicked on the thing, and bought it, it said roblox was still doing maitmense on it. So... It was either that, or it was my coding.

-- setup local variables local MarketplaceService = Game:GetService("MarketplaceService") local ds = game:GetService("DataStoreService"):GetDataStore("PurchaseHistory") local productId = "19320781"

-- define function that will be called when purchase finished MarketplaceService.ProcessReceipt = function(receiptInfo)

-- find the player based on the PlayerId in receiptInfo
for i, player in ipairs(game.Players:GetChildren()) do
if player.userId == receiptInfo.PlayerId then

-- check which product was purchased
if receiptInfo.ProductId == productId then

-- handle purchase. In this case we are healing the player.
MorePoints = player.leaderstats.Credits + 100

-- more feedback for the player.
game.Workspace.DisplayScreen.SurfaceGui.TextBox.Text = player.Name .. " has purchased a healing potion."
end
end
end 

-- record the transaction in a Data Store
local playerProductKey = "player_" .. receiptInfo.PlayerId .. "_purchase_" .. receiptInfo.PurchaseId
ds:IncrementAsync(playerProductKey, 1) 

-- tell ROBLOX that we have successfully handled the transaction
return Enum.ProductPurchaseDecision.PurchaseGranted 

end

1 answer

Your code should be fine. PromptProductPurchase is working for me, try again.

5 comments

0

It will wont work

0

Where do you prompt the purchase?

0

I made the at one of my games. I'll give the link. I tried it again, and it worked, but it didn't give +100 Credits to my credits stats. http://www.roblox.com/Teston-place?id=146688974

0

Is 19320781 the correct product ID?

0

Yes. Its correct

This discussion is preserved as it was. New answers, comments, and votes are closed.