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

What are developer products and how do i make one?

What are developer products and how do i make one?

2 answers

✓ Accepted answer

Along with the Wiki post, here's an example.

h.ClickDetector.MouseClick:connect(function(p) -- I happened to have my event fire from a ClickDetector
		game:GetService("MarketplaceService"):PromptProductPurchase(p, id) -- Make them purchase it.
		-- setup local variables
local MarketplaceService = Game:GetService("MarketplaceService")
local ds = game:GetService("DataStoreService"):GetDataStore("PurchaseHistory")
MarketplaceService.ProcessReceipt = function(receiptInfo) -- Basically, a digital reciept
		if p.userId == receiptInfo.PlayerId then
			if receiptInfo.ProductId == id then
				p.Character.Humanoid.Health = p.Charaacter.Humanoid.Health + 150
		end
	end	
	
	-- record the transaction in a Data Store
	local playerProductKey = receiptInfo.PlayerId .. "_got_" .. receiptInfo.PurchaseId -- Logs it in Data Store
	ds:IncrementAsync(playerProductKey, 1)	
	
	-- tell ROBLOX that we have successfully handled the transaction
	return Enum.ProductPurchaseDecision.PurchaseGranted		
	
	end
end)

Developer products can be purchased multiple times by anyone. Yes, that includes the owner of the game as well. There's many uses for them such as buying an in-game house, buying in-game currency, etc. The possibilities are limitless.

2 comments

0

Thanks!

0

No problem.

Here's the link to the wiki to help you get started on Developer Products: Developer Products Wiki Page

It'll explain how you create your own Developer Products and provide some example scripts on how to set-up a shop.

1 comment

0

Please do not just provide a Wiki link. Provide an explanation

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