Scripting the Gamepass Shop Gui! Roblox Studio Simulator Guide Episode 22 — Transcript
Full transcript
- 0:00welcome back to the simulator series in
- 0:01today's episode we are going to be
- 0:02scripting the game pass shop gui that we
- 0:04made in the last episode as always if
- 0:06you guys do enjoy the video or does help
- 0:07you out make sure you smash the like
- 0:08button also the subscribe button and
- 0:10turn this post notifications on if you
- 0:11want to get notified when i upload more
- 0:12roblox development content additionally
- 0:14i do with patreon if you guys like this
- 0:16for me and gain access to all the
- 0:17scripts and the game file like during
- 0:18this episode there's a link down below
- 0:19in description and you guys can go and
- 0:20check that out to showcase the
- 0:22functionality of the gui when we go into
- 0:24eating simulator we can click on the
- 0:25shop button which will pop up with the
- 0:27shop gui then inside of here we have
- 0:29four different buttons which we can
- 0:30click the passes which displays all the
- 0:32passes the ultra patch which displays
- 0:34the patch for sale the coins which
- 0:36displays a couple of coin packages for
- 0:37sale and then finally boost which
- 0:39displays the boost for sale as well now
- 0:41with the boost whenever we click on one
- 0:42of these buttons for example it will pop
- 0:44up with a developer product which we can
- 0:46purchase the same goes for the passes if
- 0:48we click on any of these passes it will
- 0:49allow us to purchase them so hopping
- 0:51back into studio where we left off last
- 0:53time let's go into the starter gui and
- 0:55we have our game pass shop now we'll
- 0:56explain this a little bit one of the
- 0:58things i want to quickly change that we
- 0:59didn't do last time was if we look
- 1:01inside of all of our containers we have
- 1:03something in them called template the
- 1:04only container that we actually don't
- 1:06have something called template inside is
- 1:08the boost container so what we want to
- 1:10quickly do is rename this frame from
- 1:12frame to template we then want to script
- 1:14this button right here which will be the
- 1:16button that we can click to actually
- 1:17display the shop now we already did
- 1:19something very similar to this with the
- 1:20settings and if we look inside of this
- 1:22bun script right here we actually have
- 1:24the exact functionality that we also
- 1:25want to have for the game pass button so
- 1:27what we're going to do is we're simply
- 1:28just going to copy this and we're going
- 1:30to paste it directly into the game shop
- 1:31gui then let's go ahead and open up the
- 1:33script and now we see we have the buns
- 1:35gy which refers to this gui right here
- 1:37so inside of the buttons holder this
- 1:39time we need the shop bun instead of the
- 1:41settings button so we have the settings
- 1:42button right here let's replace that
- 1:44with shop and then all we have to do is
- 1:46replace the settings button with shop
- 1:48button boom boom there we go and now
- 1:50whenever we click on this it will enable
- 1:52the screen gy and the screen gui refers
- 1:55to the parent which would be the game
- 1:56pass shop we go ahead and test this out
- 1:58by starting up our game clicking on the
- 2:00button and we can see it pops up when we
- 2:02click it or it closes if it's already
- 2:03opened when we click the button the next
- 2:05thing we want to do is we want to head
- 2:06inside of the replicated storage inside
- 2:07of our config folder and we want to
- 2:09create a module script which will hold
- 2:10the configurations for all of our
- 2:12different game passes and developer
- 2:13products so what we're going to do is
- 2:15we're just going to simply insert a
- 2:16brand new module script and we'll rename
- 2:18this to game pass shop now remember we
- 2:20have four different categories in our
- 2:22shop so we're going to be making four
- 2:24different configuration tables inside of
- 2:26this one module script for each of the
- 2:28different categories the first category
- 2:29that we'll create a config for will be
- 2:31the passes so we're going to say
- 2:33module.passes and then we're going to
- 2:34create a table and we're going to use
- 2:36this as an array so we're going to
- 2:37create another table inside of here and
- 2:39this is going to be one of the config
- 2:40lines so one of the properties that each
- 2:42of our game pass is going to have is
- 2:43going to be the id and for the first
- 2:45pass it's going to be infinite
- 2:47underscore food then the second property
- 2:49is going to be the price so how much
- 2:51robux is it gonna cost and we're gonna
- 2:53say
- 2:54799 then the last property we're gonna
- 2:56create for now is going to be the image
- 2:58property and we're just gonna set that
- 2:59to a blank string now if you're using a
- 3:01specific image for each individual game
- 3:03pass then you would put the url to the
- 3:05image directly here then we're going to
- 3:07add a comma at the end of this and we're
- 3:08just going to duplicate this line three
- 3:10times and we'll just modify some of
- 3:11these properties for a couple of other
- 3:13game passes so the second game pass that
- 3:14we're gonna have is times two underscore
- 3:17food that is going to cost
- 3:19549 and then the third one is going to
- 3:21be vip and that will cost 449. now let's
- 3:24go back inside of the gamepad shop gui
- 3:27and we'll add a new local script and
- 3:29we're just going to call this handler
- 3:30now what we're going to do is we're
- 3:31going to create the generator now what
- 3:33we're going to do is we're going to
- 3:34create a generator for this shop and
- 3:36what i mean by that is we're going to
- 3:37create a function and we're going to
- 3:39loop through all the passes in our
- 3:40config file and we're going to take this
- 3:42information and we're going to use that
- 3:44information along with the specific
- 3:45templates to populate our gui it's the
- 3:48exact same method that we use when
- 3:49creating the settings gui so you guys
- 3:51should be already familiar with this
- 3:53anyways inside of the handler we're
- 3:54going to get the replicated storage
- 3:56additionally we are going to want to
- 3:57require the game pass shop config that
- 3:59we just made now that we have that let's
- 4:00start creating a couple of variables for
- 4:02the gui and the frames inside of it so
- 4:04we're going to say local screen gui
- 4:06equals script dot parent then we want to
- 4:09get the frame so frame equals screen gui
- 4:12dot frame then since we're first gonna
- 4:14generate the passes category let's go
- 4:16ahead and get the passes container so
- 4:18we're gonna say local passes container
- 4:21equals frame dot passes container and
- 4:24then we also wanna get the passes
- 4:25template as well so we're gonna say
- 4:26local passes template equals passes
- 4:29container dot template additionally
- 4:31let's go ahead and initialize the exit
- 4:33button as well so we're gonna say local
- 4:35exit equals frame dot exit button and we
- 4:38can script that really quick so we'll
- 4:39say exit dot mouse button one click
- 4:41connect function and then screen gui dot
- 4:44enabled equals false so that makes the
- 4:46screen gy invisible whenever we click
- 4:48the exit button next let's go ahead and
- 4:50create a function inside of here and
- 4:51we're gonna call that generate and we're
- 4:53gonna call the first parameter info and
- 4:55that's actually going to be a table the
- 4:57next argument is going to be called
- 4:58template and that's actually going to be
- 5:00either a text button or a frame and
- 5:02remember the passes template is actually
- 5:04a text button but if we remember
- 5:06correctly the boost template is actually
- 5:08a frame that's why we're saying either a
- 5:09text button or a frame and of course you
- 5:11guys don't have to add the type checking
- 5:12here like i am you could simply just
- 5:15write that and not type check at all but
- 5:17i like to do type checking because i
- 5:18think it really helps and then the final
- 5:20argument is going to be the container
- 5:22where we're going to store the generated
- 5:23templates at and that's going to be a
- 5:25scrolling frame so now we have all the
- 5:26arguments for that function we then want
- 5:28to create a variable for cloning the
- 5:29template so we're going to say local
- 5:31clone equals template remember the
- 5:33template that we're passing through
- 5:35cologne then we're going to set the
- 5:36parent of the clone to the container
- 5:38which we also passed through here now
- 5:40let's open up the frame and let's go
- 5:42inside of passes for right now so we
- 5:43have the template right here so first
- 5:45we're gonna set the name of the template
- 5:47which would be a text button to the
- 5:50info.id and remember info dot id for an
- 5:53example would be infinite underscore
- 5:55food and that's what the name of the
- 5:56text button is going to be set to then
- 5:58inside of the template we have a text
- 5:59label called title we're going to modify
- 6:01the text of that text label and we're
- 6:03going to set it to the info dot id and
- 6:05remember when we created the settings
- 6:07generator we use the function on the
- 6:09string called g sub and what that does
- 6:11is it replaces a specific character or
- 6:13string with another specific character
- 6:14or string that you want it to so we want
- 6:16to replace the underscore with a space
- 6:18and the reason that we're doing that is
- 6:20for infinite underscore food that will
- 6:22just be infinite space food which is how
- 6:24we want it to be displayed then we also
- 6:26have the price label so we're going to
- 6:27say clone.price.txt
- 6:29equals
- 6:30info.price and finally we have the image
- 6:33label and we're going to say
- 6:34clone.image.image
- 6:36because remember this refers to the
- 6:38image label and then image if we look
- 6:40inside of image we can see that the
- 6:42image label named image has a property
- 6:44also named image so we can say
- 6:46clone.image.image
- 6:48equals and then we will say the
- 6:50info.image and remember the info id
- 6:53price and image all come from this
- 6:55specific configuration line right here
- 6:57and then finally what we want to do is
- 6:58we want to set the clone to be visible
- 7:01so the player can actually see it and
- 7:02then whenever the player clicks on this
- 7:04we also want to do something as well so
- 7:05we're going to say clone dot mouse
- 7:07button one click colon connect function
- 7:11and for right now we are just going to
- 7:12print true so that we know that it was
- 7:14clicked now that we have the basic
- 7:16generator created we actually need to
- 7:17loop through a table inside of our
- 7:19config and use the generator and we'll
- 7:21do this by saying for underscore info in
- 7:24pairs config dot and for this example
- 7:28we're going to be using passes so we're
- 7:29going to say dot passes do and then
- 7:31we're just simply going to call generate
- 7:33and we'll pass through info which is
- 7:35going to be the config table and then
- 7:36for the template and the container we
- 7:38want to use the passes template and the
- 7:41passes container now the last thing that
- 7:42we want to do just so that we can
- 7:43quickly test this out is we want to make
- 7:46the passes container visible so we can
- 7:48actually see this and let's also set
- 7:50this template to not visible so that we
- 7:52don't see the blank template that we're
- 7:53not actually using then we can go ahead
- 7:55start up our game and make sure this
- 7:56works all correctly and as we see we see
- 7:58infinite food two times food and vip
- 8:01have all been generated we can see their
- 8:02prices are correct and their image is
- 8:04correct as well because our image is
- 8:06just a blank string which means that
- 8:07there's no image currently additionally
- 8:09if we click on them we can see true has
- 8:10been printed the console and that means
- 8:12that everything is working exactly as we
- 8:14wanted to now that was one of the harder
- 8:16parts but we're still gonna have to
- 8:17customize this in the future to be
- 8:19tailored towards every single container
- 8:20this is currently only tailored
- 8:22specifically towards the passes
- 8:23container and we'll modify this more in
- 8:25the future so that it works with all the
- 8:27containers that we have what we now want
- 8:28to work on is the shop categories bun
- 8:30and making them functional so underneath
- 8:32our frame right here let's go ahead and
- 8:33set a variable for the category frame
- 8:35and we're actually going to rename the
- 8:36category frame from category frame to
- 8:38just category so we're going to say
- 8:39local category equals frame dot category
- 8:42additionally underneath of the exit
- 8:44button we're going to create a new
- 8:46variable called current category and
- 8:48we're just going to set that to passes
- 8:50as that's the first category that we
- 8:51want to display to the player because
- 8:53that's our first button the next thing
- 8:54we want to do underneath the for loop
- 8:56where we currently are generating passes
- 8:58at we want to make another for loop and
- 8:59this time we're actually going to loop
- 9:00through the category frame and get all
- 9:02of the different buttons so we're going
- 9:04to say for underscore comma button in
- 9:07ipairs category get children do then
- 9:10what we're going to do is we're going to
- 9:11say button.mousebutton
- 9:14one click so whenever we click on a
- 9:16button we want to do something and for
- 9:19right now we'll just say print true for
- 9:21example but the thing is is that if we
- 9:22actually ran this we would come up with
- 9:24an error because mouse button one click
- 9:26is not an event of the ui grid layout
- 9:29and remember we're getting all of the
- 9:30categories children and these are all
- 9:33the category children right here so we
- 9:35pretty much need to filter out the ui
- 9:37grid layout and one simple and easy way
- 9:39to do that is by saying if not button
- 9:41and then we're going to use is a and
- 9:43then we say what we want it to be so we
- 9:45want them to be text buttons so we're
- 9:48saying if it is not a text button then
- 9:49what we're going to do is we are going
- 9:51to continue through the loop end and now
- 9:53this is all on one line another way to
- 9:55format this which you might be more
- 9:57familiar with is this way this is
- 9:58normally how if statements are written
- 10:00but you guys have seen me write if
- 10:02statements on one line before so it
- 10:04shouldn't be too new but what this is
- 10:05saying is while looping through this if
- 10:07the button is not actually a text button
- 10:09then we're going to completely ignore
- 10:10that item and just continue through the
- 10:12loop so we're basically stopping the
- 10:13code before it gets to this part and
- 10:15we're doing that so that when it's a ui
- 10:17grid layout it stops right here before
- 10:18it actually gets to the mouse button one
- 10:20click because that would throw an error
- 10:22so i'm going to undo what i just did
- 10:23right there and just keep it all on one
- 10:25line and it looks very clean now we want
- 10:27to create another function underneath of
- 10:28the generate function that we have and
- 10:30this function is going to be called
- 10:32display and what we're going to accept
- 10:34is the category which is going to be a
- 10:36string and then what we're going to do
- 10:38is with this for loop every single time
- 10:40we click the button what we want to do
- 10:42is we want to call the display function
- 10:44and we want to pass through the buttons
- 10:46name now the reason for that is because
- 10:48if we look at the buns we have a button
- 10:49called boosts coins passes and pets and
- 10:52if you look at our containers the names
- 10:54of the containers are also coins passes
- 10:57pets and boosts so if you're not getting
- 10:58the big picture yet just keep following
- 11:00along don't worry what we first want to
- 11:02do is we first want to check if the
- 11:03current category which remember is the
- 11:05variable that we set up here is the same
- 11:08as the category which just got passed to
- 11:10this function and if that's true then we
- 11:12don't want to do anything so we're just
- 11:14going to say then return end which
- 11:16basically prevents anything from below
- 11:18this line from running and the reason
- 11:19that we're doing that is because for
- 11:20instance if the player is on the passes
- 11:22page and they click the passes button we
- 11:24don't need it to do anything so it
- 11:26shouldn't then what we want to do is we
- 11:27want to create a new variable and we're
- 11:29going to call this currentcontainer and
- 11:31we want to set that to frame find first
- 11:34child and then we want to pass through
- 11:36the current category dot dot which we
- 11:38use to combine a string and the string
- 11:40is going to be container so imagine the
- 11:42current category equals passes what
- 11:44we're going to do is we are going to
- 11:45look inside of the frame which let's see
- 11:48this is the frame and then inside of the
- 11:49frame we're looking for passes container
- 11:52and that'll find the scrolling frame
- 11:53right here and then we can do something
- 11:55with this now what we want to do with
- 11:56the found frame is we want to set the
- 11:58visibility of it to false so the player
- 12:01no longer sees it after we do that we
- 12:03then want to set the current category to
- 12:05the new category that we just passed to
- 12:07the function and we're actually going to
- 12:08do the exact same thing so we can
- 12:10literally copy this line right here
- 12:12don't copy the local though and we're
- 12:14once again gonna set the current
- 12:15container to the frame find first child
- 12:17and now the new container because
- 12:19remember we're setting current category
- 12:20to the new category that we're passing
- 12:22through right here and then we're gonna
- 12:23do the exact same thing we're gonna find
- 12:25the new container frame and then once we
- 12:27do that we wanna set the current
- 12:28container frame to visible so the player
- 12:31can actually see it so to recap what's
- 12:33going on here whenever we click on any
- 12:35of these buttons we're gonna call the
- 12:36display function with the name of that
- 12:39button and if we click on a page that
- 12:40we're not already looking at then we're
- 12:42gonna find the container that we're
- 12:43already looking at we're gonna make that
- 12:45not visible and then we're gonna set the
- 12:46same variable to the new category that
- 12:49we wanna look at and then we're gonna
- 12:50find the new container frame and we're
- 12:51gonna make that visible so we can see it
- 12:53so pretty much hide the old one and show
- 12:55the new one so let's go ahead start up
- 12:57our game and test this out by clicking
- 12:58on ultra pets we can now see that this
- 13:00is displayed and remember we still need
- 13:02to set all the templates to not be
- 13:04visible except for the passes but now
- 13:05when we click on passes we only see the
- 13:07generated passes when we click on ultra
- 13:09pets we only see the ultra pets when we
- 13:11click on coins we only see coins and
- 13:12then when we click on boost we only see
- 13:14boost so that is working perfectly and
- 13:16if we click on the same button that
- 13:17we're already looking at nothing happens
- 13:19it's all working exactly as it should be
- 13:21with that all being said up the next
- 13:22thing that we want to do is we want to
- 13:23head back to our game pass config file
- 13:25and let's add another category to this
- 13:27so what we can do is we can copy our
- 13:28passes category and then paste it right
- 13:30below it this time we'll add the pets
- 13:32category so our first pet we're just
- 13:33going to use a random example for this
- 13:35it's going to be dog the second one will
- 13:37be cat and the third one will be turtle
- 13:39now for the price we are going to set it
- 13:40to the prices that they have it as so 19
- 13:43900
- 13:444999 and finally 2
- 13:472449. then for the image we're once
- 13:49again going to just leave those as blank
- 13:51strings but we're actually going to add
- 13:52a new property to this and that is going
- 13:54to be called stat and for the first one
- 13:56we're going to set that to 100 000. now
- 13:58the reason that we're adding the stat
- 13:59property to the pets is because if we
- 14:01remember it displays the pet stat at the
- 14:03top left hand corner of the template and
- 14:05the thing with this is that both the
- 14:07food stat and the money stat are both
- 14:08the exact same value so we don't need to
- 14:11make two separate stats but for instance
- 14:13if you wanted to you could say stat 1
- 14:15and then stat 2 and set that to a
- 14:18different value if you wanted to and you
- 14:20could easily add this to your own system
- 14:22it really wouldn't be that hard at all
- 14:23but we're keeping it consistent with how
- 14:25they have it so we are making one
- 14:26specific stack then we'll set the stat
- 14:28property for the second pet so stat
- 14:30equals 10 000 and then finally for the
- 14:33turtle the stat is equal to 4 000. now
- 14:36that we added all that we should now
- 14:37modify the generate function to
- 14:38accommodate for all those changes let's
- 14:40go ahead and open up our pet's container
- 14:42and look inside of the template so that
- 14:43we can see all the different things it
- 14:45has inside of it additionally we can
- 14:46open up the passes container and compare
- 14:48the two different templates the pet
- 14:50template doesn't actually have a title
- 14:52so inside of our generate function when
- 14:54we say clone.title we actually won't be
- 14:56able to use this for pets or else we're
- 14:58going to get an error so the first thing
- 14:59we want to do is inside of this function
- 15:01we want to say local title and actually
- 15:03create a variable for the title and
- 15:05we're going to set that to clone find
- 15:07first child and we want to find a child
- 15:10named title and then we'll say if title
- 15:12so if we find the title child then what
- 15:14we'll do is we'll do what we were
- 15:16already doing which is changing the
- 15:18title to a specific string now we're
- 15:19gonna basically do the same thing that
- 15:20we just did but for the food and money
- 15:22stat considering the other templates
- 15:24don't share the same child so what we're
- 15:27going to do is we're going to say local
- 15:28food stat equals clone find first child
- 15:32food stat and then we'll also create a
- 15:34variable for the money stat as well so
- 15:36we'll just replace food with money and
- 15:38there we go we now have both of those
- 15:40and then we're going to say if food stat
- 15:42and money stat we really only need to do
- 15:45one but we'll just do both because we
- 15:46might as well if we find both of them
- 15:48then we're going to set the food stat
- 15:50dot text to our food icon x and then
- 15:53we'll combine that with the
- 15:55info.stat so remember we just added the
- 15:58stat property to each table so that's
- 16:00where we're getting the stat from and
- 16:01we'll also do the same thing for the
- 16:02money stat so instead of the food logo
- 16:04we'll just do the money logo and we set
- 16:06that the exact same way additionally i
- 16:08realized they made a slight mistake when
- 16:10we set the price text we actually forgot
- 16:12to add on the r money symbol that they
- 16:14have onto there so there we go we now
- 16:16added that and now that we have all of
- 16:17that we can now generate exactly how we
- 16:19do with the passes for the pets so we
- 16:21can just copy and paste this and we can
- 16:23say pets and then we need to pass
- 16:25through the pets template and the pest
- 16:26container so let's initialize those
- 16:28variables up here we'll copy and paste
- 16:30that so pets container and then the pets
- 16:33template and then when we call the
- 16:34function we want to pass through the
- 16:36pets template and the pets container so
- 16:38there we go now let's start up our game
- 16:40and check it out also make sure that you
- 16:41set the template to not visible so that
- 16:43you don't see that and we're just going
- 16:45to set this container to not visible
- 16:46either because we want the first
- 16:47container to be the passes container but
- 16:49since we were debugging and stuff like
- 16:51that that's why the other one was
- 16:52visible anyway when we load in we now
- 16:54still see the passes loaded up which is
- 16:56perfect let's click on ultra pets and we
- 16:58now see that these have been created
- 16:59exactly as they should be they have the
- 17:01stat at the top left they have the price
- 17:03and then they would have the image if we
- 17:04did use one looking at the numbers
- 17:06though it does make me want to add the
- 17:07number formatter to this so let's go
- 17:09ahead and do that if you guys don't know
- 17:10what the number four matter is we
- 17:12actually added that a while ago when we
- 17:14were creating the shop it's basically a
- 17:15module that we're using and i'm just
- 17:17going to go back into our shot manager
- 17:18copy this and i will paste it directly
- 17:20into here so now we have the format
- 17:22number i'm going to rename it though so
- 17:24capital f and capital m for the format
- 17:26number since i don't exactly remember
- 17:27how to use it off the top of my head we
- 17:29can search for how to use it so we're
- 17:30going to use format compact exactly like
- 17:32how they do so let's find where we have
- 17:34our numbers at so for instance we have
- 17:36them at the price so we'll say format
- 17:38number dot format compact and then wrap
- 17:40our number inside of parentheses so
- 17:43there we go then we can copy this and
- 17:44we'll use that for the stat as well so
- 17:47just like that and then for the last
- 17:48stat as well so we can go ahead and
- 17:50start this up once again and make sure
- 17:51the numbers are now formatted correctly
- 17:53and we can see that if we go to the
- 17:54ultra pets we have 19k and 100k 10k 4k
- 17:58and exactly as we want them now if you
- 18:00guys want the format module or you guys
- 18:02want to know how to use it there are
- 18:03more ways of formatting your numbers
- 18:05i'll leave a link down below in the
- 18:06description to the number format module
- 18:08that i used and i introduced in previous
- 18:10episodes so that you guys can check it
- 18:11out for yourself so the next thing that
- 18:13we want to do is we'll go back to the
- 18:14config and we will add another category
- 18:16we're actually going to copy and paste
- 18:18the passes table once again because this
- 18:20time we'll actually be adding in the
- 18:21coined game pass and the coin game
- 18:23passes are nearly identical to the
- 18:25passes so for the first one we're going
- 18:26gonna say plus
- 18:28276.4 k underscore coins and the price
- 18:31of that is going to be 79. the second
- 18:33one is going to be 4.1
- 18:36m and the final one is going to be 15.2
- 18:39m and then for the prices the second
- 18:40one's going to be 179 and the third one
- 18:43is going to be 399. now we shouldn't
- 18:45have to make any changes to the generate
- 18:47so all we have to do is just add the
- 18:49variable for the coins container and the
- 18:51coins template as well we'll once again
- 18:53add an if statement for the coins and
- 18:55we'll pass through the coins template
- 18:57and the coins container and start up our
- 18:59game and make sure that those work as
- 19:01they should so if we click on coins we
- 19:02can see the coins are generated the only
- 19:04thing that we have to do is actually
- 19:05hide the initial template so go into the
- 19:07coins container let's go ahead and set
- 19:09the visibility of this to false now the
- 19:11final one which is slightly more
- 19:12complicated is we need to add in the
- 19:14boost config so for boost we'll just
- 19:16copy the coins template we'll just copy
- 19:18the quinn's config we'll paste it below
- 19:20pets and we will set this to boosts and
- 19:22now i'm just going to delete the other
- 19:23two boosts and we'll just make one first
- 19:25and then copy this two times the first
- 19:27one is gonna be times five underscore
- 19:29luck the price of it is going to be 149.
- 19:32now for boost if we look inside the
- 19:33template and we look at the prices we
- 19:35can see that each of them have three
- 19:37durations and that'll be 10 minutes 30
- 19:39minutes and then a one hour duration so
- 19:41we need to set three different prices
- 19:43for each of the boosts so for boost
- 19:45we're gonna say price one and this would
- 19:47be the price for the ten minute boost
- 19:48and we're going to set that to 149 then
- 19:51for price 2 which would be the 30 minute
- 19:52boost we're gonna set that to 399 and
- 19:55then for price three which would be one
- 19:56hour we're gonna set that to 699. then
- 19:59we will duplicate this two times then
- 20:01we're going to say times 50 underscore
- 20:04food and times five underscore coins now
- 20:06the price for 50 food is the same as the
- 20:09luck but for the five times coins the
- 20:10first one is gonna be 49 the second one
- 20:12is going to be 99 and the third one is
- 20:14going to be 149. now that we have this
- 20:16we once again need to modify the
- 20:17generate function to accommodate the
- 20:19brand new config now there's a couple
- 20:20things that are different about the
- 20:21boost templates compared to all the
- 20:23other templates the first difference is
- 20:25that one the actual template itself is a
- 20:27frame and not a text button so we're
- 20:29gonna have to accommodate that and then
- 20:31additionally for the prices the template
- 20:33doesn't have a price text label actually
- 20:35has a prices frame with more frames
- 20:36inside of it so where we set the price
- 20:38for all of our templates so far we
- 20:39actually need to do something similar to
- 20:41what we do up here so we're going to say
- 20:42local price equals clone
- 20:45find first child price and then if we do
- 20:48find the price then what we'll do is
- 20:50what we've been doing this entire time
- 20:52so we'll do that otherwise we then know
- 20:54it's a booster template so we need to do
- 20:56something to specific for this template
- 20:58so we'll create another variable called
- 21:00prices and we're going to set that to
- 21:02clone.prices
- 21:03and the reason for that is because
- 21:04inside of this template we have the
- 21:06frame which is named the prices that
- 21:07holds all three of these other frames
- 21:10then we'll create three more variables
- 21:11so we're going to say price 10 equals
- 21:13prices dot and you can't do dot 10
- 21:16because that's invalid syntax what we
- 21:18need to do is we need to surround it in
- 21:20brackets and then we say 10 and then we
- 21:22could say dot buy and the reason we're
- 21:24doing that is because we're getting this
- 21:25frame right here and then we're getting
- 21:27the buy text button right here and then
- 21:28we want to create this same variable for
- 21:30the two other prices as well so price 30
- 21:33and price 60 and then we just need to
- 21:34change what we're indexing so price 30
- 21:37and price 60 and then we'll there we go
- 21:38now that we have all those what we then
- 21:40want to do is we want to say price 10
- 21:42dot price because the price label is
- 21:44inside of this buy button and then we'll
- 21:46set the text of the price text label
- 21:48inside of the button to info dot price
- 21:51one so now that we did that for 10 we've
- 21:53got to do that for 30 and 60 as well so
- 21:55we'll set price 30 to 2 and price 60 to
- 21:58price three and finally we need to
- 22:00handle the clicking of the buy button so
- 22:02what we're gonna do is we're gonna say
- 22:03price price ten dot mouse button one
- 22:07click connect create a new function and
- 22:09then for right now we'll just print true
- 22:11and then we'll duplicate this two times
- 22:13and then we'll do that for the remaining
- 22:15buttons so price 30 and price 60 and now
- 22:17we have all those buttons set up and now
- 22:19the final thing that we need to do for
- 22:20the mouse button click right here the
- 22:22boost template is a frame so it doesn't
- 22:24have a mouse bond one click event so
- 22:26what we need to do is we need to say if
- 22:28clone is a text button so if it's a text
- 22:31button then we will connect the mouse
- 22:33button one click event to the clone
- 22:35exactly like that then what we should do
- 22:36is make sure that the template is not
- 22:38visible and we need to do one more thing
- 22:40and that is create the for loop for them
- 22:42so we'll just copy the pets right here
- 22:44and we're going to say boosts and we
- 22:46also need to get the variables for them
- 22:47as well so boost container boost
- 22:50container boost template and we got to
- 22:51feed through the boost template and the
- 22:54boost container so then we'll start the
- 22:55game up open up the boost container and
- 22:57now we see this looks as it should so we
- 22:59have times five lux with all the
- 23:00different times if we click on the
- 23:02buttons we can see that they all do
- 23:03print out true then we have the
- 23:05timeshifty food once again we can click
- 23:07the buns and see if they print out and
- 23:08then we also have the times five coins
- 23:10as well and then for the coins we also
- 23:12have those as well we can click on those
- 23:13for the pets these all work as well and
- 23:15then for the passes they work too the
- 23:17final thing that we need to do is create
- 23:18the actual game passes and developer
- 23:20products before we create those we
- 23:22should differentiate between the two so
- 23:24that you guys know exactly which one you
- 23:25want to create game passes are meant to
- 23:27be are meant to be purchased one single
- 23:30time whereas developer products are
- 23:31meant to be purchased as many times as
- 23:33you want so for instance in the passes
- 23:35category we have the infinite food we
- 23:37most likely want this to be a game pass
- 23:39because we want the player to only be
- 23:40able to purchase this one time and will
- 23:42make it a permanent effect over the
- 23:44course of while they play but for
- 23:45packages like the coins maybe even the
- 23:47pets and the boosts we want those to be
- 23:49developer products because we want
- 23:50players to be able to repurchase them as
- 23:52many times as they want now for game
- 23:53passes you're unable to access those or
- 23:55create those in studio so you have to go
- 23:57to the roblox website make sure you're
- 23:59signed into the same account that you
- 24:00are in studio and you're creating the
- 24:02game on then you're going to want to
- 24:03click on create this will take you to a
- 24:04webpage which shows all the experiences
- 24:06that you've created on this page find
- 24:08the experience that you want to create
- 24:09the game passes for and then click the
- 24:11little settings icon this will create a
- 24:12drop down menu and you're going to want
- 24:14to click on create pass now on this page
- 24:16we are able to finally create our game
- 24:18pass so you can upload any image you
- 24:19want to display as your pass icon i'm
- 24:21just going to use the thumbnails for my
- 24:23past videos for hours then for the past
- 24:25name that will basically be the name or
- 24:26the title of your game pass we'll create
- 24:28the pass for two times food as i already
- 24:30created one for infinite food then for
- 24:32the description you can obviously set
- 24:34this to whatever you want to earn two
- 24:36times food while playing or you don't
- 24:38even have to add a description it's
- 24:39whatever you want to do then click on
- 24:41preview and if everything looks good
- 24:42click verify upload and it should create
- 24:44the game pass for you then when you see
- 24:46the passes click on the settings icon
- 24:48next to the newest one and then click
- 24:49configure and you'll be taken to this
- 24:51page right here you're going to want to
- 24:52go to sales and you're going to want to
- 24:53set this item for sale so players can
- 24:56actually buy it then you're going to
- 24:57want to set the price of the pass and
- 24:58for this pass it's going to be 549 and
- 25:01roadblocks tells us how much we'll earn
- 25:02from this so we're going to get 384
- 25:04robux every single time somebody buys
- 25:06this product now that this pass has been
- 25:08all set up we want to grab the id of the
- 25:10game pass from our address bar so we can
- 25:12see the id of this is six zero five five
- 25:14five six zero five and we're gonna need
- 25:16that for later now we'll create a
- 25:17developer product so inside a studio
- 25:19click the home tab and then click on
- 25:21game settings now when you open this you
- 25:22wanna go to the monetization tab and
- 25:24then here you can create badges but if
- 25:26you scroll down a little bit further you
- 25:27can also create developer products as we
- 25:29see i've already created a couple but
- 25:31let's go ahead and click on the create
- 25:32button now when we create one it'll just
- 25:34add it to this list right here let's go
- 25:35ahead click on the three dots click on
- 25:37edit and now give it a name and the
- 25:38price so for this we are going to say
- 25:40plus 276.4k
- 25:43coins and the price we're gonna set this
- 25:45to 79. and then we'll click save and if
- 25:47we open up the settings again go to
- 25:49monetization we can see we now have the
- 25:51developer product which turns out i
- 25:53already made this one already but that's
- 25:54fine this is just to show you guys how
- 25:55to create them and once again the
- 25:57important part here is the product id we
- 25:59are going to need that to easily copy
- 26:01this you just click on the three dots
- 26:02and then it gives you an option to copy
- 26:04the id to clipboard so then we have the
- 26:05id which is exactly what we need so now
- 26:07that we've created both the game pass
- 26:09and the developer product we can start
- 26:10adding that to our config and handling
- 26:12it in the shop so let's head over to the
- 26:14gamepad shop config and now we want to
- 26:16add new entries to all of the different
- 26:18items so for every single game pass item
- 26:20we want to create a new field called
- 26:22pass and the value of that is going to
- 26:24be the id of the game pass now for
- 26:26infinite food we didn't create that one
- 26:28this time but we did create the two
- 26:30times food so we're going to say pass
- 26:31equals and this is the game pass id that
- 26:33we created on the roblox website and
- 26:35then for all the developer products we
- 26:37want to add a field to them called
- 26:39product and we're going to set that to
- 26:40the id and remember we can go to
- 26:42monetization and we can and we can copy
- 26:44the id directly from here so let's go
- 26:46ahead take that id paste it into here
- 26:48and now we have an example of both a
- 26:49game pass and a developer product with
- 26:52the id so we can use these to prompt the
- 26:54player to purchase them so let's go back
- 26:55into the handler and start creating ways
- 26:57to prompt the player to purchase a
- 26:58specific item that they click on at the
- 27:00top of the script we want to initialize
- 27:02a new service and this is actually going
- 27:03to be the marketplace service and we're
- 27:06going to use the marketplace service to
- 27:07handle prompting the player to purchase
- 27:09the items so we want to scroll down to
- 27:10where we check if the clone is a text
- 27:12button then inside of here we want to
- 27:14check if it is a game pass or not so
- 27:16we're going to say if info.pass meaning
- 27:18that this has a pass field then what
- 27:20we're going to do is we're going to
- 27:22create a new variable called has pass
- 27:24and we're going to set this to true if
- 27:25the player already owns this game pass
- 27:27then we're going to say local success
- 27:30comma message equals p call and we're
- 27:32going to use a p call here and then
- 27:33we're gonna create an anonymous function
- 27:35inside of there and then we'll set has
- 27:36pass to marketplace service user owns
- 27:39game pass async then we need to pass the
- 27:42player's user id and the game pass id
- 27:44through to this method so we're gonna
- 27:46use the player service and then we'll
- 27:47just create a variable called local
- 27:49player equals players.local player and
- 27:51now we have the actual player so back
- 27:53down to the method we're going to say
- 27:55player.userid and pass through their id
- 27:57and then we're going to pass through the
- 27:59actual game pass id so we're going to
- 28:00say info.pat now the reason that we need
- 28:02to wrap this in a p call is because it's
- 28:04an async function and most of the times
- 28:06when you use async functions or
- 28:08functions that pull data from web pages
- 28:10or databases you usually have to wrap
- 28:11them in a p call because they can fail
- 28:13now after the p call we're gonna say if
- 28:15has passed so if this value has been set
- 28:18or it is equal to true then we can just
- 28:20print purchased for now because the
- 28:22player already owns the item otherwise
- 28:23we use the marketplace service to prompt
- 28:26purchase and then we need to pass
- 28:27through the player not the user id the
- 28:30actual player and then the info.pass so
- 28:32the pass id so that covers game passes
- 28:35but now we need to add developer
- 28:36products so inside the same if statement
- 28:38if info.pass then we want to add an else
- 28:41statement to this and all we're going to
- 28:42say is marketplace prompt product
- 28:44purchase and that refers to the
- 28:46developer products now i actually messed
- 28:47this up right here it's not prompt
- 28:49purchase it's actually prompt game pass
- 28:52purchase specifically so make sure you
- 28:53change that method if you use the other
- 28:55one so now with the prompt product
- 28:56purchase what we want to pass through
- 28:57here is once again the player and then
- 28:59we also need to pass through the product
- 29:01id so we're just going to say
- 29:03info.product because remember for the
- 29:05config if it is a product they have a
- 29:07product property so there we go we can
- 29:09also remove that print statement from
- 29:10there and we also need to add this for
- 29:11the boosters because the boosters are
- 29:13handled a little bit differently than
- 29:14the other items these are very simple to
- 29:16handle though all we need to do is we're
- 29:17just going to use the prompt product
- 29:19purchase so we'll replace the print
- 29:20statement right here in all of these and
- 29:22then we just need to do something in the
- 29:24config so the way that we're gonna have
- 29:25the config set up for these is for boost
- 29:27we're gonna say product one and that'll
- 29:29be set to the ten minute booster then
- 29:31product two is gonna be set to the
- 29:33second tier booster and then product
- 29:34three will be set to the third booster
- 29:36product id it's the exact same way that
- 29:38we did the price and we're just doing
- 29:40the same thing with different properties
- 29:41this time going back inside of the
- 29:42handler we just have to change this a
- 29:44little bit so we're going to say
- 29:45info.product1 info.product2 and
- 29:47info.product3 for the price 60 price 30
- 29:50and price 10. and now it's all good now
- 29:51we can go ahead start up our game test
- 29:53this out and see if it works now just
- 29:54remember when testing the only products
- 29:56that should actually work in this video
- 29:58is the two times food and the first coin
- 30:00package because those are the only ones
- 30:02that i just set up to showcase how to do
- 30:04it so let's click on two times food and
- 30:05we can see purchase is printed because
- 30:07if you're the owner of the game it acts
- 30:10as if you already have purchased the
- 30:11product but if we go to coins and then
- 30:13click on the first product it will pop
- 30:15up with a prompt for us to purchase this
- 30:17item because you're able to rebuy
- 30:19developer products as many times as you
- 30:20want additionally while you're in studio
- 30:22if you do purchase anything it doesn't
- 30:24subtract the robux from your account
- 30:26because it's all testing inside a studio
- 30:28and in the next episode we'll actually
- 30:29use that testing so that we can create
- 30:31the back end to our product system so
- 30:32that's going to be it for this video in
- 30:34the next episode we will create the
- 30:35entire back end and go over all that
- 30:37stuff for how to manage and give the
- 30:38player the rewards on the server side
- 30:40when they do purchase a product or a
- 30:41game pass as always if this video did
- 30:43help you guys out or you guys did enjoy
- 30:44it make sure you smash the like button
- 30:45also subscribe button and turn this post
- 30:47notifications on if you want to get
- 30:48notified when upload more roblox well
- 30:49make content of course i do have a
- 30:51patreon if you guys like to swarm me and
- 30:52gain access to all the scripts and the
- 30:53game file i made during this episode
- 30:55there's a link down below description
- 30:56and you guys can go and check that out
- 30:57with that being said i'll see you guys
- 30:58in the next episode
About this transcript
This page contains the full transcript of Scripting the Gamepass Shop Gui! Roblox Studio Simulator Guide Episode 22 by MonzterDEV, generated from the public captions YouTube serves with the video. The transcript has 7,776 words across 1,027 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.