In my game, I am trying to make a 'VIP Door' which will need the player to buy a gamepass so they can teleport to another place. I have put the place in 'Other Places' on the roblox website and put the following code in a script inside the 'Door':
local passId = 622740681
local marketplaceService = game:GetService("MarketplaceService")
function onTouched(hit)
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if player then
marketplaceService.PromptPurchaseFinished:connect(function(player,assetId,isPurchased)
if isPurchased then
if assetId == passId then
game.GetService("TeleportService"):Teleport(623097807, player)
end
end
end)
end
end
script.Parent.Touched:connect(onTouched)
If you can see, I used some help from the roblox wiki, but I can't get it to work.

2 comments
Any errors? If not, put a print("line works") between each line and see where it stops, then I may find the problem.
It stops at line 6 (last line where it works). The gamepass isn't on for sale yet. Should put it up for sale?