I'm trying to make a script which prompts a purchase when a specific choice is selected. The below script is a local script and I can't figure out why it doesn't work.

script.Parent.DialogChoiceSelected:connect(function(player, choice)
local id = 000000 --example
local player = game.Players.LocalPlayer

	if choice.Name=="A" then
		wait(1)
            game:GetService("MarketplaceService"):PromptPurchase(player, id)
        end
end)

Anyone have any advice/suggestions?

2 comments

1

Finding the player via LocalPlayer isn't needed since DialogChoiceSelected already returns the player as the first parameter.

0

Also id is 000000, which isn't anything...