Developer Products For Points?

Greetings, DevForum

I’m a scripter that can script many things on Roblox. However, I can’t seem to find a way to script developer products, and once someone buys it, it gives them points through their leader stats points. How do I accomplish this?

I’ve tried to read many sources such as developer.roblox.com and still confused about how to do it.

1 Like

Take a look at this
Developer Products there is exactly the thing you want

I’ve already told you, I’ve read some resources such as developer.roblox.com, but I can’t see to find the answer.

The thing you are looking is literally the bottom of the link i gave

anyways this is the modified script

local MarketplaceService = game:GetService("MarketplaceService")

local Products = {
	
	[0]=function(receipt,player) --product id here
		player.leaderstats.Gems.Value = player.leaderstats.Gems.Value + 5
	end;
	

}

function MarketplaceService.ProcessReceipt(receiptinfo)
	local playerProductKey = receiptinfo.PlayerId..":"..receiptinfo.PurchaseId
	local plr = game:GetService("Players"):GetPlayerByUserId(receiptinfo.PlayerId)
	
	local handler
	for ProductId,func in pairs(Products) do
		if ProductId == receiptinfo.ProductId then
			handler = func break
		end
	end
	
local suc = pcall(handler,receiptinfo,plr)
return Enum.ProductPurchaseDecision.PurchaseGranted
end

for prompt

local productId = 0 --id

local player = game.Players.LocalPlayer

script.Parent.MouseButton1Click:connect(function()

game:GetService("MarketplaceService"):PromptProductPurchase(player, productId)

end)

You should consider taking a look at the .ProcessReceipt function of MarketPlaceService. This method fires after a developer product has been bought. Using this method you could, for instance, add points to a leaderboard. It has a really great example script that should be relatively easy to use.

Top one should be script in ServerScriptService and bottom one should be local script in your gui button placed in your button