MarketPlace Process Receipt Not Being Detected

  1. What do you want to achieve?

A simple script that checks if a player bought something in the game. If they did, then check how much it cost and who sold it. Change the datastores “Raised” and “Donated” to the correct values, and then display the donation emitter and text. Its like the “Please donate game”

  1. What is the issue?

MarketPlace is not getting the process receipt in game? We’ve tested in studio and it will print “data” correctly. Though in game it for some reason just doesn’t do anything at all? Why could this be? Also doesn’t add the values to the Donated, or Raised using Datastore2?

Could it be because of the warning “[Player] appears to be spamming remote events”

  1. What solutions have you tried so far?
MarketplaceService.ProcessReceipt = function(receiptInfo)
	local player = Players:GetPlayerByUserId(receiptInfo.PlayerId)
	if player then
		player.leaderstats.Donated.Value += receiptInfo.CurrencySpent
		local DonatedStore = DataStore2("Donated", player) 
		DonatedStore:Increment(receiptInfo.CurrencySpent)

		local data = MarketplaceService:GetProductInfo(receiptInfo.ProductId, Enum.InfoType.Asset)

		if data then
			local GotDonatedName = data.Creator.Name
			local GotDonatedPlr = game:GetService("Players")[GotDonatedName]
			GotDonatedPlr.leaderstats.Raised.Value += receiptInfo.CurrencySpent

			local RaisedStore = DataStore2("Raised", GotDonatedPlr)

			RaisedStore:Increment(receiptInfo.CurrencySpent)

			local Stands = workspace:FindFirstChild("Stands")
			local StandDescendants = Stands:GetDescendants()

			for _, Object in ipairs(StandDescendants) do
				if Object:IsA("TextLabel") and Object.Name == "MoneyRaised" then
					local Amount = RaisedStore:Get()
					print(Amount)
					Object.Text = Amount .. "$ Raised"
				elseif Object:IsA("ParticleEmitter") and Object.Name == "Money" then
					Object:Emit(15)
					local Sound = Object.Parent:FindFirstChildOfClass("Sound")
					Sound:Play()
				end
			end

			return Enum.ProductPurchaseDecision.PurchaseGranted
		else
			return Enum.ProductPurchaseDecision.NotProcessedYet
		end
	end

This is likely related to your issue.

Because purchases in studio are free the “CurrencySpent” key is always 0 of the dictionary value the “ReceiptInfo” parameter points/refers to.

1 Like