local function Z(Z)local q=Players:GetPlayerByUserId(Z.PlayerId)if q then if Z.ProductId==TIER_SKIP_ID then print(q.Name.." \115\107\105\112\112\101\100 \097 \116\105\101\114")local Z=script.Parent.Ranking.RankingScript.SkipTier:Invoke(q)if Z then return Enum.ProductPurchaseDecision.PurchaseGranted else return Enum.ProductPurchaseDecision.NotProcessedYet end elseif CURRENCY_IDS[Z.ProductId]then local C=CURRENCY_IDS[Z.ProductId]local A=PLAYER_DATA:FindFirstChild(q.Name)if A then print(q,"\112\117\114\099\104\097\115\101\100",C,"\116\105\099\107\101\116\115")A.Currency.Tickets.Value=A.Currency.Tickets.Value+C local Z=script.Parent.DataScript.SaveData:Invoke(q)if Z 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
-- functions

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
