I have an obby, and there is a skip stage button. There is a skip 10 stages, and skip 1. The skip 1 works fine, but skip 10 is broken. Here is the local script in it:
local productId = 53038472 local player = game.Players.LocalPlayer script.Parent.MouseButton1Click:connect(function() game:GetService("MarketplaceService"):PromptProductPurchase(player, productId) end)
Here is the other script that isnt local:
MarketplaceService = game:GetService("MarketplaceService") MarketplaceService.ProcessReceipt = function(receiptInfo) players = game.Players:GetPlayers() currency = "Stage" done = 0 for i=1,#players do if players[i].userId == receiptInfo.PlayerId then if receiptInfo.ProductId == 53038472 and done == 0 then done = 1 players[i].leaderstats[currency].Value = players[i].leaderstats[currency].Value + 10 players[i].Character.Humanoid.Health = 0 done = 0 end end end return Enum.ProductPurchaseDecision.PurchaseGranted end
these seem so perfect, whats wrong?
Check your output and see what ends up printing.
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 == 53038472 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 + 10 player:LoadCharacter() end end end return Enum.ProductPurchaseDecision.PurchaseGranted end
it's easy to make skip stage script working i made video this helpful
watch the video and do it and iam sure this will work with you