When this gui text button is clicked, it's supposed to prompt the player to purchase a developer product, and if the purchase completes, they should get 10 credits, however, upon completion of the purchase, credits are not rewarded.

mps = game:GetService("MarketplaceService")
player = script.Parent.Parent.Parent.Parent
asset = 38970448
credits = 10
player:WaitForChild("leaderstats"):WaitForChild("Credits")

script.Parent.MouseButton1Click:connect(function()
 mps:PromptProductPurchase(player, asset)
end)

mps.PromptPurchaseFinished:connect(function(player, asset, i)
 if i then
  player.leaderstats.Credits.Value = player.leaderstats.Credits.Value + credits
 end
end)

1 comment

0

The PromptPurchaseFinished event should be done with a server script.