Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Developer Product Problem?

Asked by 9 years ago

I have a problem with Developer Products lately, When i hit the TextButton which revives/teleports you back to game, it doesnt show up the store, so the player cannot buy the Developer Product im a beginner to MarketplaceService, i only understand how Game Passes work for now...

local spawns = game.Workspace.DisappearingPlates.Spawner
local plr = script.Parent.Parent.Parent.Parent.Parent
local link = game:GetService("MarketplaceService")


script.Parent.MouseButton1Click:connect(function()
local marketId = 23552031
link:PromptProductPurchase(plr,marketId)
link.ProcessReceipt = function(receiptInfo)
if Enum.ProductPurchaseDecision.PurchaseGranted and receiptInfo.PlayerId == plr.userId then
plr.Character:MoveTo(spawns.Position)
plr.InGame = true
wait(1)
end
end
end)

1 answer

Log in to vote
1
Answered by
Goulstem 8144 Badge of Merit Moderation Voter Administrator Community Moderator
9 years ago

Your problem is that you're defining the ProcessReceipt after you already prompt the purchase Doing this will make it so if the player buys the Developer Product, nothing will happen and they will lose their money.

Also, your conditional on line 10 is using an Enum as a condition.. that doesn't make any sense. What you need to do is check if the receiptInfo.ProductId matches your predefined marketId - which by the way I suggest you move outside of the scope of the MouseButton1Click event.

Lastly, you NEED to return Enum.ProductPurchaseDecision.PurchaseGranted.. otherwise you will not gain any money from the purchase.

local spawns = game.Workspace.DisappearingPlates.Spawner
local plr = script.Parent.Parent.Parent.Parent.Parent
local link = game:GetService("MarketplaceService")
local marketId = 23552031

link.ProcessReceipt = function(receiptInfo)
    if receiptInfo.ProductId == marketId then
        plr.Character:MoveTo(spawns.Position)
        plr.InGame = true
        wait(1)
        return Enum.ProductPurchaseDecision.PurchaseGranted
    end
end

script.Parent.MouseButton1Click:connect(function()
    link:PromptProductPurchase(plr,marketId)
end)
Ad

Answer this question