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

How can i get item on product purchase?

I Made This Lua:

game:GetService("MarketplaceService"):PromptProductPurchase(game.Players.LocalPlayer, 19579792)
game:GetService("MarketplaceService").PromptProductPurchaseFinished:connect(function(isPurchased)
	if isPurchased == true then
		game.Lighting.Key:Clone().Parent = game.Players.LocaPlayer.Backpack
	end
end)

Why cant I get product? If you dislike then you cant fix it because you don't know how!

I Need This In The Lua:

game:GetService("MarketplaceService"):PromptProductPurchase(game.Players.LocalPlayer, 19579792)

1 answer

✓ Accepted answer

This should work now:

local MS = game:GetService("MarketplaceService")

MS:PromptProductPurchase(game.Players.LocalPlayer, 19579792)

MS.PromptProductPurchaseFinished:connect(function(PlayerId, ProductId, IsPurchased)
    if game.Players.LocalPlayer.userId == PlayerId and IsPurchased == true then
        local Key = game.Lighting.Key
		Key.Archivable = true
		local NewKey = Key:Clone()
		NewKey.Parent = game.Players.LocalPlayer.Backpack
    end
end)

You just had to add in the extra arguments to PromptProductPurchaseFinished. I also improved the code a bit. I hope this works!

4 comments

0

Wait a sec, I just looked up the ID number 19579792 and it came up with a place, not a product. I think you have the wrong item ID number.

0

Everything is working but i cant get any item.

0

It should work fine now

0

It Works Thanks!

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