You’ll need a few things here since you’re dealing with both sides of the client-server boundary.
Without giving you the exact answer, you’ll need to:
- Setup a remote event that you fire from the client (LocalScript) after the user buys the gamepass.
- To know when the user has finished purchasing the gamepass, you can use the
MarketPlaceService:
local MarketplaceService = game:GetService("MarketplaceService")
local function gamepassPurchaseFinished(...)
-- Print all the details of the prompt, for example:
-- PromptGamePassPurchaseFinished PlayerName 123456 false
print("PromptGamePassPurchaseFinished", ...)
end
MarketplaceService.PromptGamePassPurchaseFinished:Connect(gamepassPurchaseFinished)
- In a server side script, you will need to listen for you remote event to be fired from a client, in your function you can edit the received player’s characters cframe values:
Character.HumanoidRootPart.CFrame = CFrame.new(1,5,9) -- you will want the part you want to teleports cframe, not these generic numbers
And you should be good to go.