Why isn't this dev product not working

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve?

A dev product that actually works!

  1. What is the issue?

The issue is when you buy the dev product it doesn’t add the value to the donations!

  1. What solutions have you tried so far?

Finding a solution!

local MarketplaceService = game:GetService("MarketplaceService")
local DataStoreService = game:GetService("DataStoreService")

local PreviousPurchases = DataStoreService:GetDataStore("PreviousPurcchasesV1")

local givedonationrobux = 1197427516

MarketplaceService.ProcessReceipt = function(receipt)

	local ID = receipt.PlayerId.."-"..receipt.PurchaseId

	local success = nil

	pcall(function()
		success = PreviousPurchases:GetAsync(ID)
	end)

	if success then
		return Enum.ProductPurchaseDecision.PurchaseGranted
	end

	local player = game.Players:GetPlayerByUserId(receipt.PlayerId)

	if not player then
		return Enum.ProductPurchaseDecision.NotProcessedYet

	else

		if receipt.ProductId == givedonationrobux then
			player["R$ Donated"].Value = player["R$ Donated"].Value + 5

		end

		pcall(function()
			PreviousPurchases:SetAsync(ID,true)
		end)
		return Enum.ProductPurchaseDecision.PurchaseGranted

	end

end

Thank you in advance!

I just ran your script on studio and it worked perfectly fine for me. Maybe there’s no instance called ‘R$ Donated’ located in the player.

It is okay now it has been fixed thank you though!

1 Like