the script show's no error but it doesn't reward the player

MarketplaceService.ProcessReceipt = function(receiptInfo)
	--//LOCALS
	local player = Players:GetPlayerByUserId(receiptInfo.PlayerId)
	local amount = Products[receiptInfo.ProductId]
	
	local plrId = receiptInfo.PlayerId
	local purchasedId = receiptInfo.ProductId

	for i, pass in pairs(gamepasses) do

		local passId = pass[1]
		local productId = pass[2]
		local giftUserId = playersGifted[plrId]		
		
	local function ForSelf()
		local Success, Error = pcall(function()
		local player = Players:GetPlayerByUserId(receiptInfo.PlayerId)
		local amount = Products[receiptInfo.ProductId]

		player.leaderstats.Donated.Value += amount or 0
		player.playerstats.Dpoints.Value += amount or 0
		end)
	
	if Success then 
		return Enum.ProductPurchaseDecision.PurchaseGranted	
	else 
		warn(Error)
		return Enum.ProductPurchaseDecision.NotProcessedYet
	end 
end
				
	local function ForSomeone()
		if giftUserId then
			playersGifted[plrId] = nil

		local success, err = pcall(function()
			giftedData:SetAsync(giftUserId .. "-" .. passId, true)
		end)
				
				if success then	
					return Enum.ProductPurchaseDecision.PurchaseGranted
				else
					return Enum.ProductPurchaseDecision.NotProcessedYet
				end	
			end
			
		
			
		
		if purchasedId == productId then
			ForSomeone()
		else
				ForSelf()
			end
		end
	end
end
****

1 comment

0

On line 58 why are there ***** these could be the error of your script