Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

How Do I make a gamepass that scips a Obby level?

Asked by 9 years ago

Ive been wondering this for a few days, I just can't figure out how I would get the game pass to enable the user to be teleported to a different level, like the one after they're on now, so if theyre on 3 and buy the pass to be skipped to 4 they get teleported there. Im not great at scripting, just begun learning.

Thanks in advance :)

going to try myself:

01local passId = 0000000 -- change this to your game pass ID.
02 
03function isAuthenticated(player) -- checks to see if the player owns your pass
04    return game:GetService("MarketplaceService"):PlayerOwnsAsset(player, passId)
05end
06 
07game.Players.PlayerAdded:connect(function(plr)
08    if isAuthenticated(plr) then
09        stage = Player.leaderstats
10new_stage = stage + 1
11function new_stage
12stage + 1
13    end
14end)

first ever try at code so please only useful feedback, thanks guys!

0
Would it be along the lines of this? Benmz41998 19 — 9y

2 answers

Log in to vote
0
Answered by
Pyrondon 2089 Game Jam Winner Moderation Voter Community Moderator
9 years ago

You could set up a value for which stage they are on, sort of like what you did, and add to it. Then, teleport the player to that position based on the value of the variable. To make it easier, you could name all the spawns for the stages Stage 1, Stage 2, etc. (If you don't want it like that, comment):

01local passId = 0000000 -- change this to your game pass ID.
02 
03function isAuthenticated(player) -- checks to see if the player owns your pass
04    return game:GetService("MarketplaceService"):PlayerOwnsAsset(player, passId)
05end
06 
07game.Players.PlayerAdded:connect(function(plr)
08    if isAuthenticated(plr) then
09        stage = plr.leaderstats.Stage -- I added the .Stage because if I remember correctly, that's how it's set up. I'm also writing this assuming these are IntValues.
10 
11    if stage ~= (final stage) -- I assume you don't want them surpassing the maximum. Replace (final stage) with the last one.
12        stage = stage + 1
13        plr.Character:MoveTo(game.Workspace:FindFirstChild("Stage " .. stage.Value).Position
14    end
15end)

Hope this helped.

Ad
Log in to vote
-1
Answered by
AZDev 590 Moderation Voter
9 years ago

The way I would to this is set the players TeamColor to the TeamColor of the next level. Next you would need to teleport them to the next spawn or use :LoadCharacter()

Here is a little bit of pseudo code for how I would do this(Psuedo code is just Code in English):

1--[[
2    You need to check that the player has the gamepass
3    Now you need to check if what team the player is on
4    Now you need to set the players TeamColor to the next level's TeamColor
5    Now simply reload the character using :LoadCharacter --Note this must be done in a server script
6If you need to you can use a remote event to fire the server event that reloads the character
7A wiki link below will show you how to do this
8--]]

RemoteEvents Tutorial

0
Oh well I tried... AZDev 590 — 9y

Answer this question