Scripting the Pet Inventory Gui! Roblox Studio Simulator Guide Episode 27 — Transcript
Full transcript
- 0:00what's going on ladies and gentlemen in
- 0:00today's episode of the simulator series
- 0:02we're going to be scripting the pet
- 0:03inventory gui now as always if this
- 0:05video does help you guys out or you guys
- 0:07do enjoy it make sure you smash the like
- 0:08button also hit the subscribe button and
- 0:09turn this post notifications on if you
- 0:11want to get notified when upload more
- 0:12roblox vomit content additionally i have
- 0:14a patreon if you like to support me and
- 0:15gain access to all the scripts and the
- 0:17game file i make during this episode
- 0:18there's a link down below in description
- 0:19and you guys can go and check that out
- 0:20with that being said let's get into it
- 0:22hopping directly into eating simulator
- 0:23to showcase the features that we're
- 0:24going to be creating today as we can see
- 0:26that we have a button at the bottom left
- 0:27which says pets we've created this bun
- 0:29and we also created this gui in the last
- 0:31episode as well today we're going to be
- 0:32doing is scripting this bun to open and
- 0:34display this gui and we're going to be
- 0:36scripting this entire gui so inside of
- 0:38here this container frame is going to
- 0:39populate with all of the different pets
- 0:41that the player currently owns this
- 0:42little text label right here will
- 0:43display how many pets the player
- 0:45currently has equipped and this one will
- 0:46display how many pets the player
- 0:47currently has stored within their
- 0:48inventory if you click on a pet it will
- 0:50pop up inside a little info frame
- 0:52displaying the pet the rarity the stats
- 0:54and an unequip or any quit bun depending
- 0:56on if the player has one equipped or not
- 0:58if you already have the max amount of
- 0:59pets equipped and you try to look up a
- 1:00new one we will get a little warning
- 1:02text popping up at the top of the screen
- 1:03additionally you can unequip a pet or
- 1:05equip that and then you have the multi
- 1:06delete button right here as well which
- 1:08when we click this it will change the
- 1:09info frame right here to display this
- 1:11frame and then we can select all the
- 1:12pets that we want to delete this number
- 1:14will update right here as well as a
- 1:15check mark on the left of each of the
- 1:17pets and we can click confirm and all
- 1:18those pets will be deleted so with all
- 1:20that being said let's hop directly into
- 1:22studio and start working so the first
- 1:23thing we're going to do is go inside of
- 1:24the storage gy inside of the pet
- 1:26inventory and right here we have a
- 1:27script called button and we're gonna
- 1:29actually use this to script this pet bun
- 1:31right there so inside of the script we
- 1:33have the buttons gui which refers
- 1:34directly to this screen gui right here
- 1:36and inside of the screen gui we have the
- 1:38button holder which that is for the
- 1:39right hand side of the screen all of
- 1:41those buttons and the left button holder
- 1:42is obviously for the left hand side of
- 1:44the screen so where we create the
- 1:45settings button variable what we want to
- 1:47do is we want to say button gui dot left
- 1:49button holder dot pets and then we can
- 1:51rename settings button to pets button
- 1:53and we just copy this paste that
- 1:55directly right here so whenever we click
- 1:56on this button what we want to do is we
- 1:58want to enable or disable this screen
- 2:00gui right here which is the pet
- 2:02inventory so now we're done with that we
- 2:04have the bun all set up the next thing
- 2:05we're going to do is we're actually
- 2:06going to go inside of the replicated
- 2:07storage inside the config folder so
- 2:09inside of here we're gonna insert a new
- 2:10module script and we'll rename that to
- 2:12pets and inside of this table right here
- 2:14we're gonna list each of the individual
- 2:16pets so dog and we're gonna set them to
- 2:18a table with all the rarities so common
- 2:20and we're gonna set each of the rarities
- 2:22to the stats that the pet is gonna offer
- 2:24so for instance if we get a common dog
- 2:26pet the stats that this is gonna offer
- 2:28is gonna be 2.5 and if we get an
- 2:30uncommon dog pet then its stats are
- 2:32going to be 3.5 and if we get a rare dog
- 2:34pet then the stats are going to be 4.5
- 2:35let's make sure that we add commas to
- 2:37each of those and there we go currently
- 2:38our rarity system only goes up to rare
- 2:40so that's why we're just making comments
- 2:42now let's put a comma and we're going to
- 2:43do this for each of the individual pets
- 2:45so we have dog bunny cat we have a fox
- 2:48and now i'll actually start increasing
- 2:49the stats on this one as well so we'll
- 2:52just increase all those stats by
- 2:53basically one and then after fox we have
- 2:55the turtle and the pick so for the pig
- 2:58we'll once again increase all the stats
- 3:00by one as well it really doesn't matter
- 3:01considering this is just test data but
- 3:03i'm just showing you guys what you can
- 3:04do the next thing we're gonna do is
- 3:06we're gonna actually script giving a
- 3:07player to a pet so inside of the server
- 3:09script service inside of utils we have a
- 3:12rewards module which basically handles
- 3:14all the functions of how we reward
- 3:15players so what we're gonna do inside of
- 3:17here is we're going to create a new
- 3:18function and this is going to be rewards
- 3:20dot pet and this function is going to
- 3:22accept a player which of course is a
- 3:24player the name of the pet so dog fox or
- 3:26anything like that and we're just going
- 3:27to say that's pet and that's going to be
- 3:28a string and then finally we are going
- 3:30to accept rarity as a string as well now
- 3:32the way that we're gonna have our pet
- 3:33set up is each of the pets is going to
- 3:35be a folder stored with inside of the
- 3:37player now the folder name is gonna be a
- 3:39unique id and the reason that we need to
- 3:41have a unique id for every single pet is
- 3:44because let's say that the player has a
- 3:45hundred dollar all the dogs need to have
- 3:47a specific unique id otherwise we would
- 3:49never be able to tell any dog apart now
- 3:51this becomes more important when you
- 3:52have specific systems for individual
- 3:54pets such as if you had a level system
- 3:56for each individual pet if every single
- 3:58individual pet had their own level you
- 4:00would want to have a unique id attached
- 4:02to that pet so you can easily identify
- 4:04that specific pet and give it back the
- 4:05stats that it originally had now the way
- 4:07that we're gonna generate the unique id
- 4:09is by actually getting a service and the
- 4:11service that we're gonna require is the
- 4:13http service so we're going to create a
- 4:15variable for that and then inside of the
- 4:16function we're going to say local folder
- 4:18and we're going to create an
- 4:19instance.new folder and we're actually
- 4:21going to parent that to the
- 4:22player.pet inventory which we haven't
- 4:24created yet but we will create soon pet
- 4:26inventory is going to be a folder inside
- 4:28of the player very similar to how we
- 4:29have our leader stats or our other
- 4:31inventory systems as well and we're
- 4:32going to name the folder http service
- 4:34and we're going to use a method called
- 4:36generate guid which will generate the
- 4:38unique id for us and then inside of here
- 4:41we want to say false because we don't
- 4:42want the unique id to be wrapped in
- 4:44curly braces which we can see is the
- 4:46argument right here so now that we've
- 4:48created and name that folder the next
- 4:49thing we want to do is we want to create
- 4:50a string value for the pet rarity so
- 4:52we're going to say local pet rarity
- 4:54equals instance dot new string value and
- 4:57we're gonna parent this to the folder
- 4:59that we just created then we're gonna
- 5:00set the pet rarity.value to the rarity
- 5:03of the pet which is passed to us when we
- 5:04call this function and we also need to
- 5:06name this as well so we're gonna say pet
- 5:07rarity.name
- 5:09equals rarity and then we're gonna do
- 5:11this exact same thing for the type of
- 5:12the pet so we're gonna copy this we'll
- 5:14paste it and we'll rename this from pet
- 5:16rarity to pet id you could also say pet
- 5:19type but we're gonna go with pet id
- 5:21right here just to keep our system
- 5:22consistent throughout our entire project
- 5:24so pet id is gonna be a string value
- 5:26we're gonna parent that to the folder
- 5:27that we already created and now we need
- 5:28to change the rarity.name and the
- 5:30rarity.value so the name is going to be
- 5:32id and the value of this is actually
- 5:34going to be the pet that we once again
- 5:36passed through this function now finally
- 5:37we're going to create a bull value which
- 5:39is going to store if the pet is
- 5:40currently equipped or not so we're going
- 5:42to say local equipped equals instance
- 5:44dot new full value we're going to parent
- 5:46that to the folder we're going to set
- 5:48the name of this to equipped and we're
- 5:51going to set the value of this by
- 5:53default to false because the pet is of
- 5:55course going to be not equipped by
- 5:57default so whenever we reward a player a
- 5:59pet what this is going to do is it's
- 6:00going to create a brand new folder and
- 6:02it's going to store the folder inside of
- 6:03the player.pet inventory folder the name
- 6:05of this folder is gonna be a unique id
- 6:07so it's gonna be basically a bunch of
- 6:08random numbers and letters then inside
- 6:10of this folder that we just created
- 6:12there's going to be two string values
- 6:14and one full value one of the string
- 6:15values will be named rarity and that'll
- 6:17store the rarity of the pet the other
- 6:19string value will be named id and
- 6:21that'll actually store the type of the
- 6:23specific pet then we have the bull value
- 6:25which is going to be named equipped and
- 6:26by default it's going to be set to false
- 6:28but whenever we actually equip the pet
- 6:29it will be set to true now we need to
- 6:31actually create the data for the player
- 6:33so inside of our server script service
- 6:34we're going to go over to the player
- 6:36data inside of here let's scroll all the
- 6:38way down to right below this for loop
- 6:39and right above our success we're going
- 6:41to create the pet inventory folder so
- 6:42we're going to say local pet inventory
- 6:44equals instance dot new folder we're
- 6:47gonna parent that to the player the
- 6:48folder name is going to be pet inventory
- 6:52so now that we've created that folder we
- 6:53have to see if the player has any pets
- 6:55and if they do have any pets then we
- 6:56have to loop through all those pets and
- 6:58add them directly back to the player's
- 6:59folder so what we're gonna do is we're
- 7:00gonna say if return value dot pet
- 7:03inventory then so if the player has any
- 7:06pets what we're gonna do is we're gonna
- 7:07loop through the return value.pet
- 7:09inventory and now in this for loop the
- 7:11index is actually gonna be the uui date
- 7:13and the value is gonna be info in pairs
- 7:15return value dot pet inventory do now
- 7:18when we move through here what we're
- 7:19going to do is we're going to actually
- 7:20do the exact same thing that we did when
- 7:22we reward the pet to the player we can
- 7:24simply just copy all of the stuff that
- 7:26we do inside of here and paste it
- 7:27directly into here now we're not going
- 7:28to actually use the http service to
- 7:30generate a new unique id what we're
- 7:32gonna do is we're gonna set the folder
- 7:33name to the uuid which comes from right
- 7:35here inside of the loop then for the
- 7:37rarity this is gonna be stored within
- 7:38the info table so we're gonna say
- 7:40info.rarity for the pet id we're gonna
- 7:42say info.id and then for the equipped
- 7:44we're going to say info dot equip and
- 7:46there we go now this whole info table
- 7:48might be really confusing for you don't
- 7:49worry we're about to create this so
- 7:51you're going to see where the rarity
- 7:52comes from the id comes from and the
- 7:54equip comes from as well so now when we
- 7:55want to save the player's data that's
- 7:57when we're going to create the table so
- 7:58we're going to say local pet inventory
- 8:00equals a brand new table then we're
- 8:02going to do is we're going to loop
- 8:03through all the pets inside of the
- 8:05player's pet inventory folder so we're
- 8:07going to say for underscore pet in
- 8:08ipairs player.pet inventory get children
- 8:13do and now remember whenever we reward
- 8:14the player a pet we are going to create
- 8:16a new folder and put that inside of the
- 8:18pet inventory so now when we're saving
- 8:20we're going through that folder we're
- 8:22getting all the children which if the
- 8:23player does have any pets the children
- 8:25would be a folder with the name as the
- 8:27uuid and then that folder will add the
- 8:29string values and the bull value inside
- 8:31it as well with all the other
- 8:32information so what we're going to do is
- 8:33we're going to say pet inventory and
- 8:34we're going to add a brand new pet to
- 8:36this so we'll say pet.name which
- 8:38remember this is going to be the pet's
- 8:40unique id because the name of the folder
- 8:42is the uuid and we're going to set that
- 8:44equal to a brand new table inside of the
- 8:46table we're going to have an id field
- 8:47and we're going to set this to the
- 8:48pet.id which is the string value dot
- 8:51value so that we get the value of the
- 8:53string value then we're going to do this
- 8:54again but instead of for the id we're
- 8:56going to do this for the rarity so
- 8:58pet.rarity.value because remember it's a
- 9:00string value that's why we have to say
- 9:02dot value finally we're going to do this
- 9:03for equip as well so
- 9:06pet.equipped.value and now that we've
- 9:07added all the players pets to the pet
- 9:09inventory table what we want to do is we
- 9:11want to save that down here so we're
- 9:12going to save pet inventory make sure
- 9:14you capitalize the p equals the variable
- 9:16that we just created okay so that is
- 9:18perfect now we need to do is we need to
- 9:20actually reward the player the pet so a
- 9:22couple episodes ago we created this egg
- 9:24script inside of the server script
- 9:25service which handles hatching eggs
- 9:26inside of our function called hatch is
- 9:28where we determine what pet we're going
- 9:30to give to the player and now we need to
- 9:31actually reward that pet so at the top
- 9:33of our script we need to require the
- 9:34rewards module and first we need to get
- 9:36the server script service so we're going
- 9:38to say server script service and then we
- 9:40can just copy this x config because we
- 9:41already have part of this here and then
- 9:42we'll say server script service dot
- 9:44utils dot rewards there we go and then
- 9:46we're going to set the variable to
- 9:48rewards so now we have a rewards module
- 9:50and now inside of the hatch function
- 9:51right below where we actually choose the
- 9:53pet and create the pet variable we're
- 9:54gonna say rewards dot pet and we'll pass
- 9:57through the player the pet dot id and
- 9:59the pet dot rarity as well and now
- 10:01remember inside of her choose pet
- 10:02function this pet is actually a table
- 10:05from our pets config and you might be
- 10:06confused why this pet variable has an id
- 10:08and rarity but remember inside of the
- 10:10choose pet function we're actually using
- 10:12the eggs config and if you're confused
- 10:14about this eggs config we can look
- 10:15inside of here and inside of the eggs
- 10:16config we have the egg then it has a
- 10:18table called pets and inside of this
- 10:20array it has tables with id rarity and
- 10:22chance so that's how we're getting the
- 10:23id and the rarity and now we're actually
- 10:25rewarding the pet to the player and now
- 10:27we can actually test this out if we want
- 10:28to so let's go ahead and start per game
- 10:29so inside of our game we're going to
- 10:30hatch an egg and now we can see that
- 10:32we've received the common cat so let's
- 10:33look under players under monster we have
- 10:35the pet inventory folder right here and
- 10:36now we see we have a folder inside of
- 10:38here which is named after a unique id
- 10:40and inside of here we have a bull value
- 10:42which is called equipped we have a
- 10:43string value which is called id the id
- 10:45is set to cat which is the pet that we
- 10:46just got and the rarity is at the common
- 10:48and that's the rarity of the cat that we
- 10:50just got as well so now if we can
- 10:51actually again we can see a new photos
- 10:53created inside of our pet inventory with
- 10:54another unique id the equip is set to
- 10:56false the id is set to pig and the
- 10:58rarity is set to rare so we are actually
- 11:00now rewarding the player the pet which
- 11:01is awesome so now with all that being
- 11:03done we can actually start working on
- 11:04and scripting the gui so i'm going to go
- 11:06ahead and close all of the scripts that
- 11:07we currently have open and we'll close
- 11:09some of the folders and now let's
- 11:10actually go into the pet inventory
- 11:11screen gui let's open up the handler for
- 11:13starters we're actually going to delete
- 11:15pretty much everything out of here so
- 11:17we're just going to clear this all out
- 11:18and basically just make it a normal
- 11:20brand new module script so just like
- 11:21that and now we want to make some small
- 11:23adjustments to the gui so inside of the
- 11:24frame inside the container inside of
- 11:26that container inside of this template
- 11:28right here and inside of this holder we
- 11:30need to set the visibility of the delete
- 11:31text label to not visible so that we
- 11:33don't always see this and the same goes
- 11:35with the equip as well and then finally
- 11:36we also want to set the template to not
- 11:38visible as well then we can close all of
- 11:40these and we can go directly inside of
- 11:42our manager now within our manager we're
- 11:44going to clear some of these variables
- 11:45out because we're not going to need all
- 11:46this stuff so we'll leave the handler
- 11:48for now we'll keep the remotes we won't
- 11:49be using the settings but we will be
- 11:51using the pets config so from the
- 11:52replicated storage we're going to get
- 11:53the config.pets so now we have the pets
- 11:56config let's go ahead and rename this
- 11:57from settings to pets config we're also
- 11:59going to need the pet models as well so
- 12:01we're going to say local pet models
- 12:03equals
- 12:04replicatedstorage.pets then since these
- 12:06variables are already created we can
- 12:07actually keep the screen guy the frame
- 12:09and the container we can also keep the
- 12:10exit button as well and the template is
- 12:12good too but we're gonna delete the on
- 12:14and off color and then we're gonna
- 12:15delete the generate settings function
- 12:17and this for loop right here too so now
- 12:19if that's all properly cleaned up this
- 12:21is exactly what you should have left
- 12:22inside of your script all right so now
- 12:24what we're going to do is we want to
- 12:25create a for loop for generating the
- 12:27player's pets and how do we know what
- 12:28pets the player has well all the pets
- 12:30are stored inside of the folder named
- 12:32pet inventory inside the player so we're
- 12:33going to say for underscore pet in
- 12:35ipairs player.pet inventory get children
- 12:40do now let's create a function called
- 12:41pet instance to table and now this is
- 12:44going to accept an instance called pet
- 12:46inside of this function we're going to
- 12:47create a new variable called new pet and
- 12:49we're going to set that to a blank table
- 12:51and then using this table we're going to
- 12:52say
- 12:53newpet.uuid
- 12:55equalspet.name and now if you're
- 12:56confused by this how we're going to
- 12:57actually use this function is we're
- 12:59going to say local pet table equals pet
- 13:02instance 2 table and we're going to pass
- 13:04through the pet and remember inside of
- 13:05the pet inventory folder inside of the
- 13:07player when we loop through here this
- 13:08pet variable is going to be a folder and
- 13:10the name of that folder is going to be
- 13:12the unique id of that pet so that's why
- 13:14we're creating a brand new table and
- 13:15sending the uuid property of that table
- 13:17to the pet.name as that is what the uuid
- 13:20is then we're gonna say newpet.id which
- 13:23refers to the actual type of the pet
- 13:25such as dog frog pig or anything like
- 13:27that and how we're gonna get that is by
- 13:29saying pet dot id dot value because
- 13:32remember inside of the actual pets
- 13:34folder there is a string value called id
- 13:36and the value of that is the id and then
- 13:38we can duplicate that and then we're
- 13:39just going to do the same thing for the
- 13:40rarity so inside of the pet we have the
- 13:42rarity string value and we want to get
- 13:44the value of that and then we're going
- 13:45to say new pet dot equipped and that's
- 13:48also inside of the pet dot equipped dot
- 13:50value and the final thing we want to do
- 13:51is we want to return the table that we
- 13:53just created and now already inside this
- 13:55for loop we are setting a brand new
- 13:56variable to the table that we get
- 13:58returned from this function then what we
- 13:59want to do is above this function we're
- 14:01going to create a new function and the
- 14:02name of this function is going to be
- 14:04generate pet and it's going to accept
- 14:05the pet which is going to be a table and
- 14:07that's actually going to be the exact
- 14:09table that we create in this function
- 14:10right here so as we're going through
- 14:12this for loop and we get the brand new
- 14:13pet table we want to call the
- 14:15generatepet function and pass through
- 14:17the pet table that we just created now
- 14:18inside of the generatepet function what
- 14:20we're going to do is we're going to
- 14:21create a new variable called clone and
- 14:22we're going to set that to the template
- 14:24and we're going to clone that then we
- 14:25want to make sure that we set the
- 14:26visibility of it to true and we also
- 14:28need to make sure that we set the parent
- 14:30of this to the container frame then
- 14:33let's set the name of this to the pet
- 14:35dot uuid now let's go look at the
- 14:37template so we see we have the template
- 14:38right here we want to change the pet
- 14:39name we probably want to modify the
- 14:41equipped and we also want to modify the
- 14:43viewport frame as well so what we want
- 14:44to do is we want to say clone dot holder
- 14:46dot pet name dot text equals clone dot
- 14:50id and we use g sub on this because in
- 14:52case any of your pets have like a space
- 14:54in between there you're going to want to
- 14:55replace the underscore with an actual
- 14:57space and we also want to set the equip
- 14:59text label to either visible or not
- 15:01visible based on if the pet is actually
- 15:03equipped or not so we're going to say
- 15:04clone.holder.equipped.visible
- 15:07equals and then we're going to say pet
- 15:09dot equipped oh and i meant to say
- 15:11pet.id and then the g-sub not clone id
- 15:14because that doesn't make any sense now
- 15:15the reason that we're setting the
- 15:16visibility to pet.equipped is because if
- 15:18the pet is equipped this will be set to
- 15:20true otherwise it will be set to false
- 15:22so now that we have both of those things
- 15:24set the next thing we need to do is we
- 15:25need to work on the viewport frame now
- 15:27if you guys remember from a couple of
- 15:28episodes ago when we created the eggs
- 15:29billboard gui we actually worked with
- 15:31the viewport frame in there and we did
- 15:33that exact same thing so we can actually
- 15:34copy the code directly from this script
- 15:36and put it directly into our other
- 15:37script additionally i saw a comment on
- 15:39my last video which said that people are
- 15:40getting a red underscore when using the
- 15:42set primary part c frame and the reason
- 15:44for this is because i think literally
- 15:46after i uploaded my video they actually
- 15:48depreciated the set primary part c frame
- 15:51method and replaced it with the pivot 2
- 15:52method so if you guys were getting that
- 15:54error in the last episode i'm sorry
- 15:55about that it literally just happened as
- 15:57i upload it because you guys saw on my
- 15:59recording there were no issues there so
- 16:01that is really weird all you have to do
- 16:02is change that method from set primary
- 16:04part c frame to pivot 2 and it will be
- 16:06the exact same thing and it'll be all
- 16:07good with that all being said what we're
- 16:09going to do is we're going to actually
- 16:10copy the generate viewport frame
- 16:11function and we're going to paste that
- 16:13above the generatepet function inside of
- 16:15here and now that we have that function
- 16:16inside of here the first thing that we
- 16:17need to do is we need to actually get a
- 16:19clone of the pet model local pet model
- 16:22equals pet models and we're going to
- 16:24index that with the pet dot id and then
- 16:26once we find that we're going to clone
- 16:28it then we're going to call the generate
- 16:29viewport frame function and we're going
- 16:31to pass through here the
- 16:34clone.holder.viewportframe and we're
- 16:35also going to pass through the pet model
- 16:36as well and then really the last thing
- 16:38is is that whenever we click on the pet
- 16:39which is a text bond we want to actually
- 16:41do something so we're going to say clone
- 16:43that mouse button one click connect
- 16:44we're going to create a brand new
- 16:45function inside of here and for right
- 16:47now we're not going to do anything
- 16:48besides just print true so we can go
- 16:49ahead and start up our game and see if
- 16:51this works and we can see when we
- 16:52started per game we now have a pig and a
- 16:54cat being displayed so we have the name
- 16:55of the pet displayed above it and then
- 16:57we also have the viewport frame showing
- 16:58the pet model as well which means that
- 17:00this is working out really good if we
- 17:01click on the pet we can see that true is
- 17:03printed out as well so we know that
- 17:04that's working too this is perfect now
- 17:06we're going to start working on the info
- 17:08frame that appears whenever you click on
- 17:10a pet before we do that though what we
- 17:11want to do is we want to go inside of
- 17:13the info frame inside of the pet and
- 17:15inside of the viewport frame we actually
- 17:17want to modify the background
- 17:18transparency to one because we don't
- 17:20want there to be any background display
- 17:21then we're going to do is in between the
- 17:22generate viewport frame and the generate
- 17:24pep function we're going to create a
- 17:25brand new function called display pet
- 17:28info and inside of here we're going to
- 17:30once again accept the pet which is going
- 17:32to be a table now we actually need to
- 17:33create some variables for the info frame
- 17:35so below the container frame we're going
- 17:36to say local info equals frame dot info
- 17:39and then below that we're going to say
- 17:41local pet info equals info.pep and then
- 17:44that'll be good for now so back inside
- 17:45of the display pet info function inside
- 17:47of this info frame we actually display
- 17:49the stats of the pet so we need to get
- 17:51those stats and remember earlier we
- 17:52created a brand new config called pets
- 17:54and inside of that config we actually
- 17:56set all the stats for the specific pet
- 17:58and their rarity so what we're gonna do
- 17:59is we're gonna say local pet stat equals
- 18:02and we're gonna use the pets config and
- 18:04we're gonna index this with the name of
- 18:05the pet so pet dot id then we'll index
- 18:08the table return when we index the pet
- 18:10id with the pet dot rarity and that will
- 18:12give us the stat of the pet then we want
- 18:14to get the actual instance of the pet
- 18:15which is going to be inside of the pet
- 18:17inventory folder which is inside of the
- 18:19player so we're going to say local pet
- 18:20instance equals player.pet inventory and
- 18:24then we're going to find first child so
- 18:27we're going to search through this
- 18:27folder and we're going to search for a
- 18:29child name that through the uuid of the
- 18:31pet so that'll be afraid of those two
- 18:32variables what we then want to do is we
- 18:33want to modify the pet name text label
- 18:35so we're going to say head info dot pet
- 18:37name dot text equals pet dot id and
- 18:40we're gonna also use the g sub method
- 18:42that we use down here so we're just
- 18:43gonna copy and paste that then we wanna
- 18:44modify the rarity text label so we can
- 18:46just copy this and we're gonna replace
- 18:48pet name with rarity and now what we're
- 18:49gonna do is we're gonna say pet dot
- 18:51rarity and now remember when we modify
- 18:53the rarity we also wanna modify the
- 18:54color of the text based on the rarity of
- 18:56the pet and we also did that for the
- 18:58billboard guise that we created before
- 18:59as well so if we go back inside of her
- 19:01eggs folder inside of her handler we
- 19:02also have a function right here called
- 19:04get rarity by color and what we can do
- 19:05is we can go ahead and copy that and
- 19:07we'll paste that as the first function
- 19:08in our script as well so then let's say
- 19:10pet info dot rarity dot text color three
- 19:13equals get rarity color and then all we
- 19:16have to do is provide the pet dot rarity
- 19:18so now we're changing the pet name text
- 19:20label we're also modifying the rarity
- 19:21text label and the color of that as well
- 19:23and you know as i'm looking at this i
- 19:25realized that we accidentally left an
- 19:26extra text label in here called warning
- 19:28from when we actually created this you
- 19:30can delete that warning text label it
- 19:32does not mean anything and we're not
- 19:33going to actually use it i just
- 19:34completely forgot to delete it anyways
- 19:36now that we have that deleted the next
- 19:37thing we need to do is we need to
- 19:38actually modify the food stat and the
- 19:40money stat text labels inside of the
- 19:42stats frame so what we're going to do is
- 19:43we're going to say pet info dot stats
- 19:45frame dot food stat dot text equals and
- 19:48now remember when we set this text we
- 19:50want to prefix this with the food symbol
- 19:52and x so we'll say equals through symbol
- 19:54dot x dot dot and we're gonna combine
- 19:56that with the pet stat just like that so
- 19:59then we can duplicate this and instead
- 20:00of the food stat this time we're gonna
- 20:01modify the money stat instead of
- 20:03displaying the food emoji we're gonna
- 20:04display the bunny emoji now that we've
- 20:06done all that we also need to set the
- 20:07viewport frame as well and we're gonna
- 20:09do this the exact same way that we did
- 20:10when we generate the pet so what we're
- 20:12gonna do is we're just gonna copy and
- 20:13paste this directly into here and then
- 20:15we just need to provide the viewport
- 20:16frame so we're gonna say
- 20:18viewport frame petinfo.viewportframe
- 20:20there we go the next thing that we need
- 20:21to consider is the equip button whenever
- 20:23we click on a pet depending on if it is
- 20:25equipped we need to modify the equip
- 20:26button based off if the pet is already
- 20:28equipped or if it's not equipped if the
- 20:30player has the pet equipped already then
- 20:32we want to display the equip button as
- 20:33having a red background and we want the
- 20:35text to actually say unequipped because
- 20:37we obviously don't want the player to be
- 20:39able to equip a pet they already have
- 20:40equipped and of course on the opposite
- 20:42end if the pet is currently unequipped
- 20:44we want the button to be displayed as
- 20:45green and say equipped so what we're
- 20:47going to do is we're going to say if pet
- 20:48instance and we're using the pet
- 20:50instance because this will tell us if
- 20:52the pet is currently equipped pet
- 20:53instance dot equipped dot value then and
- 20:56like i said we're going to say pet info
- 20:58dot equip button dot text and if the pad
- 21:00is already equipped then we want to set
- 21:01this text to unequip and we're going to
- 21:03set the background color three of the
- 21:05text button to color three dot from rgb
- 21:08because that's what i prefer and it's
- 21:09going to be a reddish color so something
- 21:11like that and of course if the pet is
- 21:12not equipped then what we want to do is
- 21:14we want to set the text to equip and we
- 21:16want to set the background color instead
- 21:18of a red to be a green so then what we
- 21:20need to do is inside the generatepet
- 21:22function inside of where we listen for
- 21:24the click what we're going to do is
- 21:25remove this print statement then we're
- 21:27going to call the displaypetinfo
- 21:28function and we're going to pass through
- 21:29the pet which is the table that is
- 21:31passed through to the generatep function
- 21:32and we also want to set the visibility
- 21:34of the pet info frame to true so that is
- 21:37being displayed and we can go ahead and
- 21:38start our game and test that out so we
- 21:40can see both of our pets are being
- 21:41generated when we click on them we can
- 21:43now see that this info frame now pops up
- 21:45we can see the name of the pet is cat
- 21:46the rarity is common and it's a gray
- 21:48color the stats are 2.5 and we have the
- 21:50equip button and the delete button right
- 21:52here if we click on the pick we can see
- 21:53that the information changes so the name
- 21:55is pig the color is blue the rarity is
- 21:57rare the color of the rarity is blue the
- 21:59stats are 6.5 we have the equip on there
- 22:02and we also have the trash can as well
- 22:03so this is working perfectly another
- 22:05thing that we need to do though
- 22:06otherwise we're gonna have a memory leak
- 22:07it's back inside of the display pet info
- 22:09function what we need to do is every
- 22:11single time we call this function what
- 22:12we do is we clone the model of the pet
- 22:14and then we parent that to the viewport
- 22:16frame so we need to delete the old pet
- 22:18model before we add a new one otherwise
- 22:20we're gonna have a memory leak now we
- 22:22can do this really easily so above where
- 22:23we create the pet model variable we're
- 22:25going to say local previous model equals
- 22:28pet info dot viewport frame find the
- 22:30first child of class and now the class
- 22:33that we're going to be looking for is
- 22:34model so what this is going to do is
- 22:36going to look for the viewport frame and
- 22:37check if any of the children inside of
- 22:39the viewport frame is a model and if we
- 22:41are able to find one then what we want
- 22:42to do is we want to destroy them so
- 22:44basically every single time we call this
- 22:45function we're going to see if there is
- 22:46a model currently existing inside of the
- 22:48viewport frame and the first time that
- 22:50we call this there will not be because
- 22:51we of course haven't put a model in
- 22:53there yet but the second time that we
- 22:54called this function there will be a
- 22:56model inside of the viewport frame and
- 22:57then that one will be destroyed and
- 22:59we're basically going to replace it with
- 23:00a brand new one so this will patch up a
- 23:02memory leak which could cause your
- 23:03players to lag after a while the next
- 23:05thing we're gonna do is we're gonna
- 23:06actually start organizing this code a
- 23:08little bit which is actually why we
- 23:09cleared everything out of the handler
- 23:10script so what we're gonna basically do
- 23:11is we're gonna basically move everything
- 23:13to inside of the handler script so we're
- 23:14gonna copy all those variables paste
- 23:16them directly into there and then all of
- 23:17these functions that we created we're
- 23:19gonna paste inside of there as well so
- 23:21we're gonna remove them from the manager
- 23:22script and put them inside of the
- 23:24handler and then instead of saying local
- 23:26function for all of them we're gonna
- 23:27remove the local keyword and we're just
- 23:29gonna say module dot at the beginning of
- 23:31the name so once again remove local and
- 23:33add module to all of them as well now
- 23:35once we've done that for all the
- 23:36different functions what we then need to
- 23:37do is we need to update the function
- 23:39calls inside of here which have a red
- 23:40underlined to them as well so all we
- 23:41have to do is paste module dot next to
- 23:44them and that'll make sure that we're
- 23:45calling the function once again and
- 23:46there we go now all the functions have
- 23:48been set back up perfectly then back
- 23:49inside the manager we don't actually
- 23:51have these two functions anymore so now
- 23:52we have to say handler.pet
- 23:54instance2table and handler.generatepet
- 23:57as well and if we just go ahead and
- 23:58start this up we can see that it all
- 24:00should work perfectly fine uh actually
- 24:01one issue that we're gonna have with
- 24:02this is because we copy and pasted all
- 24:04the variables from the script into here
- 24:05we actually brought over the require of
- 24:07this specific module right here and of
- 24:09course if a module requires itself then
- 24:10there will be an error so anyway we can
- 24:12start this up and see that this should
- 24:13work perfectly fine and it does so that
- 24:16is perfect the next thing we're going to
- 24:17do is we're going to go back inside of
- 24:18our manager and we're going to actually
- 24:19start scripting the equip button which
- 24:21is inside of the info pet frame so this
- 24:24button right here so let's actually
- 24:25create a variable for that so we're
- 24:26going to say local equip button equals
- 24:29pet info dot equipment then we can do is
- 24:31before this for loop and above the exit
- 24:33button we're going to say equip button
- 24:34dot mouse button one click connect
- 24:36function and create a brand new function
- 24:37inside of here now back inside of the
- 24:39handler we're going to actually create a
- 24:40brand new variable inside of here and
- 24:41we're going to say module dot selected
- 24:44pet equals no because by default we
- 24:46don't want there to be any selected pet
- 24:48but we're going to set this variable any
- 24:50time that we click on a pet so if we go
- 24:51back to our generate pet function what
- 24:53we're going to do is we're going to set
- 24:55the selected pet variable to the current
- 24:57pet so back inside of the manager then
- 24:58what we want to do is inside of this
- 25:00function we're going to say if not
- 25:02handler dot selected pet then return end
- 25:05so if we don't currently have a selected
- 25:06pet then we're just going to not do
- 25:08anything otherwise we're going to use a
- 25:09remote function and we actually need to
- 25:11create this real quick so inside of the
- 25:12replicated storage inside of remotes
- 25:14we're gonna add a brand new remote
- 25:15function and the name of this remote
- 25:17function is gonna actually be called pet
- 25:18equip so now we're gonna say local
- 25:20result equals remotes dot pet equip
- 25:24invoke server and what we're gonna pass
- 25:25through the server is the handler
- 25:29so anytime we click on a pet it's going
- 25:31to set this variable to that specific
- 25:32pet if we try to equip it we want to
- 25:34tell the server and we want to give the
- 25:35server the uuid of the pet that we want
- 25:37to equip so that the server can identify
- 25:39it and equip it for the player if it
- 25:41should equip it for the player now let's
- 25:42think about the logic for a second
- 25:43behind this remote function this remote
- 25:45function is going to return something
- 25:47and let's think about what it should
- 25:48return well if the player is able to
- 25:49equip the pet then it should return
- 25:51equipped but then let's also think that
- 25:53the equip button doesn't only act as an
- 25:55equip button and what i mean by this is
- 25:57that the equip button will also say
- 25:59unequipped sometimes as well if the
- 26:00player is currently equipped so the
- 26:02petty quit remote function isn't only
- 26:03trying to equip it but it should also
- 26:05unequip it as well if the pet is
- 26:07currently equipped so we should also
- 26:09return unequipped and imagine if the
- 26:11player is not allowed to equip any more
- 26:12pets when they try to equip this pet
- 26:14then we should do is we should return
- 26:15full so that we know that the player
- 26:16cannot equip any more pets let's start
- 26:18doing things on the client side that we
- 26:20should be doing based off those results
- 26:22so first off if there is no result
- 26:23because there's some type of error all
- 26:25we want to do is we just want to cancel
- 26:27the function out right here and that's
- 26:28why we're saying if no result then
- 26:29return n then what we want to do is we
- 26:31want to actually find the template of
- 26:33that specific pet inside of our
- 26:35container so we're going to create a
- 26:36brand new variable called pet template
- 26:38instance and what we're gonna do is
- 26:39we're gonna set that to container and
- 26:41inside of the container we're gonna try
- 26:42to find the first child and the name of
- 26:44the child is going to be
- 26:46handler.selectedpet.uuid now that we
- 26:48found that we're gonna do things based
- 26:49off of the result so we're gonna say if
- 26:51result equals equipped then so if the
- 26:54pet has just been equipped then what do
- 26:56we need to do back inside of the gui we
- 26:58actually need to go inside of the info
- 26:59inside of the pet and now we want to
- 27:01modify the equip button because if we
- 27:02just equipped it we want the equip
- 27:04button to now say unequipped because if
- 27:06we just equip the pet we now want the
- 27:07bun to say unequipped and we want the
- 27:08background color to be red which if that
- 27:10sounds familiar well yeah that's
- 27:11actually what we did right here when we
- 27:13display the pet info so what we can
- 27:14actually do is we can copy this and
- 27:16paste that directly into here so if the
- 27:18result equals equip we're going to set
- 27:19the button text to display unequipped
- 27:21and we'll also change the background
- 27:22color as well and another thing that we
- 27:23need to do is with the pet template if
- 27:25we go inside of the container and inside
- 27:27of the template and inside the holder we
- 27:28can see that we have this equip text
- 27:30label right here we want that equipped
- 27:31text label to actually be displayed or
- 27:33visible so the player knows that that
- 27:35pet is currently equipped so what we're
- 27:37going to do is we're going to say pet
- 27:38template instance dot holder dot
- 27:41equipped dot visible equals true now
- 27:44where we have this else statement we're
- 27:45going to actually change this to an else
- 27:46if statement and we're going to say else
- 27:48if the result equals unequipped then now
- 27:51we're going to do the opposite we're
- 27:52going to set the equip button text to
- 27:53equipped we're going to change the
- 27:54background color to green and of course
- 27:56for this we want to set the equipped
- 27:57visibility inside of the pet template to
- 27:59false so that it's no longer displayed
- 28:01and remember we have one more possible
- 28:03result so we're going to say else if
- 28:04results equals full now this could just
- 28:07be an else statement instead of an else
- 28:09if statement but i like using else if
- 28:10statement so that we can remember what
- 28:12all the result values could possibly be
- 28:14and now if we do get full we're just
- 28:15gonna print out full and now that looks
- 28:17pretty good now we need to actually
- 28:18create more player info because one we
- 28:20need to know how many pets the player
- 28:22can have equipped and how many they can
- 28:23also have stored so back inside of the
- 28:25server script surface inside of the
- 28:26player data script we're gonna go down
- 28:27to where we just created the pet
- 28:29inventory folder right here and we're
- 28:30going to actually create a brand new
- 28:31folder so i'm just going to copy and
- 28:32paste that and change this from pet
- 28:34folder to pet info so the name of this
- 28:36folder is of course going to be pet info
- 28:38and inside of this folder we're going to
- 28:39actually create the max equipped so
- 28:41we're going to say pets max equipped
- 28:44equals instance dot new int value we'll
- 28:47parent that to the pet info folder that
- 28:48we just created we'll say pets max
- 28:50equipped dot name equals max equipped
- 28:53and we will set the value of this and
- 28:56we'll set the value of this to three so
- 28:57by default the max amount of pass the
- 28:59player can have equipped is three then
- 29:00we're going to do the exact same thing
- 29:02but instead of for the max equipped this
- 29:04is gonna be for the max stored so
- 29:05instead of max equipped we're gonna say
- 29:07max stored we'll change the variable for
- 29:08all these and then the name of this is
- 29:10of course gonna be max stored and the
- 29:11default value should be 50. now the only
- 29:13way that this number will ever change
- 29:15usually is if the player purchases game
- 29:17passes considering i'm not going to be
- 29:18implementing the game passes for these
- 29:20specific features and considering you
- 29:22guys have watched this entire tutorial
- 29:23up to this episode you guys should most
- 29:25likely understand how to implement these
- 29:27game passes yourself and also how to
- 29:28implement the data saving yourself as
- 29:30well i'm not going to be saving the data
- 29:32because we're not implementing the game
- 29:33passes so this number will never change
- 29:35meaning we don't actually have to save
- 29:36this data the same goes for this data as
- 29:38well anyways now that we've created the
- 29:39player data for these specific things we
- 29:41then want to create a brand new server
- 29:42script inside of the server script
- 29:44service and we'll rename this to pets
- 29:46now instead of the server script we are
- 29:47going to get the replicated storage
- 29:49because remember we created that pet
- 29:50equip remote function and we're going to
- 29:52handle that inside of here then we're
- 29:53going to create a variable for remotes
- 29:54and we're going to say remote is
- 29:56replicated storage dot remotes then at
- 29:58the bottom of our script we're going to
- 29:59say remotes dot pet equip dot on server
- 30:02invoke and we're going to connect that
- 30:04to a brand new function so let's create
- 30:05a brand new function up here we're going
- 30:06to say local function pet equip and
- 30:08we're going to accept the player who
- 30:09called this function as a player object
- 30:11and we're going to accept the uuid which
- 30:13is going to be a string so then of
- 30:15course on the server invoke we're going
- 30:16to set that to the pet equip function
- 30:18that we just created now the first thing
- 30:20we're going to do inside of the pet
- 30:21equipped function is that we're going to
- 30:22actually see if the player has the pet
- 30:24that they say that they want to equip or
- 30:26unequip and the reason we're doing this
- 30:27is because remember the client can
- 30:29always lie to us so we need to make sure
- 30:30that the information that they're
- 30:31telling us can actually even be found so
- 30:33we're going to say local pet equals
- 30:35player dot pet inventory because that's
- 30:38where all the pets are stored find first
- 30:40child and then we're gonna try to find
- 30:41the first child with the name of the
- 30:43uuid passed to us and then if we're not
- 30:45able to find that pet so if not pet then
- 30:47we're just gonna return n so that we
- 30:48stop the function right there now if we
- 30:50are able to find the pet we actually
- 30:51want to check if the pet is equipped so
- 30:53we're going to say if pet dot equipped
- 30:56dot value then so if the pet is equipped
- 30:58then we want to actually unequip the pet
- 31:00so we're going to say pet dot equip dot
- 31:02value equals false and then we're just
- 31:04going to return unequipped so that we
- 31:06know that we did just unequip the pet
- 31:08now if the pet is not equipped we want
- 31:10to check if the player is able to equip
- 31:12the pets what we want to do is we're
- 31:13going to create a function up here
- 31:15called can equip pet and inside of here
- 31:18what we're going to do is we're going to
- 31:19accept the player the way that we're
- 31:20going to determine if the player can't
- 31:21equip the pet is if the amount of pets
- 31:23the player currently has equipped is
- 31:24less than the max amount of pets the
- 31:26player is allowed to equip we can get
- 31:28the max amount of pets the players
- 31:29allowed equipped easily and we'll do
- 31:30this by saying local max equipped equals
- 31:34player dot pet info dot max equipped
- 31:38that value because remember we just
- 31:39created this not too long ago inside of
- 31:41the player data script now that we have
- 31:42this we also need to figure out how many
- 31:44pets the player currently has equipped
- 31:45so we'll create a brand new function and
- 31:47we'll say amount equipped and this will
- 31:50also accept a player as well then we're
- 31:51gonna do is we're gonna say local
- 31:53equipped equals zero so we're setting
- 31:54the equip variable to zero then what
- 31:56we're gonna do is we're gonna loop
- 31:57through all the pets that are inside of
- 31:59the player's pet inventory so we're
- 32:00going to say for underscore pet in
- 32:03ipairsplayer.pet
- 32:05inventory get children do so this is
- 32:08going to loop through all the pets
- 32:09inside of the pet inventory then we want
- 32:10to do is we want to check if that pet
- 32:13has the equip value set to true so if
- 32:15pet dot equipped dot value then and if
- 32:18it is set to true then what we want to
- 32:20do is we want to add one to the equipped
- 32:22variable and then at the end we will
- 32:24return equip and this will give us the
- 32:26total amount of pets that the player
- 32:27currently has equipped so then back
- 32:28inside the can equip pet function we're
- 32:30going to say local currently equipped
- 32:33equals amount equipped and we'll pass
- 32:35through the player then we'll say return
- 32:37currently equipped less than max
- 32:39equipped so if the player currently has
- 32:41less pets equipped than the max amount
- 32:43that they're allowed to have then this
- 32:44will return true meaning the player is
- 32:46allowed to equip a pet otherwise say the
- 32:48player has three pets equipped and
- 32:49they're only allowed to have three
- 32:50equipped then this will return false
- 32:52meaning that they're not allowed to
- 32:53equip any more pets and we're gonna use
- 32:55this function back inside of the pet
- 32:56equip function and we're gonna say else
- 32:59if and we're gonna check if the player
- 33:00can equip a pet by saying can equip pet
- 33:02will pass through the player and if the
- 33:04player is allowed to equip the pet we
- 33:05already know that this pet is not
- 33:07equipped so then we're gonna see if the
- 33:08player is allowed to equip the pet and
- 33:10if the player is allowed to equip a pet
- 33:11then we're going to set the equipped
- 33:13value to true so pet.equipped.value
- 33:16equals trip additionally in the next
- 33:18episode we'll create a pet following
- 33:19system so we'll make pet follow the
- 33:21player here and then also we want to
- 33:23return equipped because we just equipped
- 33:25the pet now finally we're going to say
- 33:27else and this basically means that the
- 33:28player is unable to equip the pet we're
- 33:30going to return full because the player
- 33:32already has the max amount of patch that
- 33:34they can have equipped now that we have
- 33:35that it's all created we can go ahead
- 33:36and start our game and test this out so
- 33:38when we press the equip on we can see
- 33:39that the pet is actually now equipped we
- 33:41can see this is displayed on the pet we
- 33:42can now see that the equip button
- 33:44displays unequip and it's red and also
- 33:45if we look inside players inside of our
- 33:47player inside of the pet inventory and
- 33:49if we check inside of these pets
- 33:50whichever one is the cat so this is the
- 33:52pig this is the cat the equip should now
- 33:54be set to true meaning that we now have
- 33:56the pet equipped and also if we click
- 33:58unequip this value should now be set to
- 33:59false and we can see it is properly set
- 34:01to false which means this is working
- 34:03perfectly the next thing that we want to
- 34:04do is we want to actually create a
- 34:06warning which tells the player that
- 34:07they're unable to equip any more pets
- 34:08currently the way that we're going to do
- 34:10this is by going into the frame and
- 34:11we're just going to actually duplicate
- 34:13the subtitle we'll rename this to
- 34:14warning and then we're going to put this
- 34:16directly above the frame make this a
- 34:18little bit smaller so something like
- 34:20that we'll set the text to you cannot
- 34:22equip another pet exclamation mark and
- 34:25we'll also set the color to a little bit
- 34:27of a darkish red as well and then we
- 34:29also want there to be a stroke behind
- 34:30this as well so we'll set the text
- 34:32stroke transparency to zero and actually
- 34:33i spelled equip wrong so you cannot
- 34:35equip you cannot equip another pet and
- 34:38then we're gonna set the visibility of
- 34:39this to false because we don't wanna
- 34:40always see it so then we can go back
- 34:42inside of the manager and now we're
- 34:43gonna do is if the result equals full
- 34:45then what we actually wanna do is
- 34:46display the warning label and let's
- 34:48actually create a variable for the
- 34:49warning so we're going to say local
- 34:51warning equals frame dot warning there
- 34:53we go and if the result equals full
- 34:55we're going to set warning.visible to
- 34:57true so the player sees the warning and
- 34:59we also want to make the warning not
- 35:00visible after a couple of seconds as
- 35:02well so we're gonna say test.delay we'll
- 35:04let it be visible for like three seconds
- 35:06we'll say function and then we're gonna
- 35:07say warning dot visible equals false so
- 35:10it is no longer displayed the next thing
- 35:11we wanna do is we wanna calculate the
- 35:13amount of pets that the player currently
- 35:14has equipped so that we can change this
- 35:16number directly up here so insider for
- 35:18handler kind of towards the top like
- 35:19right above the display pet info so
- 35:21we're gonna create a new function inside
- 35:22of here which is going to be called
- 35:23update pets equipped and that's not
- 35:26going to accept any arguments and we're
- 35:28pretty much going to do the exact same
- 35:29thing that we did in the amounts
- 35:31equipped function up here so we can
- 35:32actually just literally copy this paste
- 35:34it directly inside of here and then
- 35:36towards the end once we figure out how
- 35:37many pets the player does have equipped
- 35:39we're gonna modify the equipped text
- 35:40label inside of the stats frame and
- 35:42let's go ahead and create a variable for
- 35:43this so right below info we're going to
- 35:45create a variable for stats so we're
- 35:46going to say local stats and we'll say
- 35:48local equip stat equals stats dot
- 35:52equipped and we'll also create a
- 35:53variable for storage as well so storage
- 35:56and equipped storage so back down to the
- 35:59update pets equipped function we're
- 36:00going to say equip stat dot text equals
- 36:03and now let's look at how this text is
- 36:04currently set up so we want to make sure
- 36:06that we display the pet icon then we
- 36:08want to display the amount that's
- 36:09currently equipped dot dot and then we
- 36:11want to add a slash to this and then to
- 36:12the right of the slash we want to say
- 36:14the max amount of pass that the player
- 36:15can have equipped so the way that we get
- 36:16this is by saying player dot pet info
- 36:19dot max equipped dot value and that'll
- 36:22give us the max amount of pass the
- 36:23player is currently allowed to equip now
- 36:24that we've created this function we
- 36:25actually want to call this a couple of
- 36:27different times so we want to call this
- 36:28when the script first starts up so we're
- 36:29going to say handler.updatepets equip
- 36:31additionally we want to call this when
- 36:33we either unequip or equip a pet as well
- 36:35so we can paste that directly inside of
- 36:37both of those and that's it for right
- 36:39now so now that we started to update the
- 36:40pets equipped text label the other thing
- 36:42that we also need to do is create a
- 36:43function for updating the storage label
- 36:45as well and right above where we created
- 36:47the update pets equip function we can
- 36:48create another function and this is
- 36:49going to be update pets stored now
- 36:52figuring out how many pets the player
- 36:53currently has stored with inside of
- 36:54their inventory is extremely simple so
- 36:56we're going to create a variable for
- 36:57this and it's going to be called stored
- 36:58and what we're going to do is we're
- 36:59going to say player dot
- 37:01pet inventory get children and get
- 37:04children is going to return an array and
- 37:05all we have to do to figure out how many
- 37:06objects are inside of an array is just
- 37:08add a hashtag to the beginning of this
- 37:10and this will return the amount of
- 37:11children that are inside of pet
- 37:13inventory so now we just have to modify
- 37:14the storage label and i actually messed
- 37:16up the name of this variable instead of
- 37:17equipped storage it should actually be
- 37:20storage stat i don't know how i messed
- 37:22that up but anyway going back to this
- 37:23function we're going to say storage stat
- 37:25dot text equals and now let's see how
- 37:27this text label is actually set up so we
- 37:28see that it is prefixed with this little
- 37:30box emoji right there then we say the
- 37:32amount that we currently have stored dot
- 37:33dot we add a slash between the stored
- 37:35and then we need to display the max
- 37:37store that the player can currently have
- 37:38and we do the basically the exact same
- 37:39thing inside the update pets equipped
- 37:41function right there so we can copy and
- 37:42paste this and now instead of saying max
- 37:44equipped we're going to say max store so
- 37:45now we need to think about when do we
- 37:47need to actually update the amount of
- 37:48pets that the player currently has
- 37:50stored inside of their inventory well
- 37:51the first thing that i can think of is
- 37:52that we want to call this when the
- 37:54script first runs so we basically need
- 37:56to update the default data inside of the
- 37:57gui with the actual player data so we're
- 37:59going to say update pets stored we
- 38:01should also call this whenever we delete
- 38:02a pet which currently we don't have that
- 38:04functionality set up but that's just an
- 38:06idea and then also whenever the player
- 38:07obtains a new pet from hatching an egg
- 38:09we also want to call this as well and
- 38:10we're able to tell when a player gets a
- 38:12new pet because we actually have the
- 38:13remote event called pet hatched right
- 38:15here and that's called whenever an egg
- 38:17is hatched by the player so we can
- 38:18actually listen to whenever that remote
- 38:20is fired so we can say remote dot pet
- 38:22hatched dot on client event connect and
- 38:24then we can just simply pass through the
- 38:26handler dot update pet stored function
- 38:27right there so now that we have that all
- 38:29set up we can see that the player
- 38:30currently has two out of 50 stored pets
- 38:32and then if we equip a pet we can see
- 38:33this player now has one out of three
- 38:35equipped and if we clip another one we
- 38:36get two out of three and if we unequip
- 38:38we can see one out of three now we want
- 38:39to set up the functionality for actually
- 38:41deleting a pet if we go inside of our
- 38:43info frame inside of the pet we can see
- 38:44that we actually have a delete button
- 38:46right here so what we want to do is we
- 38:47want to create a variable for that
- 38:49delete button so we're going to say
- 38:50local delete button equals pet info dot
- 38:53elite button then we can listen for this
- 38:54to be clicked right below the equip
- 38:56button so we can say delete button mouse
- 38:58button one click connect and we will
- 38:59connect that to a brand new anonymous
- 39:01function and now we're going to be doing
- 39:02a lot of the same stuff that we did
- 39:03inside of when we listened for the equip
- 39:05button to be collect so we first want to
- 39:06check if the handler does select the pet
- 39:08is set to a pet then we also want to
- 39:09create a remote event inside of our
- 39:11remotes folder so we're going to rename
- 39:12the remote event to pet elite then when
- 39:14we click the delete button we're going
- 39:15to actually fire that remote event so
- 39:17we're going to say remotes dot pet
- 39:18delete buyer server and we're going to
- 39:20pass through the
- 39:21handler.selectedpet.uuid
- 39:24very similar to when we invoke the
- 39:25server on the pet equipped remote
- 39:27function so this is going to tell the
- 39:28server that we want to delete this
- 39:29specific pet and then just like how when
- 39:31we equip the pet we also want to get the
- 39:32pet template instance as well in this
- 39:34function so we're going to get that and
- 39:36then what we want to actually do is
- 39:37since we're deleting it we want to
- 39:38destroy this template which is held
- 39:40inside of the container because we
- 39:41obviously don't have this pet any longer
- 39:43additionally every single time we delete
- 39:45a pet we want to set the visibility of
- 39:46the pet info frame to false because we
- 39:48no longer want that frame to be
- 39:49displayed and then when we delete a pet
- 39:51we also want to update the amount of
- 39:52pets that are currently stored within
- 39:54the player's inventory and also if the
- 39:56player had that pet equipped we also
- 39:57need to update the amount of pets that
- 39:58the player currently has equipped as
- 40:00well so what that means is we're just
- 40:01going to say handler update pet stored
- 40:03and then handler update pets equip now
- 40:05the one thing is that we can actually
- 40:06call these functions directly after we
- 40:08get the pet deleted because the way that
- 40:10these functions actually work is by
- 40:12going through the player's inventory and
- 40:13we basically need to add a small delay
- 40:15to when we call both of these functions
- 40:17because the client basically needs to
- 40:18wait a couple of milliseconds for the
- 40:20server to actually react to the remote
- 40:22that we just fired so what we're going
- 40:23to do is we're going to say test.delay
- 40:25and the amount of seconds that we could
- 40:26put in here is like literally 0.5 it
- 40:28doesn't have to wait much time at all
- 40:30and then we'll just create an anonymous
- 40:31function inside of here and then we will
- 40:33call both of those functions inside of
- 40:35this small delay so anyway now that we
- 40:36created that let's go back inside of the
- 40:38pet script inside of the server script
- 40:39service and now we need to actually code
- 40:41the functionality for deleting a pet so
- 40:42let's go ahead and create a function
- 40:43below the pet quip function and we're
- 40:45just going to say pet delete and this is
- 40:47going to accept the exact same arguments
- 40:49as the equip function so it's going to
- 40:50accept player and the uuid of the pet
- 40:52that they want to delete and then of
- 40:54course we want to check if the pet
- 40:55exists so we'll just do this exact same
- 40:56thing inside of this function and if we
- 40:58are able to find the pet then all we
- 41:00want to do is we want to destroy that
- 41:01path then we'll connect the pet delete
- 41:03remote event to the brand new function
- 41:04that we just created so remotes that pet
- 41:06delete dot on server event connect and
- 41:08we'll save the pet delete function so
- 41:10now let's go ahead and start up our game
- 41:11and test this out so if we click on our
- 41:13cat and then we click the delete button
- 41:15we can see that the pet has been deleted
- 41:17and we can see that the stored pets have
- 41:18been updated as well and the info frame
- 41:20is now not visible and we can do the
- 41:22same thing with the pig and now it all
- 41:23works perfectly additionally if you
- 41:25wanted to you could go back inside of
- 41:26the manager and you can actually set
- 41:28this delay to like literally .01 and
- 41:30that delay should be long enough for the
- 41:32server to react to the remote firing now
- 41:33another thing that we need to think
- 41:34about is what if the player has the pet
- 41:36inventory open on their screen and they
- 41:38hatch another pet well when this happens
- 41:40we want to add that pet that they just
- 41:41hatched directly to their inventory to
- 41:43update it and if we remember correctly
- 41:44we're already listening to the pet hatch
- 41:46remote event that fires whenever an egg
- 41:48hatches a brand new pet the thing is
- 41:49though if we go inside of the service
- 41:51service and inside of the egg script
- 41:52what information is actually included
- 41:54with this remote event well this table
- 41:56right here is actually included whenever
- 41:57we fire the remote event and the only
- 41:59thing that's actually inside of this
- 42:00table well we can see that inside of
- 42:02replicated storage inside of our configs
- 42:04and inside of our eggs config so this
- 42:05table for example would be included in
- 42:07the pet hatch remote so we would get the
- 42:09id the rarity and the chance but the
- 42:11thing is that we need more information
- 42:12than just what's included here the most
- 42:14important thing is that we need the uuid
- 42:16of the pet so what we're actually going
- 42:17to do is we're going to go back inside
- 42:18of the service service inside of the
- 42:20utils and inside the rewards module and
- 42:22when we reward a pet what we actually
- 42:24want to do is we want to return that
- 42:26folder instance that we just created as
- 42:28well so we can actually say local pet
- 42:30instance equals and now the rewards.pep
- 42:32function is returning that instance to
- 42:34us so then whenever we fire this remote
- 42:36event to the client we can pass through
- 42:37the pet and we can also pass through the
- 42:39pet instance as well so then going back
- 42:41inside of the manager when we listen to
- 42:43the pet hash remote event on the client
- 42:45what we can do is create an anonymous
- 42:46function and this anonymous function is
- 42:48going to accept the pet which is going
- 42:50to be a table and the pet instance which
- 42:52is going to be an instance and now what
- 42:54we want to do with this information is
- 42:56we want to generate a brand new pet and
- 42:58add that directly to the container and
- 42:59we already done this before right up
- 43:01here inside this for loop so what we
- 43:02need to do is we need to convert the
- 43:04instance to a table and then we just
- 43:05need to call our generatepet function so
- 43:07we're literally going to copy the code
- 43:08directly from there paste it in here and
- 43:10now instead of saying pet we actually
- 43:11want the pet instance because remember
- 43:13the pet table is just a basic table from
- 43:15the egg which doesn't give us enough
- 43:16information that's why we created the
- 43:18pet instance and now that we've done
- 43:19that this should work perfectly so let's
- 43:21go ahead and start up our game and see
- 43:22how this works so we can see the
- 43:24inventory is already open we can see
- 43:25that once we hatch a pet the pet gets
- 43:27added directly to our inventory and we
- 43:29can keep hatching more and more pets and
- 43:30we see that they keep getting added
- 43:32directly to our inventory which means
- 43:33this is working perfectly now one of the
- 43:35last few things that we need to script
- 43:36up is the multi-delete functionality and
- 43:38that's this button right here so the
- 43:40multi-delete functionality basically
- 43:41includes clicking on this button the
- 43:43info frame changes to a different info
- 43:45frame from the normal pets one and then
- 43:46what we want to do is we want to be able
- 43:48to select a couple of different pets and
- 43:49then be able to click a button which
- 43:50will then delete all the pets that we
- 43:52had select so what we're going to do is
- 43:53we're going to go inside of the handler
- 43:55and also i'm going to close this handler
- 43:56which is actually from within side of
- 43:58the eggs billboard gy that we created
- 43:59the other day so now we just have this
- 44:01handler and this manager opened up then
- 44:02we're going to do is towards the top of
- 44:04this we're going to create new variables
- 44:05so we're going to say module dot
- 44:06selected pets and this is going to be a
- 44:09table so we're going to use selected
- 44:10pets when we go into the multi-delete
- 44:12mode and then also we're going to have
- 44:13another variable called mode and by
- 44:15default this is literally going to be
- 44:17set to default and when we're not in
- 44:18default the other mode is going to be
- 44:20called delete so we're gonna have
- 44:21default and delete both as modes all
- 44:23right so let's go back down to the
- 44:24generate pep function which is right
- 44:26here currently we do these three things
- 44:28whenever we click on a pet but the thing
- 44:30is is that the functionality needs to
- 44:32change when we click on a pet based on
- 44:33the mode that we're currently in so if
- 44:35we're in the multi-delete mode then what
- 44:36we want to do is differently than what
- 44:38we want to do when we're in the normal
- 44:39default mode every time we click on a
- 44:41pet so what we're going to say is if
- 44:43module dot mode equals default then then
- 44:46we want to do the stuff that we've
- 44:48already been doing so far else now let's
- 44:50go back inside of our gui and inside of
- 44:52the info we have the pets frame and the
- 44:53delete frame and if we look inside of
- 44:55the delete frame one thing that we're
- 44:56going to need to modify is the text
- 44:58label called selected and if we look at
- 44:59the text it says pet selected and then
- 45:01the number of pets that are actually
- 45:03selected at the end so let's go ahead
- 45:04and create a variable towards the top of
- 45:06our script for the delete info so we can
- 45:08copy pet info and say delete info and
- 45:10delete so now that we've got that frame
- 45:12what we can do is we can come back down
- 45:13to here at the bottom of this else
- 45:14statement we can say
- 45:15deleteinfo.selected.txt
- 45:18pets selected semicolon space and then
- 45:21somehow we're going to add a number to
- 45:23the end of this okay so now imagine that
- 45:24we're in the delete mode and we want to
- 45:26start selecting pets and the way that
- 45:27we're going to select pets is of course
- 45:29by clicking on the pet template so what
- 45:31we're going to do is when we select the
- 45:32pet we're going to say table dot insert
- 45:34and then the table that we're going to
- 45:35be using is the module dot selected pets
- 45:38and what we're going to insert into this
- 45:39table is going to be the pet table that
- 45:41is given to us as an argument and then
- 45:43additionally if you look back inside of
- 45:44the container inside of the template we
- 45:46have this delete text label right here
- 45:48and anytime we select the pet that we
- 45:50want to delete inside of the
- 45:51multi-delete mode we want to make sure
- 45:53that this text label is visible so the
- 45:54player knows they have this pet selected
- 45:56for deletion so then what we're going to
- 45:58do is we're going to say
- 45:59clone.holder.delete.visible
- 46:02equals true so now this is selecting the
- 46:04pet and this is displaying that the pet
- 46:06has been selected and now that we've
- 46:07selected a pet we can actually use this
- 46:09table right here to determine the amount
- 46:11of pets that we currently have selected
- 46:12so all we have to do is we say dot so we
- 46:15can add on to the string and we're going
- 46:16to say
- 46:18module dot selected pets make sure you
- 46:20say selected pets not selected pet and
- 46:22of course the hashtag before the name of
- 46:24the table will tell us how many objects
- 46:25are inside of this table but now the
- 46:27other thing that we have to think about
- 46:28is when we click on a pet we also want
- 46:30to be able to deselect them or unselect
- 46:32them as well so what we should do is
- 46:33inside of this l statement we should
- 46:35create an if statement and what we want
- 46:36to do is we want to check if the pet is
- 46:38currently selected so the way that we
- 46:40can do this is by saying table.find and
- 46:42the table that we're going to look
- 46:43through is of course the
- 46:44module.selectedpets and we want to try
- 46:46to find the pet so if we are able to
- 46:48find the pet then we want to do
- 46:49something so if the pet is not selected
- 46:51then we're going to select the pet and
- 46:52we're also going to display to the
- 46:54player that we have selected the pet and
- 46:55i think the most obvious thing that
- 46:56we're going to do is if the pet is
- 46:58already selected then we of course want
- 46:59to set the visibility of the delete text
- 47:01label to false effectively telling the
- 47:02player that they have unselected that
- 47:04pet and then also we want to remove that
- 47:06selected pet from the table as well so
- 47:08we're going to say table dot remove and
- 47:10of course the table is going to be
- 47:11selected pets and you might think that
- 47:12you might just be able to put pet but
- 47:14when you're using table remove you
- 47:15actually need to put the position of
- 47:17that object inside of the table and the
- 47:19way that we can do that is by using
- 47:20table.font table.find actually returns
- 47:23the position that it found that element
- 47:25inside of the array so now that we have
- 47:26the functionality for selecting and
- 47:28unselecting a pet and then updating the
- 47:30amount of pets that are currently
- 47:31selected we now have to actually script
- 47:32when we click on the multi-delete button
- 47:34so going back inside of our manager we
- 47:36actually need to create a variable for
- 47:37the multi-delete button and let's close
- 47:39a lot of the stuff in our gui really we
- 47:41just want the frame open we don't need
- 47:42the container or the info or stats open
- 47:45so now we see we have the delete button
- 47:46which is actually the multi-delete
- 47:47button then we'll just create a new
- 47:49variable up here called multi delete
- 47:51button equals frame dot delete button
- 47:54and now towards the bottom of our script
- 47:55above the exit button we're gonna say
- 47:57multi delete button dot mouse button one
- 47:59click colon connect function so now this
- 48:02one is basically going to act as
- 48:03swapping modes so remember we have the
- 48:05default mode which basically allows you
- 48:07to click on a pet and then in the info
- 48:08panel it'll display the information
- 48:10about the pet but then we have the other
- 48:12mode we want to be able to click on
- 48:13multiple different pets select them all
- 48:14and then click a button inside of the
- 48:16info frame which basically says delete
- 48:17so those are the two modes that we have
- 48:19and we're going to be using the
- 48:20multi-delete button to effectively
- 48:21change the mode that we currently are on
- 48:23so first things first any time we click
- 48:25this button we want to set the selected
- 48:26pet to nil and we want to set the
- 48:28selected pets to a fresh table
- 48:30effectively clearing the table that was
- 48:32here before then we want to check the
- 48:33mode and if the mode is default then we
- 48:36of course want to set the mode to not
- 48:38default so our other mode is going to be
- 48:39called delete additionally we want to
- 48:41set the pet info frame to not visible
- 48:43because we're now swapping from the pet
- 48:45info mode to the delete mode and now we
- 48:47need to do is we actually need to create
- 48:48a variable for this delete frame inside
- 48:50of the info so going back to the top we
- 48:52can see pet info we'll just create a
- 48:53variable called delete info which will
- 48:55be for the delete frame inside of the
- 48:57info frame and then after we set the pet
- 48:59info frame visibility to false we want
- 49:01to set the delete info frame visibility
- 49:03to true and also we want to modify the
- 49:05selected text to zero as well otherwise
- 49:08it will always display the previous
- 49:09number on here so we're going to say
- 49:10delete info dot selected dot text equals
- 49:14pets selected semicolon zero so now
- 49:17we're all done with that and now we're
- 49:18gonna say else which effectively is
- 49:20saying if the handler mode is not
- 49:21default so if currently we're in delete
- 49:23mode and we're swapping to the default
- 49:25mode then what we're gonna do is pretty
- 49:26much the opposite of everything that we
- 49:28do inside of here excluding this right
- 49:30here so we're going to set the handler
- 49:32mode from delete to default we're going
- 49:34to set the pet info visible to true and
- 49:36the delete info visible to false but now
- 49:39we need to do one more thing and the
- 49:40reason for that is because remember
- 49:42inside of the handler whenever we select
- 49:44the pet we set the visibility of the
- 49:46delete text label inside of that clone
- 49:48to true and what we want to do is
- 49:49whenever we swap from the delete mode to
- 49:51the normal mode we want to unselect all
- 49:53those pets and visibly show that as well
- 49:55so what we need to do is we need to loop
- 49:57through all the pets inside of the
- 49:58container so we're going to say get
- 50:00children do and inside of the container
- 50:02we also have a ui corner so what we're
- 50:04going to do is we're going to say if not
- 50:06pet is a text button then continue end
- 50:09so if the child that we're looping
- 50:10through in the container is not a text
- 50:12bond then we're just going to continue
- 50:14end oh in my apologies it's not actually
- 50:15a ui corner we're looping through this
- 50:17container right here and it's going to
- 50:18be a ui grid layout and the reason that
- 50:20we need to make this continue statement
- 50:22is because of this ui grid layout so now
- 50:24we basically are guaranteeing that pet
- 50:25is going to be one of the templates
- 50:27inside of this container and then we can
- 50:28index the template by saying pet dot and
- 50:31then we need to go into the holder so
- 50:32pet dot holder dot delete dot visible
- 50:35equals false alright so let's go ahead
- 50:38and test this out so when we load into
- 50:39our game we can see we have a couple of
- 50:40different pets inside of inventory if we
- 50:41click on a pet we can see that the info
- 50:43frame is displayed as it should be if we
- 50:45click on multi-delete we can now see
- 50:46this multi-delete frame pop up it is
- 50:48displayed and it says the pet selected
- 50:50is zero if we click on a pen we can see
- 50:52that this little icon pops up showing
- 50:54that we have that pet selected we can
- 50:55click on a couple we can also deselect
- 50:57them as well and all of them are
- 50:58deselected now the last thing that we
- 51:00really need to do is actually script
- 51:02this confirm button right here so that
- 51:03we can delete all the selected pets and
- 51:05also if we click the multi delete button
- 51:06again all of those pets will be
- 51:08unselected the info frame will be
- 51:09displayed again and now we're good to go
- 51:11so the next thing we need to do is we
- 51:12need to create a variable for this
- 51:14confirmation for the confirm button
- 51:16right here inside of the delete frame so
- 51:18let's go back towards the top and we can
- 51:19create a variable for this so we can say
- 51:21local confirmation button equals the
- 51:24info dot confirmation button and there
- 51:26we go and then right below where we
- 51:27listen to the multi delete button mouse
- 51:29button one click we can do the same
- 51:31thing for the confirmation button and
- 51:32then create an anonymous function just
- 51:34like that alright so whenever we click
- 51:35on the confirmation button what we want
- 51:36to do is we want to loop through the
- 51:39handler.selectedpets table that we
- 51:41created and for each pet that we go
- 51:42through we want to actually fire off the
- 51:44pet delete remote event so we're going
- 51:45to say fireserver and what we want to
- 51:47pass through to the server is the
- 51:48pet.uuid telling the server which
- 51:50specific pet we want to delete and also
- 51:52similar to how we use the delete button
- 51:54up here we also need to get the pet
- 51:55template instance and then we're going
- 51:57to destroy that as well so we're pretty
- 51:58much doing the exact same thing that we
- 52:00did up here inside of this function as
- 52:01well so we're going to say pet template
- 52:03instance grab that instance and it's not
- 52:05going to be from the
- 52:05handler.selectedpet.uuid
- 52:07it's going to actually be the pet.uuid
- 52:09exactly how we used up here and then
- 52:11we're going to find that instance and
- 52:12we're going to destroy it and now we're
- 52:13done with the for loop the next thing we
- 52:15want to do is we want to set the
- 52:16deleteinfo frame to not visible so false
- 52:19and then we also want to change the mode
- 52:20back to default and then we also need to
- 52:22update the pets equipped and the pet
- 52:24store just like how we doing this delete
- 52:26function right here so let's go ahead
- 52:27and copy and paste that directly into
- 52:29here start per game and test this out
- 52:30and see if it works alright so let's go
- 52:32ahead and equip the turtle pet let's go
- 52:34into multi-delete let's delete the
- 52:35turtle pet the dog pet and that dog pet
- 52:37as well click confirm and we can see
- 52:38that every single thing's been updated
- 52:40all the pets have been deleted we now
- 52:42have zero pets equipped one pet stored
- 52:44out of 50. we have this dog pet we can
- 52:45click on that we can click multi delete
- 52:47undo it everything like that it is all
- 52:49working perfectly we can also look
- 52:50inside of players inside of our player
- 52:52inside of the pet inventory and see that
- 52:53we only have this one pet left as well
- 52:55so every single thing is working exactly
- 52:57as it should be all right ladies and
- 52:58gentlemen that's gonna be it for this
- 52:59episode that's probably the longest
- 53:01episode that we've had so far but i
- 53:02really hope that it did help you guys
- 53:03out as always if this video did help you
- 53:05guys out or you guys did enjoy it make
- 53:06sure to smash like button also the
- 53:07subscribe button and turn this post
- 53:08notifications on if you want to get
- 53:10notified when i upload more roblox
- 53:11development content additionally i have
- 53:12a patreon if you guys like this for me
- 53:14and he had access to all the scripts and
- 53:15the game file they made during this
- 53:16episode there's a link down below
- 53:17description and you guys can go and
- 53:18check that out with that being said i
- 53:19hope that she has a great day and i'll
- 53:20see you guys in the next episode
- 53:23[Music]
About this transcript
This page contains the full transcript of Scripting the Pet Inventory Gui! Roblox Studio Simulator Guide Episode 27 by MonzterDEV, generated from the public captions YouTube serves with the video. The transcript has 14,276 words across 1,893 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.