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

Developer Product: 2 Different purchase buttons but give the same thing?

I have a GUI which has 2 different developer products to buy, but both of them give me the same purchase? One is for 1000 credits, the other is for 5000. The 1000 one works fine but when i press on the 5,000 one, it prompts me for the right id but then only gives me 1000 credits, please help. Code inside purchase buttons:

local main = script.Parent
local button = script.Parent
local MarketPlaceService = game:GetService("MarketplaceService")
local players = game:GetService("Players")
local ProductId = 985109115
local player = game.Players.LocalPlayer




button.MouseButton1Down:Connect(function()
	MarketPlaceService:PromptProductPurchase(player, ProductId)
	

end)
	
		
	
local main = script.Parent
local button = script.Parent
local MarketPlaceService = game:GetService("MarketplaceService")
local players = game:GetService("Players")
local ProductId = 982191893
local player = game.Players.LocalPlayer




button.MouseButton1Down:Connect(function()
	MarketPlaceService:PromptProductPurchase(player, ProductId)

end)
	
		

scripts inside ServerScriptService:

local MarketPlaceService = game:GetService("MarketplaceService")
local players = game:GetService("Players")
local ProductId = 982191893

local function processReceipt(receiptInfo)
	local player = players:GetPlayerByUserId(receiptInfo.PlayerId)
	if not player then
		return Enum.ProductPurchaseDecision.NotProcessedYet
	end
		
		if player then
			local new = player.leaderstats.Credits.Value + 1000
	print ("Working")
		game.Workspace.Sounds.PurchaseSound:Play()
			
	player.leaderstats.Credits.Value = new
		end
		return Enum.ProductPurchaseDecision.PurchaseGranted
end


MarketPlaceService.ProcessReceipt = processReceipt
local MarketPlaceService = game:GetService("MarketplaceService")
local players = game:GetService("Players")
local ProductId = 985109115

local function processReceipt(receiptInfo)
	local player = players:GetPlayerByUserId(receiptInfo.PlayerId)
	if not player then
		return Enum.ProductPurchaseDecision.NotProcessedYet
	end
		
		if player then
	print ("Working")
		game.Workspace.Sounds.PurchaseSound:Play()
			local new = player.leaderstats.Credits.Value + 5000
	player.leaderstats.Credits.Value = new
		end
		return Enum.ProductPurchaseDecision.PurchaseGranted
end


MarketPlaceService.ProcessReceipt = processReceipt

Thanks.

1 answer

I found the problem, I just need to assign the ProductId into this script but where and how would i do it?

local MarketPlaceService = game:GetService("MarketplaceService")
local players = game:GetService("Players")
local ProductId = 985109115

local function processReceipt(receiptInfo)
	local player = players:GetPlayerByUserId(receiptInfo.PlayerId)
	if not player then
		return Enum.ProductPurchaseDecision.NotProcessedYet
	end
		
		if player  then
	print ("Working")
		game.Workspace.Sounds.PurchaseSound:Play()
			local new = player.leaderstats.Credits.Value + 5000
	player.leaderstats.Credits.Value = new
		end
		return Enum.ProductPurchaseDecision.PurchaseGranted
end


MarketPlaceService.ProcessReceipt = processReceipt

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