Ok,so I finded a script on youtube and I get a error here is the script and the error:
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 == 1169323090 and done == 0 then done = 1 players[i].leaderstats[currency].Value = players[i].leaderstats[currency].Value + 1 players[i].Character.Humanoid.Health = 0 done = 0 end end end return Enum.ProductPurchaseDecision.PurchaseGranted
end
ERROR: Workspace.Script:10: Expected 'do' when parsing for loop, got Unicode character U+200b - Studio - Script:10
i would use productfinished
game:GetService'MarketplaceService'.PromptProductPurchaseFinished:Connect(function(userId, productId, didBuy) -- userId is the players userid (player.UserId) -- productId is the id of product -- didBuy is if they bought, canceled, or error (true or false) if didBuy and productId == 1169323090 then -- think its didBuy. could be if not didBuy local player = game.Players:GetPlayerByUserId(userId) -- get player. you have userid (do somethin like this) player.leaderstats.Stage.Value += 1 end end)
I haven't tested this but try this instead
currency = "Stage" done = 0 for i,v in pairs(game.Players:GetChildren()) do if v.UserId == receiptInfo.PlayerId then if receiptInfo.ProductId == 1169323090 and done == 0 then done = 1 players[i].leaderstats[currency].Value = players[i].leaderstats[currency].Value + 1 players[i].Character.Humanoid.Health = 0 done = 0 end end end return Enum.ProductPurchaseDecision.PurchaseGranted
Also sorry if I misunderstood that but I think this should work.
I haven't tested this but try this instead
currency = "Stage" done = 0 for i,v in pairs(game.Players:GetChildren()) do if v.UserId == receiptInfo.PlayerId then if receiptInfo.ProductId == 1169323090 and done == 0 then done = 1 players[i].leaderstats[currency].Value = players[i].leaderstats[currency].Value + 1 players[i].Character.Humanoid.Health = 0 done = 0 end end end return Enum.ProductPurchaseDecision.PurchaseGranted
Also sorry if I misunderstood that but I think this should work.