Hello!
I’ve run into this issue where .ProcessReceipt seems to fire multiple times and I’m not sure why. I’ve looked through my entire script and the function should only be called once but it’s being called multiple times. Any help?
Video of the issue:
local productFunctions = {
[13535231] = function(player)
print('gamepassfinished')
local playerData = player:WaitForChild('PlayerData')
local rank = playerData:WaitForChild('Rank')
local permission = permissionHandler:GetRankInfo(player)
if permission.Priority <= permissionHandler.RankInfo.Premium.Priority then
rank.Value = 'Premium'
playerData.Passes.Premium.Value = true
end
end;
[1157528698] = function(receiptInfo) -- Product I'm buying
print('productfinished')
local player = players:GetPlayerByUserId(receiptInfo.PlayerId)
local crateItems, wonItem = generateCrate('Godly')
if player then
local successful = awardItem(player, wonItem, 'RobuxCrate')
if successful then
return true
else
return false
end
else
return false, 'Player does not exist!'
end
end;
}
marketplaceService.ProcessReceipt = function(receiptInfo)
if not players:GetPlayerByUserId(receiptInfo.PlayerId) then
return Enum.ProductPurchaseDecision.NotProcessedYet
end
local success, errorMessage = productFunctions[receiptInfo.ProductId](receiptInfo)
if success then
return Enum.ProductPurchaseDecision.PurchaseGranted
else
return Enum.ProductPurchaseDecision.NotProcessedYet
end
end