local function p(p)local n=Players:GetPlayerByUserId(p.PlayerId)if n then if p.ProductId==TIER_SKIP_ID then print(n.Name.." \115\107\105\112\112\101\100 \097 \116\105\101\114")local p=script.Parent.Ranking.RankingScript.SkipTier:Invoke(n)if p then return Enum.ProductPurchaseDecision.PurchaseGranted else return Enum.ProductPurchaseDecision.NotProcessedYet end elseif CURRENCY_IDS[p.ProductId]then local T=CURRENCY_IDS[p.ProductId]local y=PLAYER_DATA:FindFirstChild(n.Name)if y then print(n,"\112\117\114\099\104\097\115\101\100",T,"\116\105\099\107\101\116\115")y.Currency.Tickets.Value=y.Currency.Tickets.Value+T local p=script.Parent.DataScript.SaveData:Invoke(n)if p then return Enum.ProductPurchaseDecision.PurchaseGranted else return Enum.ProductPurchaseDecision.NotProcessedYet end else return Enum.ProductPurchaseDecision.NotProcessedYet end end else return Enum.ProductPurchaseDecision.NotProcessedYet end end


local function ProcessReceipt(receiptInfo)
	local player	= Players:GetPlayerByUserId(receiptInfo.PlayerId)
	if player then
		if receiptInfo.ProductId == TIER_SKIP_ID then
			print(player.Name .. " skipped a tier")
			local success	= script.Parent.Ranking.RankingScript.SkipTier:Invoke(player)
			if success then
				return Enum.ProductPurchaseDecision.PurchaseGranted
			else
				return Enum.ProductPurchaseDecision.NotProcessedYet
			end
		elseif CURRENCY_IDS[receiptInfo.ProductId] then
			local tickets		= CURRENCY_IDS[receiptInfo.ProductId]
			local playerData	= PLAYER_DATA:FindFirstChild(player.Name)
			
			if playerData then
				print(player, "purchased", tickets, "tickets")
				playerData.Currency.Tickets.Value	= playerData.Currency.Tickets.Value + tickets
				local success	= script.Parent.DataScript.SaveData:Invoke(player)
				if success then
					return Enum.ProductPurchaseDecision.PurchaseGranted
				else
					return Enum.ProductPurchaseDecision.NotProcessedYet
				end
			else
				return Enum.ProductPurchaseDecision.NotProcessedYet
			end
		end
	else
		return Enum.ProductPurchaseDecision.NotProcessedYet
	end
end
