script.Parent.DialogChoiceSelected:Connect(function(player, dialog)
if dialog.Name == 'choice1' then
local devpid = 340244079
game:GetService('MarketplaceService'):PromptProductPurchase(player, devpid)
end
end)
It only works on studio, not In-game.

2 comments
I would advise against using default dialogs if your game is FE. For some odd reason, they break.
Yeah, I would advise not using ROBLOX Dialog options. Just use GUIs. Also, make sure the devpid is valid.