Hi guys! I have a developer product. When you click on the textbutton it displays the roblox buy it now button, but for some reason it always fails. Any ideas?
--LocalScript in textbutton (in screengui)
local buyButton = script.Parent
local productId = 22343504
buyButton.MouseButton1Click:connect(function()
Game:GetService("MarketplaceService"):PromptProductPurchase(game.Players.LocalPlayer, productId)
end)
--Script in Workspace (Or can it be somewhere else?)
local MarketplaceService = Game:GetService("MarketplaceService")
local productId = 22343504
MarketplaceService.ProcessReceipt = function(receiptInfo)
for i, player in ipairs(game.Players:GetChildren()) do
if player.userId == receiptInfo.PlayerId then
if receiptInfo.ProductId == productId then
player.leaderstats.Money.Value = player.leaderstats.Money.Value + 5
end
end
end
return Enum.ProductPurchaseDecision.PurchaseGranted
end

8 comments
What's the error (if any)?
I am having no errors - it just says "Purchase failed" :(
Do you actually have a Dev product made? Correct hierarchy?
I have a dev product made.
And it is correct hierarchy - no errors and pretty sure :(
Anyone? ;(
I'm a newbie to developer products too. They never work for me. I wish I could help...
Try putting it in some "print" commands in there. So for every 5 lines, put a print command and make it say something unique. If one of them doesn't pop up, then that's where it errors. If you can narrow it down to the line that's not working, it could probably help a lot more.