Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

why is only 1 of these developer products working at a time?

Asked by
MHaven1 159
7 years ago
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.

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. MHaven1 159 — 7y
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." User#5423 17 — 7y

Answer this question