Can anyone please go over this to see if this is coded correctly?
local MarketplaceService = game:GetService("MarketplaceService")
local ID = 00000
local PurchaseHistory = game:GetService("DataStoreService"):GetDataStore("PurchaseHistory")
local Currency = Points
local Amount = 100
MarketplaceService.ProcessReceipt = function(receiptInfo)
for i, player in ipairs(game.Players:GetChildren()) do
if player.userId == receiptInfo.PlayerId then
if receiptInfo.ProductId == ID then
player.leaderstats.Currency.Value = player.leaderstats.Currency.Value + Amount
end
end
end
local playerProductKey = "player_" .. receiptInfo.PlayerId .. "_purchase_" .. receiptInfo.PurchaseId
PurchaseHistory:IncrementAsync(playerProductKey, 1)
return Enum.ProductPurchaseDecision.PurchaseGranted
end
