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

How can I separate my PromptPurchaseFinished scripts?

Asked by 6 years ago

I have 2 different scripts under text buttons that give me different gears. If I buy one of them, it gives me both. How can I separate them?

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

script.Parent.MouseButton1Click:connect(function()
    market:PromptPurchase(player, 334966726)
end)

MarketplaceService.PromptPurchaseFinished:connect(function(player, assetId, isPurchased)
        if isPurchased then
        game.SoundService.Ding:Play()
    game.ServerStorage.SuperFlyGoldBoombox:Clone().Parent = player.StarterGear
    game.ServerStorage.SuperFlyGoldBoombox:Clone().Parent = player.Backpack
    player.Backpack.SuperFlyGoldBoombox.CanBeDropped = false
        else
            print("nope")
        end
end)
local MarketplaceService = game:GetService("MarketplaceService")
local player = game.Players.LocalPlayer
local market = game:GetService("MarketplaceService")

script.Parent.MouseButton1Click:connect(function()
    market:PromptPurchase(player, 237980461)
end)

MarketplaceService.PromptPurchaseFinished:connect(function(player, assetId, isPurchased)
        if isPurchased then
        game.SoundService.Ding:Play()
    game.ServerStorage.SegwayHoverboard:Clone().Parent = player.StarterGear
    game.ServerStorage.SegwayHoverboard:Clone().Parent = player.Backpack
    player.Backpack.SegwayHoverboard.CanBeDropped = false
        else
            print("nope")
        end
end)

0
vague question. little detail. Bucwheed 37 — 6y
0
They both have the same assetId, so they both are given. I cannot change assetId. fuffieboy 17 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago

You could maybe try putting them in different scripts

0
They are. fuffieboy 17 — 6y
Ad

Answer this question