I am wondering how to do this. I checked the wiki, but it was all very confusing. I got 4 dev products so far, and like it says in wiki only 1 works.

Local Script

local MarketplaceService = game:GetService("MarketplaceService")
local buyButton = script.Parent
local productId = 104751988
player = game.Players.LocalPlayer 
buyButton.MouseButton1Click:connect(function()
	MarketplaceService:PromptProductPurchase(player, productId)
end)

Server Script:

local MarketplaceService = game:GetService("MarketplaceService")
local productId = 104751988

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 +500
	return Enum.ProductPurchaseDecision.PurchaseGranted		
end
end
end
end

Im wondering if its possible to name these each something different, like maybe MarketplaceService:PromptProductPurchase2(player, productId).

If there is no easier way, i guess ill just do what it says in wiki. Thanks if you help!

2 comments

0

Lua is not made for your convenience and adding every detail. It is not going to add every little bit of calculation into a function. There are a lot of math functions I'd like them to add, but we can't add a billion more functions.

0

Ok thanks for the comment. I literally just made a new script and added them all into it and calling them by different functions instead of what i did above.