Someone purchased a product and now they get infinite items given to them. Unsure what’s wrong but clearly its not saving or updationg correctly. This was taken from the devhub example. There’s no specific line on the error, so unsure what part is errroirng
local Success, IsPurchaseRecorded = pcall(function()
return PurchaseHistoryStore:UpdateAsync(PlayerProductKey, function(alreadyPurchased)
if alreadyPurchased then
return true
end
-- Find the player who made the purchase in the server
local Player = Players:GetPlayerByUserId(receiptInfo.PlayerId)
if not Player then -- The player probably left the game / if they come back, the callback will be called again
return nil
end
local Processed, Result = self:ProcessProduct(receiptInfo)
if not Processed then -- Granting the product failed, do NOT record the purchase
warn(
"Failed to process a product purchase for ProductId:",
receiptInfo.ProductId,
" Player:",
Player,
Result
)
return nil
end
-- Product successfully purchased + reward given to player
self.Client.ProductPurchased:Fire(Player, receiptInfo) -- Client fire
self.ProductPurchased:Fire(receiptInfo) -- Server fire
return true
end)
end)