I have an obby and there is a shop where you can buy a skip 1 stage, skip 3 stages, skip 5 stages or skip 10 stages. When I try to buy the skips, only one works... Here is the local script for the Gui:
local productId = 1051600749
local player = game.Players.LocalPlayer
script.Parent.MouseButton1Click:connect(function()
game:GetService("MarketplaceService"):PromptProductPurchase(player, productId)
end)
Here is the script that I put in "ServerScriptStorage":
local MarketplaceService = game:GetService("MarketplaceService")
local currency = "Stage"
MarketplaceService.ProcessReceipt = function(receiptInfo)
local player = game:GetService("Players"):GetPlayerByUserId(receiptInfo.PlayerId)
if not player then
return Enum.ProductPurchaseDecision.NotProcessedYet
end
if receiptInfo.ProductId == 1051600749 then
print("Correct receipt")
local leaderstats = player:findFirstChild("leaderstats")
if leaderstats then
print("Found leaderstats")
local currency = leaderstats:findFirstChild(currency)
if currency then
print("Found currency")
currency.Value = currency.Value + 1
player:LoadCharacter()
end
end
end
return Enum.ProductPurchaseDecision.PurchaseGranted
end
For every scripts, I changed the DeveloperProductId and the Value of the checkpoint to add.
When I try to buy the SkipStage that doesn't work, it doesn't print anything that I put in the script... (sorry for the spelling mistakes, English is not my native language)
What's wrong with these scripts ?
