local Marketplace = game:GetService("MarketplaceService")
local developerid = 47147513
local crate = game.ReplicatedStorage:FindFirstChild("CashBox")

Marketplace.ProcessReceipt = function(receiptInfo)
	for i, player in ipairs (game.Players:GetChildren()) do
		if player.userId == receiptInfo.PlayerId then
			if receiptInfo.ProductId == developerid then
				if player.PlayerGui:FindFirstChild("CashBox") == nil then
					if crate ~= nil then
						crate:Clone().Parent = player.PlayerGui
					end
				end
			end
		end
	end
	return Enum.ProductPurchaseDecision.PurchaseGranted
end

local Marketplace = game:GetService("MarketplaceService")
local developerid = 46742331
local crate = game.ReplicatedStorage:FindFirstChild("GearBox")

Marketplace.ProcessReceipt = function(receiptInfo)
	for i, player in ipairs (game.Players:GetChildren()) do
		if player.userId == receiptInfo.PlayerId then
			if receiptInfo.ProductId == developerid then
				if player.PlayerGui:FindFirstChild("GearBox") == nil then
					if crate ~= nil then
						crate:Clone().Parent = player.PlayerGui
					end
				end
			end
		end
	end
	return Enum.ProductPurchaseDecision.PurchaseGranted
end

they are in their own separate scripts but when i play the game and go buy the developer product only 1 of the developer product will work. the developer product that i buy first works the other does not. why? please help.

basically if i buy the gearbox developer product first that will work but the cash developer product will not but if i rejoin the game and buy the cash developer product first the gear developer product will not work.

3 comments

0

gearbox and cash box are guis. i want them to be in playergui when the player buys the developer product so if the player guys the gearbox dev product then he will get gearbox and if he buys the cashbox dev product he will get the cashbox gui.

0

"If you fail to return PurchaseGranted after 3 days, the money from the transaction will be refunded to the buyer. It should also be noted that this callback should only be used in one server-side script, rather than several."