Help with purchase processing

the value ins’t going up correctly and usually adds the value of the previously purchased item and the one that was just purchased. this is for a donation booth game btw and the value will show up on the player’s booth to show how much robux it has raised based on how many items they sold (shirts, pants, etc)

local event = game.ReplicatedStorage.Main.PromptPurchase
local market = game:GetService("MarketplaceService")

event.OnServerEvent:Connect(function(player,Name,BoothOwner)
	market:PromptPurchase(player, Name)
	market.PromptPurchaseFinished:Connect(function(player, Name, isPurchased)
		local asset = game:GetService("MarketplaceService"):GetProductInfo(Name)
		if isPurchased then
			game.Players:FindFirstChild(BoothOwner).Raised.Value = game.Players:FindFirstChild(BoothOwner).Raised.Value + asset.PriceInRobux
		end
	end)
end)

You should be using the marketplace service’s ProcessReceipt callback to handle the purchases of developer products, i.e;

local event = game.ReplicatedStorage.Main.PromptPurchase
local market = game:GetService("MarketplaceService")
local players = game:GetService("Players")

local productId = 0

market.ProcessReceipt = function(receiptInfo)
	local player = players:GetPlayerByUserId(receiptInfo.PlayerId)
	if player then
		if receiptInfo.ProductId == productId then
			--Do code.
			return Enum.ProductPurchaseDecision.PurchaseGranted
		end
	else
		return Enum.ProductPurchaseDecision.NotProcessedYet
	end
end

You can learn more info here.
https://developer.roblox.com/en-us/api-reference/callback/MarketplaceService/ProcessReceipt

Good luck on your bootleg of “PLS DONATE”.

1 Like

ha ha thx. but u might be surprised. i might send u a link when i release it

This may serve some use to you.

1 Like

how do i get the actual product id instead of just 0