marketplaceService.ProcessReceipt firing multiple times?

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

Fixed it, this line had to be wrapped in a pcall.

Having thesame issue

MarketplaceService.ProcessReceipt = function(receiptInfo)
	local player = Players:GetPlayerByUserId(receiptInfo.PlayerId)
	if player.Parent then 
		local productName = getProductNameFromId(receiptInfo.ProductId)
		if productName then
			ProductService.DevProductPurchased:Fire(player, productName, receiptInfo)
			local handler = DevProductFunctions[productName]
			local success, result = pcall(handler, player, receiptInfo)
			if success and result then
				return Enum.ProductPurchaseDecision.PurchaseGranted
			end
			return Enum.ProductPurchaseDecision.NotProcessedYet
		end
		return Enum.ProductPurchaseDecision.PurchaseGranted
	else
		return Enum.ProductPurchaseDecision.NotProcessedYet
	end
end