DevProducts Issue

I am trying to make a script where whenever a player purchases a devproduct, they get 100 cash.

Cash is a value parented to the leaderstats folder which is parented to the player.

My script does not work, it doesn’t give the player 100 cash, and the prints below it do not work.


local MPS = game:GetService("MarketplaceService")
local players = game:GetService("Players")

local product_ID = 1550657334


local function processReceipt(receiptinfo)

	local player = players:GetPlayerByUserId(receiptinfo.PlayerId)

	if not player then
		-- Player probably left	
		-- If they comeback, callback will be acalled again
		return Enum.ProductPurchaseDecision.NotProcessedYet

	end
	if receiptinfo.ProductID == product_ID then

		if player then
			-- What you want devproduct to do
			local char = player.Character




			player:WaitForChild("leaderstats").Cash.Value += 100
			print(player.Name .. "has recieved 100 cash :" .. receiptinfo.ProductId)

		end
	end
	return Enum.ProductPurchaseDecision.PurchaseGranted
end

-- Set Callback
MPS.ProcessReceipt = processReceipt

Well, you may, or may not have misspelled ProductId as ProductID, :/

:smiling_face_with_tear: That was the problem thank you

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.