Gives player 100 cash when they buy the developer product. Why doesn't it work?

local MarketPlaceService = game:GetService("MarketplaceService")
local ProductId = 85734826 
local Cash = 100

MarketPlaceService.ProcessReceipt = function(receiptInfo)
	for i, player in ipairs (game.Players:GetChildren()) do
		if player.userId == receiptInfo.PlayerId then
			if receiptInfo.ProductId == ProductId then
				
				player.leaderstats.Money.Value = player.leaderstats.Money.Value + Cash
			end
		end
	end
	return Enum.ProductPurchaseDecision.PurchaseGranted
end

3 comments

0

Do you have a developer pass already made? If so, are you in Studio?

0

Don't use ipairs

0

I have dev pass made, I am in Studio @Admin8483