I am having a problem with Skip stage dev product, It skips the stage fine but after the first purchase if you buy it again it will increase by two stages instead of one. Example: You are on stage 5 and skip to 6, if you try to skip from 6 to 7 you go to 8 instead and it increases by 1 so forth, how do I prevent this?
Button 4 purchase
local productId = 106153320
script.Parent.MouseButton1Click:connect(function()
game:GetService("MarketplaceService"):PromptProductPurchase(game.Players.LocalPlayer, productId)
end)
ServerScriptService
local MarketplaceService = game:GetService("MarketplaceService")
local ds = game:GetService("DataStoreService"):GetDataStore("PurchaseHistory")
local productId = 106153320
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.Stage.Value = player.leaderstats.Stage.Value + 1
player.Character.Humanoid.Health = 0
end
end
end
local playerProductKey = "player_" .. receiptInfo.PlayerId .. "_purchase_" .. receiptInfo.ProductId
ds:IncrementAsync(playerProductKey, 0)
return Enum.ProductPurchaseDecision.PurchaseGranted
end

3 comments
Bump?
don't use ipairs no where would it be nil and ipairs is slower than pairs
Tried without, same problem..