I’m making an obby game and I need help making it so after a user buys a developer product (Skip Stage) it will teleport them to a part (Hovering above next checkpoint). My idea of finding the next stage for example: "If Stage leaderstat = 1, teleport them to a part named “Stage 2 teleport” (Hovering above checkpoint 2)
Sorry if you are confused, I can try and say it a bit more understandable if you need.
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.
I’m really bad at scripting. Sorry if I’m confused but I am
That’s alright, there’s a lot of words to learn when starting out scripting.
What’d I’d do is start out with number 3 there. Try to get a script set up that teleports you when you spawn in the game to a part. To achieve that, you will just need one script that edits the characters CFrame property. Once you got that down, attempt number 2. Then go from there.