This is complicated to explain but the first time I test purchase a producted it will give me the specified amount of coins, let's say 3000, but if I repeat this in the same session it will give me 6000 coins the next time, then 9000 and so forth.

Here is the code after clicking on the picture which prompts the purchase:

`` local MarketplaceService = game:GetService("MarketplaceService") local Players = game:GetService("Players")

local Coins3000 = 1050127294 local Coins15000 = 1050275031 local Coins50000 = 1050293858 local Coins150000 = 1050298477 local MCoins5 = 1050377045 local MCoins30 = 1050381781 local MCoins100 = 1050390113 local MCoins225 = 1050393257

local function processReceipt(receiptInfo) local player = Players:GetPlayerByUserId(receiptInfo.PlayerId) if not player then return Enum.ProductPurchaseDecision.NotProcessedYet end if receiptInfo.ProductId == Coins3000 then if player then player.leaderstats.Coins.Value = player.leaderstats.Coins.Value + 3000 print(player.Name.. " just bought " .. receiptInfo.Coins3000) end end

if receiptInfo.ProductId == Coins15000 then
	if player then
		player.leaderstats.Coins.Value = player.leaderstats.Coins.Value + 15000
		print(player.Name.. " just bought " .. receiptInfo.Coins15000)
	end
end

if receiptInfo.ProductId == Coins50000 then
	if player then
		player.leaderstats.Coins.Value = player.leaderstats.Coins.Value + 50000
		print(player.Name.. " just bought " .. receiptInfo.Coins50000)
	end
end

if receiptInfo.ProductId == Coins150000 then
	if player then
		player.leaderstats.Coins.Value = player.leaderstats.Coins.Value + 150000
		print(player.Name.. " just bought " .. receiptInfo.Coins150000)
	end
end
if receiptInfo.ProductId == MCoins5 then
	if player then
		player.leaderstats["M-Coins"].Value = player.leaderstats["M-Coins"].Value + 5
		print(player.Name.. " just bought " .. receiptInfo.MCoins5)
	end
end
if receiptInfo.ProductId == MCoins30 then
	if player then
		player.leaderstats["M-Coins"].Value = player.leaderstats["M-Coins"].Value + 30
		print(player.Name.. " just bought " .. receiptInfo.MCoins30)
	end
end
if receiptInfo.ProductId == MCoins100 then
	if player then
		player.leaderstats["M-Coins"].Value = player.leaderstats["M-Coins"].Value + 100
		print(player.Name.. " just bought " .. receiptInfo.MCoins100)
	end
end
if receiptInfo.ProductId == MCoins225 then
	if player then
		player.leaderstats["M-Coins"].Value = player.leaderstats["M-Coins"].Value + 225
		print(player.Name.. " just bought " .. receiptInfo.MCoins225)
	end
end
return Enum.ProductPurchaseDecision.PurchaseGranted

end

MarketplaceService.ProcessReceipt = processReceipt ``

This is the Code that allows the above to take place:

local MarketplaceService = game:GetService("MarketplaceService") local Players = game:GetService("Players") local player = game.Players.LocalPlayer

local MCoins100 = 1050390113

script.Parent.MouseButton1Click:Connect(function()

MarketplaceService:PromptProductPurchase(player, MCoins100)

end)

3 comments

0

The second code btw is a sample, since for each product I have the same code but with the corresponding ID's

0

This is strange, I removed the all print() and it works now, does anyone know why??

0

I can't read the code, please correctly format it