Creating the Stats & Rewards Modules! Roblox Studio Simulator Guide Episode 12 — Transcript
Full transcript
- 0:00what's going on ladies and gentlemen
- 0:00welcome back to the simulator Series in
- 0:02today's episode we are going to be
- 0:03creating the stats and rewards module
- 0:05Handler for our simulator as always if
- 0:07you guys do enjoy the video or does help
- 0:09you out make sure you smash the like
- 0:10button also hit the Subscribe button and
- 0:11turn those post notifications on if you
- 0:13want to get notified when I upload more
- 0:14Roblox velic content additionally I do
- 0:16have a patreon if you guys like to
- 0:17support me and gain access to all the
- 0:19scripts and the game file that I make
- 0:20during this episode there's a link Down
- 0:21Below in the description you guys go
- 0:23check that out with that being said
- 0:24let's get into it so you're probably
- 0:26thinking why do we want or why do we
- 0:27need to make these modules let's first
- 0:29go over the rewards module there's
- 0:31countless methods that a player can earn
- 0:33rewards in most of the games if we think
- 0:34about it they have the main objective
- 0:36which in this game it's clicking every
- 0:37time you click you will get rewarded
- 0:39with a specific currency usually you
- 0:41also get rewards for daily logins
- 0:43completing quests achievements or jobs
- 0:46you can also usually purchase the main
- 0:47currency and then also entering in codes
- 0:49from Twitter or groups and things like
- 0:51that considering how many ways we can
- 0:53reward a player we should create a few
- 0:55specific functions which we'll use
- 0:56anytime we want to reward the player
- 0:58we'll simply provide the function the
- 0:59player and the amount to be rewarded
- 1:01while the function will handle all the
- 1:02other details like multipliers stats and
- 1:04things like that now let's think about
- 1:06why we want to have a module for the
- 1:07stats there are also countless ways a
- 1:09player can have increased stats in most
- 1:11games such as their level the equipped
- 1:13item that they have the pets they have
- 1:15equipped a friends bonus boosters or
- 1:17even purchases from the store as well so
- 1:20considering how many different systems
- 1:21can affect each stat of the player we
- 1:23should centralize this then whenever we
- 1:25need the value of the player specific
- 1:27stat we can call a function and simply
- 1:28provide the player the functional will
- 1:30do all of the other work of calculating
- 1:31the player stats and then we can use
- 1:32that stat however we want so let's
- 1:34actually create the modules within the
- 1:36server script service let's go ahead and
- 1:37create a new folder and we're going to
- 1:39rename this to utils if you're
- 1:41unfamiliar with what utilities are
- 1:43here's an example from one of my actual
- 1:45projects that I've been working on for a
- 1:46while now inside of this module script I
- 1:48have a function named format number and
- 1:50whenever I call this function alls I do
- 1:52is I pass through a number which can be
- 1:53either a number or a string and then
- 1:55this function will handle the backend
- 1:56work so it'll check if it's a string
- 1:58then it'll convert it to a number and
- 2:00then it'll call another function on it
- 2:01from a library and then it'll return
- 2:03that number so pretty much a utility
- 2:05module script contains different
- 2:06functions that you'll be using
- 2:08throughout your entire code base rather
- 2:10than having this format number function
- 2:12in five different scripts I put the
- 2:14function directly into one module script
- 2:15which I call from every single script
- 2:17that I want to use this function in and
- 2:19it keeps your code clean and allows us
- 2:21to centralize this one function so if
- 2:22there's ever a bug with it we can easily
- 2:24find it and fix it and stuff like that
- 2:26so with that being said hopefully I
- 2:27helped you guys understand utility
- 2:29scripts now we're going to go ahead and
- 2:30add in a brand new module script inside
- 2:32of our utils folder and we're going to
- 2:33rename this to Stats and then also for
- 2:36the module you don't have to change its
- 2:37name but I'm going to change it to Stats
- 2:39so there we go and then I'm going to
- 2:41duplicate this script and we're going to
- 2:42rename this to rewards and then we're
- 2:44going to change stats to rewards and
- 2:46there we go let's first work on creating
- 2:48the stats module script let's think
- 2:49about all the stats that we currently
- 2:51have in our game we have the food stat
- 2:53which increases the amount of food that
- 2:54you gain every single time you click we
- 2:56have the max food which increases the
- 2:58total amount of food that you can hold
- 3:00we have the coin stat which increases
- 3:01the amount of money you get from selling
- 3:03food and then we also have a general
- 3:05multiplier which you obtain from ranks
- 3:07and that increases your damage HP food
- 3:09and speed multiplier So currently we
- 3:11have about four different stats and now
- 3:13let's talk about all the different
- 3:15systems or ways that those stats are
- 3:17individually affected so the food stat
- 3:18is affected by the items that the player
- 3:20has equipped the pets that they have
- 3:21equipped the ranks that they have
- 3:23equipped if they've purchased a specific
- 3:25item for Roo from the store and also the
- 3:28booster system as well the max food Bo
- 3:30stat is affected Again by the items that
- 3:31the player has equipped it and if
- 3:33they've purchased anything from the
- 3:34store as well the coin stat is affected
- 3:36by the pets that they have equipped if
- 3:37they purchased a specific thing from the
- 3:39store and the Boost system and then the
- 3:41multiplier system that we were talking
- 3:42about with ranks is affected only by the
- 3:44rank that the player has equipped now
- 3:46the reason I wanted to go over all this
- 3:48is because we want to map out every
- 3:49single stat that we want to make a
- 3:51function for and we also want to map out
- 3:53every single thing that actually affects
- 3:55these stats and the reason for that is
- 3:57because when we're making our functions
- 3:58we want to make sure that we didn't for
- 3:59about a system and we didn't forget
- 4:01about anything when calculating the
- 4:03stats themselves so since we now mapped
- 4:05out all of the stats and what they're
- 4:06affected by let's go ahead and create a
- 4:07function for one of the stats the first
- 4:09stat that we're going to start working
- 4:10on is the food stat so let's go ahead
- 4:12and create a function for that and the
- 4:14only argument that it's going to accept
- 4:15is a player now we're going to be
- 4:17working with the general config files
- 4:18that we've been using this entire time
- 4:20inside of the replicated storage so
- 4:21let's go ahead and get all of those
- 4:22config files considering how many times
- 4:24we've already gotten those files you
- 4:26could copy it directly from the player
- 4:27data script or many of the other scripts
- 4:28that we've already done the same thing
- 4:30on now above the food function we
- 4:32actually want to create a local function
- 4:33called get item stat and that's going to
- 4:36accept the name of the item and it'll
- 4:38also accept the type of the item that
- 4:39we're going to look for as well and both
- 4:41these are going to be strings now the
- 4:42reason that we're creating the get item
- 4:44stat function is because the food stat
- 4:45is affected by the item the player
- 4:47currently has equipped so is the max
- 4:49food stat and the multiplier as well
- 4:51because that's affected by ranks so what
- 4:53the get items that function is going to
- 4:54do is we're going to pass this function
- 4:56the item that the player currently has
- 4:57equipped as well as the type of the item
- 4:59that we're looking for and then we're
- 5:00going to Loop through one of the configs
- 5:02so let's say for instance the tool
- 5:03config we're going to pass through the
- 5:05tool that the player has equipped then
- 5:06we're going to pass through tools so
- 5:07that we can know that this is the config
- 5:09we want to Loop through we're going to
- 5:10Loop through that config and then we're
- 5:11going to look for the ID which would be
- 5:13the name that we're passing through here
- 5:14and then once we find that specific tool
- 5:16with the same ID we're then going to
- 5:18return the stat that the item offers so
- 5:20as usual I feel like we've done this
- 5:21plenty of times now we're going to
- 5:23create a new variable inside of here
- 5:24called list and we are going to say if
- 5:27type equals food then tool config else
- 5:30if type equals rank then rank config
- 5:34else DNA config and that's how we're
- 5:36going to get our list then we will Loop
- 5:38through there so for underscore because
- 5:40we're not going to use the index config
- 5:42line in I pairs list do and then we're
- 5:45going to say if config
- 5:48line. is the same as name then we want
- 5:51to return the config line. stat and
- 5:54that's how we're going to get the item
- 5:56stat so now back inside of the food
- 5:57function we want to create a new
- 5:58variable called total and this variable
- 6:00is going to be used to perform the math
- 6:02on all of the different things which
- 6:04actually affect the stat so at the end
- 6:05of the script we just want to return the
- 6:07total because total will be the sum of
- 6:08all the systems which actually affect
- 6:10this specific stat let's make another
- 6:12variable inside of the food function
- 6:13called item and we're going to set that
- 6:15to the get item stat and we're going to
- 6:17provide the player. inventory. equipped
- 6:21rank. value now if you're unsure as to
- 6:23why we're providing this we can start up
- 6:25our game and we can go into the players
- 6:27we'll look inside of my player so think
- 6:29of it this way player. inventory and
- 6:31then inside of the inventory we have the
- 6:33equipped DNA the equipped rank or the
- 6:35equipped tool and then the value would
- 6:37be french fry 3 for example so that's
- 6:39why we're using that directory we set
- 6:40this system up a couple of episodes back
- 6:42and that's how our data system is set up
- 6:44but of course if you have a different
- 6:45data system that how we've set up here
- 6:47you'll obviously have to alter this to
- 6:48fit your own system so actually we're
- 6:50not going to provide it the equipped
- 6:51rank we're going to provide it the
- 6:52equipped tool because we're trying to
- 6:54figure out how much the specific item
- 6:55that the player has equipped is
- 6:56affecting their food stat and then we
- 6:58also want to pass through food the type
- 7:00as well so why don't we quickly test out
- 7:02this function to see if it actually
- 7:03works let's go inside of the tool
- 7:05manager and then we'll require that
- 7:07module script so server script service
- 7:09then local stats equals require serers
- 7:13script service. utils do stats so there
- 7:16we go we now have that and then let's
- 7:18say every single time we increase the
- 7:19player's food value let's just also call
- 7:21the stats. food as well and pass through
- 7:25the player and then let's just print
- 7:26this out as well so that we can see the
- 7:28actual amount that we get now that we're
- 7:30printing it out we also want to make
- 7:31sure that we don't forget to do the math
- 7:33So currently the only thing affecting
- 7:35the stat is the item right now so we of
- 7:37course need to add that to the total so
- 7:39we're going to say total plus equals
- 7:41item and you guys probably know this by
- 7:43now but plus equals pretty much just
- 7:44means total plus item it's just a
- 7:47simpler way of writing it so now we can
- 7:48go ahead and start the game pull out the
- 7:50tool click and we can now see three has
- 7:52been printed out and let's verify that
- 7:54that is correct so we currently have
- 7:56french fry 3 equipped and that should
- 7:58give us plus three food so that's
- 7:59working perfectly awesome so now that we
- 8:01have a general understanding of how
- 8:03we're finding the food stat value we
- 8:04should make a new function to return the
- 8:06multiplier for the specific stat so what
- 8:09I mean by that is when I displayed all
- 8:10the systems that affect the stats on
- 8:12screen they had either an addition or a
- 8:14multiplication symbol next to their name
- 8:16and the reason for that is because
- 8:17certain systems are going to be in
- 8:19additive value While others are
- 8:20multiplicative so if you think about the
- 8:21foods that the items and the pet system
- 8:24are additives to the food stat while the
- 8:26rank store and boost systems are
- 8:27actually multiplicative so what we want
- 8:29to do is we want to make a new function
- 8:31above the current food function and
- 8:32we're going to call that food multiplier
- 8:35and that's of course going to just
- 8:36accept the player again and we're pretty
- 8:38much going to set this up the same way
- 8:39so we're going to say total equals zero
- 8:41and then we are going to return the
- 8:43total so if we think back to what
- 8:44systems affect the food multiplier we
- 8:46have the rank system so we're going to
- 8:47say local rank get item stat we'll pass
- 8:50through the equipped rank this time so
- 8:52instead of tool equipped Rank and then
- 8:54we'll also pass through rank as well and
- 8:56then of course we want to do math with
- 8:58that so we're going to say total plus
- 9:00equals rank that'll add the rank to the
- 9:02multiplier and now we figured out the
- 9:03multiplier so what we can do to just
- 9:05verify that this is working as it should
- 9:07be let's go back inside of the tool
- 9:08manager and we can test this out so this
- 9:10time call the food multiplier function
- 9:12start it up and let's see what it prints
- 9:14out so we equip for french fry click and
- 9:16we can see one has been printed out and
- 9:18if you guys are confused by all the
- 9:19different numbers on line 17 that is the
- 9:21food multiplier and on line 16 that is
- 9:24just the food stat so that's good to
- 9:25know that that is working perfectly fine
- 9:27now one thing I want to make note of
- 9:28that could possibly be different if your
- 9:30system is different than ours is the
- 9:32multiplier should probably never
- 9:34actually be zero because of course if
- 9:36you guys multiply the food by the
- 9:38multiplier which is equal to zero then
- 9:40the food would also equal zero as well
- 9:43but considering how our rank system is
- 9:44set up even by default when the player
- 9:46first joins the game their multiplier
- 9:48will at least be one it will never be
- 9:50zero so if your system is different than
- 9:52ours and you might run into this
- 9:54complication of multiplying by zero what
- 9:56I would recommend doing is instead of
- 9:57returning total you would say if total
- 10:00is greater than zero then return total
- 10:03otherwise return one so at least then
- 10:05you're always returning something
- 10:06greater than one but of course I'm going
- 10:07to revert that change and we're going to
- 10:09go back to just returning total because
- 10:10of how our system works now considering
- 10:12we don't have any of the other systems
- 10:14implemented into our game which affect
- 10:16the food stat such as pets the store or
- 10:18boosters we obviously can't add any of
- 10:20those systems to incorporate for this
- 10:22but let me show you a small example of
- 10:24how we would also add those values into
- 10:26this as well so let's say for example
- 10:27pets we would create a variable called
- 10:29pet and we would probably set the value
- 10:30of that to a module script named pets
- 10:33and that module script will have a
- 10:34function called get stat and then we
- 10:36would probably pass through the stat
- 10:38that we want to get so food and then
- 10:40that would return a number of the food
- 10:42stat that all the pets have combined we
- 10:44would add the pet system to the total
- 10:46just like how we add the item system to
- 10:47the total as well and that's how we
- 10:49would calculate the stat but of course
- 10:50since we don't have the pet stat yet we
- 10:52obviously can't do that this is just an
- 10:54example of how that would work and then
- 10:55of course inside of the food multiplier
- 10:57if we wanted to add boost to this we
- 10:58would just say boosts equals and then
- 11:01there would probably be a module script
- 11:02for handling the Boost system get stat
- 11:04and then we provide it the food stat and
- 11:07then we of course we would add the Boost
- 11:08to the total as well similarly to how we
- 11:10did pets down below so those are just
- 11:12examples of how you would incorporate
- 11:13more systems into modifying the stats
- 11:15value and of course we'll be adding
- 11:17those later in the series Once We
- 11:18actually create those systems as well
- 11:19now that we have the food multiplier and
- 11:21the food stat calculation done we can
- 11:23move on to another stat so let's create
- 11:25a new function called stats. Max food
- 11:28and of course it's going to return the
- 11:29Max food stat so what is the max food
- 11:31stat affected by well once again it is
- 11:33affected by the item that a player
- 11:34currently has equipped and that would be
- 11:36the DNA so instead of looking at the
- 11:38tool we're going to look at the equi DNA
- 11:40and we're going to pass through DNA as
- 11:41the type as well and that'll get us the
- 11:43player's Max food stat now Max food is
- 11:45also affected by an item that the player
- 11:47can purchase from the store for Roo if
- 11:49the player purchases the item from the
- 11:51store for Roo they actually get
- 11:53unlimited Max food so we'll of course
- 11:55incorporate that system into this later
- 11:57when we do make the store system now I'm
- 11:58going to go ahead copy and paste this
- 12:00again and now we'll create the coin stat
- 12:02now the coin stat is affected by the
- 12:04pets the player has equipped an item
- 12:05they can purchase from the store and the
- 12:07Boost system now we can remove the item
- 12:09variable from here and also delete the
- 12:11equation right there and now since we
- 12:12don't have any of the systems which by
- 12:14default will give the player one coin
- 12:16stat we want to set the total by default
- 12:18to one and now usually when we use the
- 12:20coin stat we are going to be multiplying
- 12:21a specific number by the coin stat and
- 12:24of course if we multiply that number by
- 12:26zero then that's going to give the
- 12:27player zero coins and we don't want that
- 12:29to happen additionally we can make
- 12:31another stat let's go ahead and copy and
- 12:33paste the coin stat and we're going to
- 12:34name that coin multiplier and the total
- 12:36is going to be set to zero and then we
- 12:38are going to want to get the rank so we
- 12:40can copy the rank from the food
- 12:41multiplier and put the rank directly
- 12:43into the coin multiplier we can add the
- 12:45rank to the total and there we go we now
- 12:47have the coin multiplier now if you're
- 12:48confused as to why I'm using the rank in
- 12:50the coin multiplier when I didn't
- 12:52mention it before I just went back and
- 12:53tested on eating simulator and it seemed
- 12:55like they have a very odd equation which
- 12:57doesn't exactly make sense I couldn't
- 12:59find a definitive answer about it but it
- 13:01seems like their coing multiplier is
- 13:03affected by the player's rank of course
- 13:05this series is to teach you guys how to
- 13:06make your own simulator so it's not like
- 13:08you'll have to worry about silly things
- 13:09that eating simulator does but I'm just
- 13:11trying to clarify why I'm now adding
- 13:12rank to this when I previously didn't
- 13:14mention it so since the coin multiplier
- 13:16is affected by the rank we now have the
- 13:17coin multiplier stat and the coin stat
- 13:19by default is just one and that's all
- 13:21good to go and now the last stat that
- 13:23we're going to add which we have
- 13:24currently is going to be called the
- 13:25general stat and of course that's going
- 13:27to accept the player now we might name
- 13:29this to something better in the future
- 13:30but General is the only decent name that
- 13:32I could think of so far the stat that
- 13:34I'm referring to with General is the
- 13:36stat which is affected by the rank
- 13:37system I guess realistically instead of
- 13:39calling that the general stat we could
- 13:40even just call it the rank stat that
- 13:42might be a little bit better and this
- 13:43stat is relatively simple we just have
- 13:45to return the Direct Value that we're
- 13:46getting from the get item function when
- 13:48we pass through the rank information so
- 13:50what this stat is going to affect is
- 13:52things like the player Health the player
- 13:54speed the player's damage the food
- 13:55multiplier the coin multiplier which
- 13:57instead of doing the get item stat we
- 14:00could actually now just call the stat
- 14:02rank player and that will also get us
- 14:03the same value and I guess that would be
- 14:05good so we're not repeating code on
- 14:07necessarily so with all that being said
- 14:08we're pretty much finished all the stats
- 14:10module at least for now until we add
- 14:11more of the other systems like the pet
- 14:13system the Roo storage system and other
- 14:15things like that so we can now move on
- 14:16to creating the reward module so before
- 14:18we create the reward module let's think
- 14:20of a few common rewards given in our
- 14:22simulator and what systems give them so
- 14:24for instance we have food as a reward
- 14:25and the system that gives this reward is
- 14:27by clicking it's the main system that we
- 14:28have in our game we then have the coins
- 14:30currency which is given from selling
- 14:31food daily logins and also the Robux
- 14:34store and then another reward that we
- 14:35have are pets and these can be obtain
- 14:37from hatching eggs trading with other
- 14:38players and then also the Roo store as
- 14:41well now you might also be thinking that
- 14:42we do have a shop GUI and those items
- 14:44from the shop GUI such as the food DNA
- 14:47and ranks would also be rewards that
- 14:49could fall into this system which is
- 14:50true but considering the items purchased
- 14:52from our shop are only obtained from the
- 14:54shop system besides one DNA item which
- 14:56is the infinite food and that's
- 14:58purchased for Rob bu it might actually
- 15:00be unnecessary to move all of that
- 15:01functionality into this specific module
- 15:04because the main point of a module is
- 15:05for reusability the advantage though of
- 15:08including the shop items in the reward
- 15:09module is that we're keeping all reward
- 15:11systems in one specific script for now
- 15:13though I'm going to choose to not
- 15:15include the shop items in a reward
- 15:16module but this could change in the
- 15:18future anyways with all that being said
- 15:19let's go ahead and actually create our
- 15:21food reward method inside of the rewards
- 15:23module let's go ahead and create a new
- 15:24function called rewards. food and now
- 15:27let's think food is rewarded each time a
- 15:29player clicks while holding a food item
- 15:31based off this our method should accept
- 15:32the player and the amount of food that
- 15:34we want to give to the player so our
- 15:35first argument is of course going to be
- 15:37the player which is a player and the
- 15:38second argument is going to be the
- 15:40amount of food that we want to give to
- 15:41the player and that's going to be a
- 15:43number now we usually have to really
- 15:44plan out how we're actually going to
- 15:46give the player food directly but we've
- 15:48already done this inside of our tool
- 15:50manager which is inside of the server
- 15:52script service so right here inside of
- 15:53the function which is connected to the
- 15:54tool activated event we adjust the
- 15:56player's food value right here so player
- 15:58leader stat food. value and then we set
- 16:00that to itself plus the tool stat and
- 16:03this actually doesn't take an account
- 16:04for the multiplier which we just
- 16:05calculated inside of our stats but
- 16:07really the important information that we
- 16:08want is directly from right here so
- 16:10we're going to go ahead and copy this
- 16:11player. leer stats. food. value and
- 16:13we'll go ahead and paste it inside of
- 16:15our food method and then we want to set
- 16:17that to plus equals amount so we add the
- 16:19amount to the current food value now we
- 16:21could just simply call this method right
- 16:23now and it would work if for instance we
- 16:25called this method from the tool manager
- 16:26rather than giving the player the food
- 16:28this way it would actually reward the
- 16:30player food but we're also completely
- 16:32forgetting about the multiplier stat and
- 16:33remember inside of our stats module we
- 16:35already created the food multiplier
- 16:37method which will calculate the
- 16:38multiplier for us and we want to add
- 16:40that multiplier inside of this method
- 16:42right here so let's go ahead and
- 16:43initialize the stats module inside of
- 16:45here so we want to get the server script
- 16:47service and then of course we want to
- 16:49get the stats module which is inside of
- 16:51the serers script service. utils do
- 16:54stats and there we go so let's go ahead
- 16:55and create a variable inside of here
- 16:57called multiplier and then we're going
- 16:59to set that to stats. food multiplier
- 17:02and we'll pass through the player and
- 17:03now we can get the food multiplier and
- 17:05of course we want to use this multiplier
- 17:07rather than just adding the amount we
- 17:08want to multiply the amount by the
- 17:10multiplier and then add that to the
- 17:12player's current food so now this is a
- 17:13pretty perfect method but let's expand
- 17:15on it a little bit what if we didn't
- 17:16want to use the multiplier for example
- 17:18let's say that we have a daily reward
- 17:20which will give the player food but we
- 17:22want to only give them that specific
- 17:23amount of food and not have the amount
- 17:25affected by the multiplier so what we're
- 17:27going to do is we're going to actually
- 17:28accept another argument in this method
- 17:30that's going to be called Ed multiplier
- 17:32and it's actually going to be a bullying
- 17:33by default we're going to set the Ed
- 17:35multiplier to true so we're going to say
- 17:36use multiplier equals if use multiplier
- 17:39does not equal nil then use multiplier
- 17:42otherwise it's going to be set to True
- 17:44by default and now when we're setting
- 17:46the multiplier what we want to do is if
- 17:48used multiplier is true then we want to
- 17:50set that to the food multiplier
- 17:51otherwise we want to set it to one so it
- 17:53doesn't actually affect the amount and
- 17:55of course the way that we can do this is
- 17:56by saying if use multiplier equals true
- 17:59then stats. food multiplier else one so
- 18:02now if we do want to use the multiplier
- 18:04then we will use the multiplier
- 18:05otherwise the multiplier will be set to
- 18:06one and of course any amount Time 1 will
- 18:09equal one of course besides zero but
- 18:10that's besides the point let's now test
- 18:12this method out let's add a print
- 18:13statement inside of here and just to
- 18:15make sure that everything's working
- 18:16correctly we're going to accept the
- 18:17amount the multiplier and the amount
- 18:20times multiplier so that we can see the
- 18:22direct amount the direct multiplier and
- 18:23then the amount times multiplier which
- 18:25is going to the player and now we want
- 18:26to call this method inside of the tool
- 18:29manager which is already handling when
- 18:30the player clicks and then to reward the
- 18:32player some money now if we look inside
- 18:34of how we're currently rewarding the
- 18:35player money we're actually doing a lot
- 18:37of work that we've already covered
- 18:39inside of the stats module so what this
- 18:40means is we could actually literally
- 18:42delete all of this and now instead of
- 18:44using all of that what we can do is well
- 18:46first we want to add the rewards module
- 18:48into the script so let's go ahead and
- 18:50get the rewards module there we go and
- 18:52now what we're going to say is rewards.
- 18:54food pass through the player and then
- 18:56for the amount we're going to say stats
- 18:58do food and of course pass through the
- 19:00plier and now we could pass through true
- 19:02although we don't have to because
- 19:03remember by default use multiplier is
- 19:05true so realistically all we have to do
- 19:07is call this method pass through the
- 19:08player and then pass through the amount
- 19:10of food that we want to give to that
- 19:11player and to get the food amount we
- 19:13just have to call the stats method right
- 19:14here and now we're all good to go so
- 19:16let's go ahead and save that and start
- 19:17up our game and see if that works
- 19:18correctly so hold out our tool go ahead
- 19:20and click and we can see in the consoles
- 19:22printed out three which is the
- 19:23multiplier and nine which is the total
- 19:25amount given to the player and if we
- 19:26look at our food we can see I currently
- 19:28have 4, ,31 food and then if we click we
- 19:31now have
- 19:324,140 so just checking everything's
- 19:34working correctly and it does let's also
- 19:36go inside of our shop rather than having
- 19:38french fry 3 equipped let's equip number
- 19:39one now let's go ahead and click while
- 19:41holding french fry 1 and we can see the
- 19:43amount given is one the multiplier is
- 19:45three so the amount times multiplier is
- 19:47also three as well and that means we're
- 19:48getting three coins and the reason our
- 19:50multiplier is three is because we have
- 19:52the third rank equipped right now if we
- 19:54wanted to we could equip the first Rank
- 19:55and now we should see 11 one and that's
- 19:57exactly what we see so so this is all
- 19:59working perfectly stats are being
- 20:00calculated exactly how they should be
- 20:02and the food is given to the player with
- 20:04the exact total that it should be as
- 20:05well so going back inside of a rewards
- 20:07module we can go ahead and delete this
- 20:09print statement and this method is
- 20:10pretty perfect in the future we might
- 20:12expand on it and we could even create a
- 20:13new remote event which we use to notify
- 20:16the player every single time that
- 20:17they've been given food and then we can
- 20:19make a screen GUI pop up which will be
- 20:21used as a notification to display to the
- 20:23player that they have earned food but
- 20:24for right now this is perfectly fine and
- 20:26this could be easily expanded in the
- 20:28future we now want to do is we're going
- 20:29to go ahead and copy this and now create
- 20:31a method for rewarding coins to the
- 20:33player so we're going to go ahead copy
- 20:34that paste it and rename this method
- 20:36from food to coins although currently we
- 20:38actually don't have a system set up for
- 20:40selling food to earn coins although that
- 20:42will come in future episodes
- 20:44realistically the only changes that we
- 20:45need to make to this method currently is
- 20:47change the multiplier or where the
- 20:49multiplier comes from so rather than the
- 20:50food multiplier we're of course going to
- 20:51use the coin multiplier and then change
- 20:53the directory where the rewards go
- 20:54through so rather than Food they'll be
- 20:56going to coins and now similar to
- 20:58calling the food method we could also
- 20:59call the coins method anywhere we want
- 21:00to reward the player coins rename this
- 21:02two coins and of course just pass
- 21:04through the player and then rather than
- 21:05passing through the food stat we would
- 21:07pass through the coin stat and now we
- 21:08would be rewarding the player the
- 21:10specific amount of coins that they
- 21:11should be receiving although of course
- 21:12since the player shouldn't earn coins
- 21:14along with earning food I'm going to
- 21:15remove this I was just showing you guys
- 21:17how you could call that method now
- 21:18originally when we first discussed the
- 21:19rewards module I did mention that pets
- 21:22are a system that could fall into this
- 21:23module the thing is though is that it's
- 21:25really hard for me to even show you guys
- 21:26an example of what the pet method look
- 21:28like just because it's drastically
- 21:30different from food and coins which is a
- 21:32currency without the pet system actually
- 21:34being set up right now it would be
- 21:35really hard for me to make a
- 21:37demonstration understandable for you
- 21:38guys as to why we need the specific
- 21:40things that we need so that's why I'm
- 21:41not going to even try to get into
- 21:43showing you guys what the pet reward
- 21:45method would look like we'll do that in
- 21:46the future when we create the actual pet
- 21:48system but with that being said ladies
- 21:49and gentlemen that's going to be it for
- 21:50this episode hopefully you guys did
- 21:51enjoy as always if you guys did make
- 21:53sure you smash the like button also hit
- 21:54the Subscribe button and turn those post
- 21:55notifications on if you want to get
- 21:57notified when I upload more Roblox
- 21:58development content additionally I do
- 22:00have a patreon if you guys like to
- 22:01support me and gain access to all the
- 22:02scripts and the game file that I made
- 22:03during this episode there's a link Down
- 22:05Below in the description you guys go
- 22:06check it out with that being said I hope
- 22:07that you guys have a great day and I'll
- 22:08see you guys in the next episode
About this transcript
This page contains the full transcript of Creating the Stats & Rewards Modules! Roblox Studio Simulator Guide Episode 12 by MonzterDEV, generated from the public captions YouTube serves with the video. The transcript has 5,637 words across 764 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.