Hello! I was just coming by to ask about gamepasses and subplaces
See, What I want to achieve here. Is if you buy a gamepass off of a roblox store, Once that exact gamepass is bought it’ll allow you to teleport to the subplace, But if you don’t own it you will be prompted to buy it before continuing
If anything, Could I have help with that please? Thanks!
put this script in the part that contains the click detector
local TeleportService = game:GetService("TeleportService")
local MarketplaceService = game:GetService("MarketplaceService")
local Part = script.Parent
local ClickDetector = Part:FindFirstChild("ClickDetector")
local GamepassID = 0
local SubplaceID = 0
ClickDetector.MouseClick:Connect(function(playerClick)
local CheckGamepass = MarketplaceService:UserOwnsGamePassAsync(playerClick.UserId, GamepassID)
if CheckGamepass then
TeleportService:TeleportAsync(SubplaceID, playerClick)
else
MarketplaceService:PromptGamePassPurchase(playerClick, GamepassID)
end
end)
1 Like
That was for a GUI, Not a clickdetector 
just change it for UI
local TeleportService = game:GetService("TeleportService")
local MarketplaceService = game:GetService("MarketplaceService")
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local playerGui = player:WaitForChild("PlayerGui")
local GamepassID = 0
local SubplaceID = 0
local teleportButton = playerGui:WaitForChild("ScreenGui"):WaitForChild("TeleportButton")
teleportButton.MouseButton1Click:Connect(function()
local success, ownsGamepass = pcall(function()
return MarketplaceService:UserOwnsGamePassAsync(player.UserId, GamepassID)
end)
if success and ownsGamepass then
TeleportService:TeleportAsync(SubplaceID, player)
elseif success then
MarketplaceService:PromptGamePassPurchase(player, GamepassID)
end
end)