So i've made a dialog through which a player can purchase a gamepass,however when i test it doesn't prompt the purchase or give any errors. This is basically the same script i use for other gamepasses which are activated via textbutton i only changed the way the function is connected but it doesn't work as i'd hoped.
Thanks for your time.
local marketplaceService = game:GetService("MarketplaceService")
local player = game.Players.LocalPlayer
local gamePassId = 687315880
local dialog = workspace.Representative1.Head.Dialog
local dialogY = dialog.DialogChoice2.Tip.DialogChoiceY
dialog.DialogChoiceSelected:connect(function(player,choice)
if choice == dialogY then
marketplaceService:PromptPurchase(player, gamePassId)
end)
local insertService = game:GetService("InsertService")
local Tip1 = game.ReplicatedStorage.Tip1
function onPurchaseFinished(player, assetId, isPurchased)
if isPurchased and assetId == gamePassId then
Tip1:Clone().Parent = player.Backpack
end
end
marketplaceService.PromptPurchaseFinished:connect(onPurchaseFinished)
player.CharacterAdded:Connect(function(character)
if marketplaceService:PlayerOwnsAsset(player, gamePassId) then
wait ()
Tip1:Clone().Parent = player.Backpack
end
end)

2 comments
while you were right that didn't solve my issue. The script doesn't fire at all so i get no errors
is it a local script or server script?