I've been trying to make a dev product, and make it give a currency when they buy it but it isn't working, even though I'm pretty sure I have all the syntax correct, and it isn't showing an error.

Here is my script:

local productID = 1270692852

local MPS = game:GetService('MarketplaceService')

local function processRecipet(RecieptInfo)
	
	local plr = game.Players:GetPlayerByUserId(RecieptInfo.PlayerId)
	
	if not plr  then
		-- plr probably left.
		return Enum.ProductPurchaseDecision.NotProcessedYet
	end
	
	if RecieptInfo.PurchaseId == productID then
		local leaderstats = plr:WaitForChild('leaderstats')
		local Gems = leaderstats:WaitForChild('Gems')
		Gems.Value = Gems.Value + 50
	end

	
	return Enum.ProductPurchaseDecision.PurchaseGranted
	
end

-- call back

MPS.ProcessReceipt = processRecipet

This is where I'm trying to give the currency:

	if RecieptInfo.PurchaseId == productID then
			local leaderstats = plr:WaitForChild('leaderstats')
			local Gems = leaderstats:WaitForChild('Gems')
			Gems.Value = Gems.Value + 50
	end

All of this is in a server script in ServerScriptService.

1 comment

0

I figured it out, I just changed purchaseId to ProductId.