Subscriptions - Roblox Advanced Scripting #30 — Transcript
Full transcript
- 0:00Newbert can you actually just get out of
- 0:02my way so that I can play the game like
- 0:04I'm supposed to like I can't do that
- 0:06while you're here standing in front of
- 0:08me okay what do you even want Newbert
- 0:11wait your journey will be tough you
- 0:13should take me with you um what do you
- 0:16mean by that Newbert oh wait a minute
- 0:19what is this Newbert companion $299 per
- 0:23month let nubert join you on your
- 0:25journey uh I didn't know you were some
- 0:27crazy salesperson nubert I am not taking
- 0:29your off okay how does that make you
- 0:31feel oh my God no stop showing me the
- 0:34subscription I do not want to be I don't
- 0:36I do not want you as my companion okay
- 0:38stop showing me this okay well it looks
- 0:40like Newbert isn't going to move unless
- 0:42I buy his subscription so fine Newbert I
- 0:44will pay for your companion subscription
- 0:47let's just click this and oh he's gone
- 0:50oh wait why am I moving so weird wait
- 0:52wait what the heck Newbert what are you
- 0:57doing bro wait is this what you mean by
- 1:00companion just being attached to my back
- 1:02like this bro this is more of an
- 1:03inconvenience why did I even buy that oh
- 1:06my goodness okay I'm just going to reset
- 1:08my character I do not want you to be on
- 1:10my back throughout this entire Journey
- 1:12wait no no he's stuck with me bro damn
- 1:18it I I paid $2.99 for this really I paid
- 1:22I paid three bucks for this really oh
- 1:25this is going to go on until my
- 1:26subscription period ends oh this sucks
- 1:28you know what I'm not playing this game
- 1:29anymore more okay well Newbert you can
- 1:31take my money I don't care anymore all
- 1:34right let's think about this for a
- 1:35minute this video is going to be about
- 1:37subscriptions which allows developers to
- 1:40earn Ro Robux through monthly purchases
- 1:43inside of their own game so in the past
- 1:46we've worked with other methods of
- 1:47earning Roo one of them being game
- 1:50passes and the other one being developer
- 1:51products now to summarize the difference
- 1:53between them a Game Pass is a one-time
- 1:55purchase but a Dev product is a product
- 1:58that you can buy as many times as you'd
- 2:00like whenever you'd like so now in this
- 2:03episode I'm going to be teaching you
- 2:04about subscriptions which is another
- 2:06method of earning Robux and to basically
- 2:08demonstrate how a subscription works I
- 2:10have this VIP door right here so I want
- 2:12you to imagine that there's a VIP lounge
- 2:14through this door that you can't access
- 2:16because you did not buy the VIP door
- 2:18subscription so if I were to prompt this
- 2:21VIP door subscription it's going to look
- 2:23something like this so it's going to
- 2:24give you a price for every month that
- 2:28you have to pay in order to keep this
- 2:30subscription so in this case it's $2.99
- 2:32a month so once I buy this subscription
- 2:35then it's going to unlock the VIP door
- 2:38so I can go inside the VIP lounge and
- 2:40this is going to go on for every single
- 2:42month as long as I keep paying uh how
- 2:45much the price is every single month but
- 2:47if I decide to cancel my subscription
- 2:49and the subscription period ends then
- 2:52it's going to lock the VIP door again
- 2:55because our subscription period ended
- 2:56and we're not paying for the
- 2:58subscription anymore so this is what
- 2:59what makes a subscription different from
- 3:02a game pass and a developer product and
- 3:04so I'm going to be teaching you how to
- 3:05implement this inside of Roblox studio
- 3:08so with that being said let's now go
- 3:10ahead and go straight into implementing
- 3:12now that we understand it let's
- 3:13Implement subscriptions inside Roblox
- 3:15Studio but before we can add
- 3:17subscriptions in our game we need to
- 3:18make sure that our game is published so
- 3:21I want you to go to file and then hit
- 3:23publish to Roblox and once you've done
- 3:25that then I'm going to meet you at the
- 3:26Roblox Creator Hub so I'll see you there
- 3:28in just a little bit all right so I'm
- 3:29here in the Roblox Creator Hub and we're
- 3:31going to go to the game that we just
- 3:32published which in this case this is the
- 3:34game that I'm using right now so if we
- 3:36click on this then there should be a tab
- 3:38on the left side called subscriptions
- 3:40under the monetization tab so if we go
- 3:42over here then it should show all the
- 3:44subscriptions that we have inside of the
- 3:47game just ignore these three down here
- 3:49but in order to create a subscription we
- 3:50need to press this button that says
- 3:52create a subscription right here and it
- 3:54should show a bunch of information that
- 3:56we need to give before we can start
- 3:58adding one like uploading an image in
- 4:00this case so I'm just going to pick some
- 4:02random image doesn't really matter too
- 4:03much um and let's say for our first
- 4:06subscription let's try and recreate that
- 4:08VIP door from the start of this episode
- 4:10so I'm just going to call this VIP
- 4:13lounge just like this and there's going
- 4:15to be a subscription period which is
- 4:16locked to monthly and that's because
- 4:19this is the only subscription period
- 4:20option we have right now so whenever a
- 4:23user buys the subscription then it's
- 4:24going to charge them every single month
- 4:26after that as long as they have their
- 4:28subscription active next thing we have
- 4:30is price so the prices I believe are
- 4:33local to wherever you currently live
- 4:35right now but for me it's USD so the
- 4:37base price is $2.99 and then it can go
- 4:40all the way up to $14.99 so in this case
- 4:42let's say we choose $2.99 then it's
- 4:45going to show on the right side that the
- 4:47subscriber has to pay
- 4:48$2.99 but then the developer earns Roo
- 4:51in return and that's actually important
- 4:53to note here is that the developer earns
- 4:56Roo if the user buys your subscription
- 4:59with real currency let's also add a
- 5:01description by saying this gives you
- 5:04access to the VIP lounge and then
- 5:08finally we have product type here so
- 5:09there's three options to put here and to
- 5:11be honest it doesn't really matter what
- 5:13you put here because I haven't found any
- 5:15use to determine the product type inside
- 5:17of your scripts at least from what I've
- 5:19experimented so to explain what Dural is
- 5:21it's basically a permanent benefit that
- 5:23you get inside of your game as long as
- 5:25your subscription is still active so the
- 5:27VIP DF in in this case is a durable uh
- 5:30subscription so next thing we have is
- 5:32consumable which is temporary or limited
- 5:34which is basically like a potion or like
- 5:37a piece of food where it's like a player
- 5:38is given this product but then once they
- 5:40use it they can't like use it anymore if
- 5:42that makes sense and then currency now
- 5:44currency I believe you just get currency
- 5:47at the start of your subscription and
- 5:48then you get it every single month
- 5:50afterwards as like a fixed amount like
- 5:52let's say you get 1,000 coins at the
- 5:53start of every single subscription
- 5:55period that's basically what this is so
- 5:57let's do durable as our VIP Lounge uh
- 6:00subscription and then we're going to hit
- 6:01create subscription so once we do this
- 6:04then we should have the subscription be
- 6:07created inside of our subscriptions tab
- 6:09just like this okay so our VIP lounge
- 6:11subscription should be right here now
- 6:13there's two important things we need to
- 6:14do first thing is we need to make sure
- 6:17that our subscription is active before
- 6:19we can start purchasing it so what I'm
- 6:21going to do is hit the three dots right
- 6:23here and I'm going to hit active just
- 6:24like this so then I'm going to hit
- 6:27active again just like so and now we
- 6:29have our subscription that's active now
- 6:31if this is your first subscription
- 6:33you're creating it's going to ask you to
- 6:34write a shortened version of your Roblox
- 6:36place that's going to be displayed for
- 6:39every subscription that you buy which in
- 6:41this case for me I named it brawls
- 6:42tutorial place so that's what's going to
- 6:44show if I do buy the subscription okay
- 6:47and finally the last thing is our ID
- 6:49which is right here so I'm going to uh
- 6:50click this copy button because this is
- 6:52going to be important for later so now
- 6:54that we have our first subscription
- 6:55let's go back to Roblox Studios so we
- 6:57can start implementing this now I want
- 6:59to make a very quick disclaimer that you
- 7:01might see this where it says you can't
- 7:03create subscriptions and that's because
- 7:05you need to be ID or phone verified to
- 7:08create subscriptions for your game so my
- 7:10recommendation is to go to your Roblox
- 7:12account settings and add a phone number
- 7:15so that you can be phone verified since
- 7:16in my opinion that's the easier criteria
- 7:19to check off before you can start
- 7:21creating subscriptions so I just wanted
- 7:22to address that first before we
- 7:24continued on with creating subscriptions
- 7:26all right so we're back inside studio
- 7:27and the first thing we need to be able
- 7:28to do is prompt the subscription to the
- 7:31player so that when they buy the
- 7:32subscription it'll tell the server that
- 7:34we want to give the benefits to the
- 7:36player once they actually do buy the
- 7:38subscription but that's going to be
- 7:40later in this episode for right now all
- 7:41we need to do is prompt the user the
- 7:44subscription so we can do that through a
- 7:46local script somewhere in the Explorer
- 7:48let's say starter GUI so I'm going to
- 7:51insert a local script like this and
- 7:52first thing we're going to do is make
- 7:54reference to Marketplace service which
- 7:56is what we used inside of our game
- 7:58passes and Dev products episodes so
- 8:00we're going to say local Marketplace
- 8:03service equals gameon get service open
- 8:06and close parentheses Marketplace
- 8:09service just like that and then we're
- 8:11also going to locate our local player by
- 8:13saying local player equals game.
- 8:16players. local player just like that and
- 8:20then finally we're going to add in our
- 8:22subscription ID as a variable by saying
- 8:24local sub ID equals and then we're going
- 8:27to paste in our ID that we copied which
- 8:29looks like this now what's interesting
- 8:31about this subscription ID is we
- 8:32actually need to wrap it around in
- 8:34quotations so that it's a string rather
- 8:37than a number because it has this little
- 8:38XP Dash right before the the number so
- 8:42now that we have all the information we
- 8:44need let's make it so that if we wait
- 8:46about 5 seconds then it's going to
- 8:48prompt the user the subscription to buy
- 8:50so we're going to add a task. wait for
- 8:52about 5 seconds and then we're going to
- 8:54say Marketplace service colon
- 8:57prompt subscription purchase just like
- 9:00this and we're going to pass in the
- 9:02player object and then we're also going
- 9:03to pass in the subscription ID just like
- 9:05this so This Is How We prompt the user
- 9:08to buy the subscription so if you go to
- 9:10the game hit test and hit play then what
- 9:12we should see in about 5 seconds is that
- 9:15the game is going to prompt us the
- 9:17subscription that we just created so as
- 9:19you can see right here we have our
- 9:20subscription over here that says VIP
- 9:22lounge and we're going to buy this for
- 9:24$2.99 every single month after we
- 9:26subscribe to it so if we click on this
- 9:28then that should give us all the
- 9:29benefits but we obviously need to
- 9:31implement that ourselves first but this
- 9:33is how we prompt the user to buy the
- 9:36subscription okay now let's give
- 9:38benefits to the player once they
- 9:39actually do buy the subscription inside
- 9:41the game and the way we're going to do
- 9:43that is we're going to insert a script
- 9:44inside of server script service just
- 9:46like this and I'm going to rename this
- 9:48to
- 9:50subscription Handler just like this
- 9:52we're also going to delete this uh line
- 9:53of code right here so what we're going
- 9:55to do is go back to our previous script
- 9:57with the local script and we're going to
- 9:59select the first three references and
- 10:01we're going to paste it inside of here
- 10:03but instead of referencing the local
- 10:04players since this is a script we're
- 10:06actually just going to reference the
- 10:08players service by saying local players
- 10:11equals game col get service players just
- 10:14like this so next thing we're going to
- 10:15do is we're going to write a function
- 10:18that basically checks the subscription
- 10:20status of the player with our
- 10:23subscription ID to make sure the player
- 10:25does have the subscription and it's
- 10:26currently active and we're going to use
- 10:28this function for when when the player
- 10:29joins the game but also if they decide
- 10:32to change their subscription by buying
- 10:34the subscription in the game I think
- 10:36it'll make more sense once I actually
- 10:37show you what the code looks like but
- 10:40first we're going to start with our
- 10:41function so we're going to say local
- 10:43function check substatus open close
- 10:47parentheses and we're going to pass in
- 10:48two parameters here the first one is
- 10:50going to be the player and then the
- 10:52second one is going to be the
- 10:54subscription ID I'm going to say
- 10:56subscription ID so that it's not
- 10:57confused with our sub ID up here and
- 11:00then we're going to hit enter just like
- 11:01this so first thing we're going to do is
- 11:04use a function that Marketplace service
- 11:06has that allows us to get information
- 11:09about the subscription status so what
- 11:11we're going to do is actually wrap this
- 11:12in a PE call because it could fail so
- 11:14we're going to say local success comma
- 11:18res response equals P call function open
- 11:22close parentheses enter and then we're
- 11:23going to return Marketplace service
- 11:26colon get subscription
- 11:29status async open close parentheses and
- 11:33we're going to first pass in the player
- 11:35and then we're going to pass in the
- 11:38subscription ID uh not to confuse it
- 11:40with the sub ID up here so now let's
- 11:42just make sure this doesn't fail so what
- 11:44we're going to do is say if not success
- 11:46then we're going to make a warning by
- 11:49saying the sub status check wasn't
- 11:53successful just to leave like a little
- 11:55warning message for us uh in case this
- 11:57actually doesn't work so next thing
- 11:58we're going to do
- 11:59is basically check our response to see
- 12:02whether this new subscription status
- 12:05change was the player getting the
- 12:07subscription or if their subscription
- 12:10was removed so the way we're going to do
- 12:11that is by saying if response so the
- 12:14variable we just fetched back up here
- 12:15with get subscriptions as async if
- 12:17response. is subscribed then here we're
- 12:22going to Grant the benefits but if this
- 12:26is not the case then we're going to
- 12:27revoke the benefits because they no
- 12:29longer have the subscription and so this
- 12:31is our basic check substatus function
- 12:33that we're going to use for two things
- 12:35so if we drop two lines down here we're
- 12:37going to say players. player added colon
- 12:41connect and then what we're going to do
- 12:43is create a function here just really
- 12:45quickly a player added function so we're
- 12:47going to say local function player added
- 12:50open close parentheses and we going to
- 12:52pass in the player just like this and
- 12:54I'm going to pass that in here for the
- 12:56player added uh event so whenever we use
- 12:59player added we're just simply going to
- 13:01call the check sub status function like
- 13:04this by first passing in the player and
- 13:05then the subscription ID which is just
- 13:07going to be sub ID that we specified up
- 13:10here at the start of the script so
- 13:12that's the first thing we're going to
- 13:13use for check sub status and then the
- 13:15second way we're going to use check sub
- 13:16status is if the user has changed their
- 13:20subscription status through an event and
- 13:22we're going to detect that by first
- 13:23creating a function and then using the
- 13:25event to then call that function so
- 13:28basically what we're going to do here is
- 13:30create a function before player added or
- 13:33after it doesn't really matter what
- 13:34we're going to do is say local function
- 13:36on user sub change just like this and
- 13:41then we're going to first pass in the
- 13:43player and then the subscription ID just
- 13:46like this and then we're basically going
- 13:48to check if the subscription that was
- 13:50changed aligns with our subscription up
- 13:53here because a user can have many
- 13:55subscriptions across multiple Roblox
- 13:57games and we need to make sure that this
- 13:59is the right subscription ID that has
- 14:02been changed that reflects this one up
- 14:03here so what we're going to do is say if
- 14:06subscription ID equals sub ID then we're
- 14:10going to say check sub status we're
- 14:14going to pass in the player and then the
- 14:16subscription ID just like that and so we
- 14:20are now going to go down here and say
- 14:24players. user subscription status
- 14:27changed colon connect and then we're
- 14:30going to pass in the on user sub changed
- 14:33function just like this where it's
- 14:35automatically going to pass in the
- 14:36player and the subscription ID with
- 14:38these two parameters up here so I'm
- 14:39hoping so far this is making sense to
- 14:41you where we start with player added and
- 14:43it's going to check the subscription
- 14:45status as soon as they join into the
- 14:46game using the VIP door and then it's
- 14:48going to be the user subscription status
- 14:50change event that's basically going to
- 14:52detect when the player actually buys the
- 14:55subscription in the game and then it's
- 14:58going to pass through through up here by
- 14:59doing a validation check to make sure
- 15:01that this is the right subscription ID
- 15:03and then we're going to call check
- 15:05substatus with the subscription ID and
- 15:07so this is basically how we have the
- 15:11subscription Handler setup going on here
- 15:13but now let's actually make the VIP door
- 15:16uh with the benefits over here so I'm
- 15:18just going to go to the game and we're
- 15:20going to make a VIP door really quickly
- 15:22so I'm going to go to model and then
- 15:23insert a part right here and I'm just
- 15:26going to drag this part around scale it
- 15:28up just like this this I'm going to call
- 15:30this VIP door just like this and let's
- 15:33make this like a a very attractive color
- 15:35like hot pink and I think this is
- 15:37basically all we need for this VIP door
- 15:39let's make sure it's anchored and now we
- 15:41basically have our VIP door that's right
- 15:43over here so what we're going to do is
- 15:44go to the script and I'm going to make
- 15:46reference to the VIP door by saying
- 15:48local VIP door equals game. workpace
- 15:52colon wait for child VIP door just like
- 15:55this and now what we can do is let's say
- 15:58this VIP door is here if the player has
- 16:00not bought the subscription so in that
- 16:02case if we were to revoke the benefits
- 16:04then we're going to say VIP door.
- 16:06transparency equals zero and we're also
- 16:09going to say VIP door. can Collide is
- 16:12set equal to true because this is going
- 16:14to make the VIP door visible and the
- 16:17player without the subscription will not
- 16:19be able to go through but if the
- 16:21benefits are granted then we're going to
- 16:23make the transparency of the VIP door to
- 16:25be one and the can Collide of the VIP
- 16:28door is going to be set equal to false
- 16:30just like this so that it actually does
- 16:32open up if the subscription is bought
- 16:35okay so if we now go to test and hit
- 16:37pipe then what we should see is after
- 16:39about 5 seconds then we should basically
- 16:43wait for the subscription thing to show
- 16:45up right over here and then we're going
- 16:46to say
- 16:48subscribe okay something seemed to have
- 16:50been wrong here oh okay I see what the
- 16:52problem was there was a typo so instead
- 16:54of get subscription status async it's
- 16:56actually get user subscription status
- 16:59asnc that was a very small typo my
- 17:00apologies on that and one more thing I
- 17:02added was a return statement after we
- 17:04make the warning message because there's
- 17:06no point to check the rest of the script
- 17:08if the PE call was not successful so
- 17:09that that was another thing I added to
- 17:11it so now if we go into the game and hit
- 17:12play what we should see in about 5
- 17:15seconds is the subscription that's about
- 17:17to show up on our screen so the VIP
- 17:20lounge is shown right here for $2.99 a
- 17:22month so if we buy it then it's actually
- 17:24going to remove the VIP door so we can
- 17:26now access the VIP lounge but in the
- 17:28event of when our subscription expires
- 17:31then this VIP door is going to update in
- 17:34real time and it's actually going to
- 17:36show the door again because our
- 17:38subscription has been deactivated so
- 17:41that is basically how we make a
- 17:43subscription inside of Roblox studio and
- 17:45I hope you found this part to be very
- 17:46informative so great we have our first
- 17:49working subscription that is this VIP
- 17:51door right over here but unfortunately
- 17:54that's not the entire picture and it
- 17:56actually doesn't work like intended and
- 17:58I'll I'll show you why so what I'm going
- 18:00to do is go to test and I'm going to run
- 18:03a local server with two players so I'm
- 18:05going to show you like why this VIP door
- 18:07doesn't work as expected okay so I
- 18:09loaded up a local server inside of the
- 18:11game to have two players playing at the
- 18:13same time so for the second player I'm
- 18:15actually going to ex out of this
- 18:17subscription prompts right over here
- 18:18just to show you what happens if the
- 18:20first player buys the VIP lounge
- 18:22subscription so if I buy this then it's
- 18:24actually going to make the door
- 18:26disappear for both players that are the
- 18:28game and obviously we don't want that we
- 18:30want the door to disappear only for the
- 18:33player who bought the subscription so we
- 18:35need to make sure that we have that
- 18:36taken care of and I'm going to show you
- 18:37how to fix that okay so back to our
- 18:39script obviously we need to be able to
- 18:41do this through the local side but how
- 18:44do we do this through the local side
- 18:46well one thing we can do for sure is we
- 18:48can create a remote function that
- 18:52basically fetches information about
- 18:54whether the player actually is
- 18:55subscribed or not and we can use that
- 18:57information to basically determine if
- 19:00the player's VIP door should be open or
- 19:02it shouldn't be open based on the new
- 19:05change that has happened to it so here's
- 19:06what we're going to do in replicated
- 19:08storage we're going to insert a remote
- 19:10function and we're going to call this
- 19:12remote function get user sub status just
- 19:16like this and then inside of our
- 19:18subscription Handler what we're going to
- 19:20do is first make reference to our remote
- 19:23function that we just created so we're
- 19:24going to say local get user sub status
- 19:28stat equals game. replicated storage
- 19:32colon wait for child get user substatus
- 19:35just like this and what we're going to
- 19:36do is basically create a ons server
- 19:38invoke function probably somewhere down
- 19:40here so we're going to say get usersub
- 19:42status. ons server invoke equals
- 19:45function open close parenthesis and by
- 19:48default the first parameter is going to
- 19:49be the player that gets passed through
- 19:52so what we're going to do here is
- 19:54basically take our code that we had up
- 19:56here with the get subscription status
- 19:58async and we're just going to copy this
- 20:00and paste it down here so for this user
- 20:03sub status another thing we're going to
- 20:04do is actually pass in the subscription
- 20:07ID as well and also replace this player
- 20:09variable with plr because that's what we
- 20:11specified it as so now that we have
- 20:13response what we're basically going to
- 20:15do is first check if this was not
- 20:18successful so I'm just going to go up
- 20:19here and copy the code that we had over
- 20:21here so the sub status check wasn't
- 20:23successful for the client just to make
- 20:26this a little different that's what
- 20:27we're going to do and then we're going
- 20:29to return
- 20:31response. is subscribed back to the
- 20:34client when we invoke this get user
- 20:38substatus remote function so what we're
- 20:40first going to do is go up here and take
- 20:42this reference with get user substatus
- 20:44and we're going to go to our local
- 20:45script and we're going to make that
- 20:48reference up here with get user sub
- 20:50status and then we're going to drop two
- 20:52lines down here so now we're going to do
- 20:54everything before the task. we so that
- 20:56there isn't a delay for whenever we're
- 20:58detecting these things with the
- 21:00subscriptions so I'm just going to make
- 21:02a little bit of space up here and the
- 21:04first thing we're going to do is make a
- 21:06function that basically hides the door
- 21:09on the local side if the player does
- 21:11have the subscription or if they don't
- 21:13have the subscription active so what
- 21:14we're going to do is say local function
- 21:17hide door if player has sub open close
- 21:21parentheses and then I'm just going to
- 21:23hit enter just like this so what we're
- 21:25also going to do is go up here to our
- 21:27script I'm going to take the VIP door
- 21:29reference and put it inside of our local
- 21:31script over here and so now what we're
- 21:32going to do inside of this function is
- 21:34basically check if the player does have
- 21:36the VIP door subscription active through
- 21:39this remote function that we just
- 21:40created so what we're going to do is say
- 21:42local player has sub equals get user sub
- 21:47status colon in invoke server just like
- 21:53this and then we're going to hit enter
- 21:54now we also need to specify the
- 21:55subscription ID by passing in sub ID
- 21:58just like this and it's going to
- 22:00automatically pass in the player as the
- 22:02first argument for the sub status remote
- 22:05function so then what we're going to do
- 22:06is say if player has sub then we're
- 22:09going to rant the
- 22:12benefits like we need to and if the
- 22:14player doesn't have the subscription
- 22:15then we're going to revoke the benefits
- 22:18like we did down here as well so we're
- 22:19basically just going to copy what we had
- 22:22up here with VIP door if they are
- 22:25subscribed and we're going to grant them
- 22:26the benefits and if they don't then
- 22:29we're going to keep the door as is so
- 22:31that the player cannot go through the
- 22:33VIP door and that is basically how we do
- 22:34it so first thing we're going to do is
- 22:37check if the player already has the
- 22:39subscription as soon as they join into
- 22:41the game so I'm just going to make a
- 22:43reference to this right over here and
- 22:44we're also going to add a event that
- 22:48triggers when the user does change their
- 22:50subscription like we did inside the sub
- 22:53subscription Handler so this is the
- 22:54event we're going to use after the
- 22:56player has bought a subscription so this
- 22:59is going to take place in Marketplace
- 23:00service that we have reference to right
- 23:02up here by saying Marketplace
- 23:05service. prompt
- 23:08subscription purchase finished colon
- 23:12connect open close parenthesis and we're
- 23:14going to pass in the hide door if player
- 23:17has sub function that we had up here for
- 23:20this hide door function so this is
- 23:22basically the entire scripts that we
- 23:23need for the subscription now what I can
- 23:26tell you about the subscription Handler
- 23:27is that we can actually comment out a
- 23:29lot of things from this script that we
- 23:31created previously so the first thing is
- 23:33the sub ID then it's the VIP door and
- 23:35then it's the entire check substatus
- 23:38function and also the on user sub
- 23:40changed and the player added function as
- 23:42well so the only thing we really need is
- 23:45this on server invoke that tells us if
- 23:47the player has this subscription or not
- 23:49and it's going to return the result of
- 23:51whether the player does have the
- 23:53subscription and if it if they do then
- 23:56we can grant the benefits or revoke the
- 23:58benefits f as we see fit for our local
- 24:00script so if we now go into the game and
- 24:02hit play then what we should see is that
- 24:05in about 5 Seconds when we're prompted
- 24:07to buy the VIP door and if we do buy it
- 24:10just like we see right over here if we
- 24:12click subscribe then it's going to get
- 24:14rid of the door but if I go to the
- 24:16server then the door is still over here
- 24:18because it was not changed for the
- 24:21server side and so that is basically how
- 24:25we make this fix for this subscription
- 24:28that we created for the VIP door so that
- 24:30it doesn't affect every single player
- 24:32that's within the game and I hope that
- 24:33this has made sense to you with how
- 24:36we've structured this entire script so
- 24:38just to recap one more time I'm going to
- 24:40hit stop and if we go through our script
- 24:43here so in 5 seconds the script is going
- 24:45to prompt the user to buy the
- 24:47subscription so that's great now once
- 24:49the user has bought the subscription so
- 24:51it's going to prompt the subscription
- 24:53purchase finished and it's going to pass
- 24:55in this function hi door if player has
- 24:58sub and it's also going to do it at the
- 24:59very start as well just to make sure
- 25:01that the player actually does have the
- 25:03subscription when they join into the
- 25:05game so it's going to invoke this remote
- 25:08function to get the subscription status
- 25:11of this subscription ID for the VIP door
- 25:13so if you go inside of the script then
- 25:16it's going to get the user subscription
- 25:18status async and it's going to return
- 25:21whether the user actually is subscribed
- 25:24to this subscription and so once we get
- 25:27that result it's going to return true or
- 25:30false so since the player does have the
- 25:32subscription we're going to Grant the
- 25:34benefits by hiding the door but if they
- 25:37don't then we're going to keep the door
- 25:39open because of it and so that is
- 25:42basically how we make our VIP door
- 25:45script inside of this episode and I hope
- 25:47you found this to be extremely extremely
- 25:49useful so if I were to just quickly make
- 25:51this Handler script even more simple I
- 25:53could just get rid of all of these
- 25:54comments that I have over here inside of
- 25:57our script and I guess we also don't
- 26:00need the players reference anymore as
- 26:01well so this is the only thing that
- 26:03matters if you understand remote
- 26:05functions this is basically all we need
- 26:06from the server side but the local side
- 26:09is basically going to handle the rest in
- 26:11this case because the VIP door needs to
- 26:13be local to that specific player and so
- 26:16I hope that this has kind of helped you
- 26:18understand how subscriptions work on the
- 26:21local side but also in the service side
- 26:22too that's not to say that everything
- 26:24we've coded in the subscription Handler
- 26:27has been for nothing because it's
- 26:29basically just a matter of knowing
- 26:30whether you want to have your scripts be
- 26:32on the local side or if you want your
- 26:33scripts to be on the server side and so
- 26:35I think what we've coded up until this
- 26:36point has been pretty helpful in being
- 26:39able to understand that as well and so
- 26:41that is just something I wanted to
- 26:42quickly address before we end off this
- 26:44video and so I hope you're able to
- 26:46understand everything we've done up up
- 26:47until this point and you found this
- 26:49episode to be extremely helpful so
- 26:50that's pretty much going to be it for
- 26:51this episode on subscriptions now before
- 26:53you go I want to quickly give a shout
- 26:55out to my very first patreon member
- 26:58peanut boy 173 so if you like the work
- 27:01that I put out on my YouTube channel and
- 27:03you want to directly support me while
- 27:05also getting access to all of my scripts
- 27:07that I've been creating throughout the
- 27:09entirety of this Advanced scripting
- 27:11tutorial guide then I will leave a link
- 27:13to my patreon page in the description of
- 27:14this video you don't have to become a
- 27:16patreon member to support me but that
- 27:19would definitely help me out a lot and I
- 27:21would appreciate it very much so that's
- 27:24basically all I wanted to say for the
- 27:25end of this episode so with that being
- 27:27said I hope you enjoyed this video and I
- 27:28will see you in the next one take care
About this transcript
This page contains the full transcript of Subscriptions - Roblox Advanced Scripting #30 by BrawlDev, generated from the public captions YouTube serves with the video. The transcript has 5,571 words across 757 segments, with the original timestamps preserved so you can click any line to jump to that moment in the embedded player.
What you can do with it
Use the transcript to take notes, quote the speaker, build a study guide, generate a summary with ChatGPT or Claude via the YouTube Summary tool, or export it as a timed subtitle file with YouTube to SRT. You can also re-open it in the transcriber to choose a caption track available on the video.
Free YouTube transcript tool
YouTube2Text is a free YouTube transcript generator — no signup, no daily limit. Paste any YouTube link and get the full transcript instantly, with timestamps, click-to-jump, caption language selection, AI prompts for ChatGPT, Claude, and Gemini, and exports to TXT, SRT, VTT, or Markdown.