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

How can I separate my PromptPurchaseFinished scripts?

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)

2 comments

0

vague question. little detail.

0

They both have the same assetId, so they both are given. I cannot change assetId.

1 answer

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