Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Why is my developer product not working?

Hi! I am trying to make a developer product for my Tycoon. For example I want the product to give $500 cash when a player buys it for $50 robux. I did the scripting and it does not work I will list them

ServerScriptService:

local MarketplaceService = game:GetService('MarketplaceService')
local devproductid = 46984208 -- 500 cash

MarketplaceService.ProcessReceipt = function(receiptInfo)
	for i, player in ipairs(game.Players:GetChildren()) do
		if player.userId == receiptInfo.PlayerId then
			if receiptInfo.ProductId == devproductid then
				
				-- give them cash
				player.leaderstats.Cash.Value = player.leaderstats.Cash.Value + 500
			end
		end
		
	end
	return Enum.ProductPurchaseDEcision.PurchaseGranted
end

Workspace:

game.Players.PlayerAdded:connect(function(plr)
	local stats = Instance.new('BoolValue', plr)
	stats.Name = 'leaderstats'
	local cash = Instance.new('IntValue', stats)
	cash.Name = 'Cash' 	
	cash.Value = 0 
end)



Gui (local script):

local button = script.Parent
local devproductid = 46984208

button.MouseButton1Click:connect(function()
	game:getSerivce('MarketplaceService'):PromotProductPurchase(game.Players.LocalPlayer, devproductid)
end)

If anyone knows why it wont work please help! All appreciated :)

1 comment

0

Please fix your codeblocks ;)

1 answer

This discussion is preserved as it was. New answers, comments, and votes are closed.