Creating Daily Rewards! Roblox Studio Simulator Guide Episode 17 — Transcript
Full transcript
- 0:00what's going on ladies and gentlemen
- 0:00hopefully having a great day welcome
- 0:02back to the simulator series in today's
- 0:03episode we are going to be going over
- 0:05how to create a daily reward system in
- 0:07your simulator as always if this video
- 0:09does help you guys out or you do enjoy
- 0:10make sure you smash the like button also
- 0:12hit the subscribe button and turn this
- 0:13post notifications on if you want to get
- 0:14notified when i upload more roblox
- 0:16development content additionally i do a
- 0:17patreon if you guys like to support me
- 0:19and getting access to all the scripts
- 0:20and the game file that make during this
- 0:22episode there's a link down below in the
- 0:23description and you guys can go check
- 0:24that out with that being said let's get
- 0:26into it now to quickly showcase the
- 0:27feature that we're going to be creating
- 0:28today we can see loading into our game
- 0:30we have a part right here which says
- 0:31daily reward and since we already
- 0:33claimed the reward we can see that if we
- 0:34step on the part we get a notification
- 0:36that says you cannot claim this chest
- 0:38right now and then also if we look at
- 0:39the part itself it says daily reward and
- 0:41has the time displayed underneath it for
- 0:42when we're able to actually claim it
- 0:44once again and the time is constantly
- 0:46updating as well now if we haven't
- 0:47already claimed the reward we can see
- 0:48there is no time being displayed under
- 0:50here and we can go ahead and step on the
- 0:51part and now we can see a little
- 0:53notification pops up that says chest
- 0:54open come back tomorrow for more awesome
- 0:56rewards we received 200 coins and we can
- 0:59now see that the cooldown is displayed
- 1:00underneath of the daily reward text as
- 1:02well so to get right into the tutorial
- 1:03the first thing that we want to do is we
- 1:05actually want to create the daily reward
- 1:07part now as you saw when i previewed
- 1:08this feature i had a little chest with
- 1:10some coins and a little circle similar
- 1:12to our cell circle with some text
- 1:13displayed as well and that's what we're
- 1:14going to be using as our part as well
- 1:16because that looks pretty similar to the
- 1:17one in eating simulator now the way that
- 1:19i got that was pretty simple if you go
- 1:20to the toolbox and in the models you
- 1:22search for daily you should be able to
- 1:23find one pretty easily i think the one
- 1:25that i got specifically was from blue
- 1:27boo right here and all we're going to do
- 1:28is we're going to click that add it to
- 1:30our game and there we go we have the
- 1:31text we have the model and it all looks
- 1:33pretty good let's go ahead and flip this
- 1:35a little bit move it around and now of
- 1:36course you guys could make your own but
- 1:38i'm just going to take one from the
- 1:39toolbox as this is just for a learning
- 1:41process inside of the model what i'm
- 1:42gonna do is i'm gonna delete all of the
- 1:44stuff that we don't actually need all we
- 1:46want are the actual parts and that's it
- 1:48so then what we're gonna do is we're
- 1:50gonna drag all these parts and put that
- 1:52directly into there delete the parts
- 1:54model and now we have all of our parts
- 1:55inside of here what we then want to do
- 1:56is we want to make sure that everything
- 1:58is anchored which they all are currently
- 2:00and now we could organize this a little
- 2:02bit more if we wanted to like most of
- 2:03these parts seem to be coins and stuff
- 2:05like that so we could put them into
- 2:06their own folder or into their own model
- 2:08or we could really just highlight all of
- 2:10them right click click group and we
- 2:12could rename them to coins if we wanted
- 2:14to you don't need to do this and i'm not
- 2:15really going to do this i just wanted to
- 2:16show an example the next thing that i'm
- 2:18going to do is i'm going to delete this
- 2:20one cell part because we don't actually
- 2:22need that and we also have another part
- 2:23named cell right here and this is
- 2:24actually the yellow circle and what i'm
- 2:26going to do is because it looks like
- 2:27it's actually above the ground right
- 2:29here all i'm going to do is i'm simply
- 2:30going to move this down a little bit and
- 2:32there we go it now is touching the
- 2:34ground and it all looks pretty good the
- 2:35last thing that i want to do is make a
- 2:36specific part for being touched so when
- 2:39the player walks over this it's kind of
- 2:40like giving this model a hitbox so when
- 2:42the player walks into a certain area
- 2:44that'll trigger the daily reward to be
- 2:45given to the player we already pretty
- 2:46much did this with our cell part and
- 2:48kind of with the shot part as well what
- 2:49i'm going to do is i'm just going to
- 2:51duplicate the cell part that we already
- 2:52have right here because it's the same
- 2:54width and length as the model already
- 2:56all we're going to do is we're going to
- 2:57increase its height then we want to make
- 2:58sure that we delete this decal right
- 3:01here we want to make sure that it is not
- 3:03collidable so that players can walk
- 3:05through it and we're also going to
- 3:06rename this to touch and then it should
- 3:09be anchored already but let's just make
- 3:10sure and yes it's already anchored so
- 3:12that should all be good the last thing
- 3:13that we need to do is i guess i deleted
- 3:15whatever part had the billboard gy on it
- 3:18so what we're gonna do is we're actually
- 3:19gonna go to this part right here which
- 3:21is our cell part and we're actually just
- 3:23gonna take this billboard gy and move
- 3:25that over to our daily reward so we can
- 3:27put it right in there and we can see how
- 3:28this looks so that looks centered it
- 3:30looks nice it looks actually pretty good
- 3:32we then want to open up the billboard
- 3:34gui and change the text label to daily
- 3:38chest and see how that looks so we want
- 3:40to make the size of the billboard gy a
- 3:41little bit bigger so the width is
- 3:43probably going to be like five and the
- 3:45height could probably be like five as
- 3:47well and then we're going to set this to
- 3:50title because remember we're gonna have
- 3:51two text labels inside of here so the
- 3:53size of this instead of making it the
- 3:55full height we can make this like .5
- 3:57probably so that looks decent we should
- 3:59probably make this a little bit wider
- 4:01though so once again the size we're
- 4:03going to change the size to 10. and
- 4:05there we go now the words daily chest
- 4:07all fit on one line what we're then
- 4:09going to do is we're going to duplicate
- 4:10this by hitting ctrl d and selecting it
- 4:12and then we're going to rename this to
- 4:14time we're going to set the position
- 4:15first the anchor point 2.5 for the y and
- 4:18the position to 0.5 as well for the y
- 4:21and that looks pretty good but we might
- 4:22want to move it down a little bit more
- 4:24anyway we're going to set the text to 23
- 4:26h 59 m 59 s so that's and that's going
- 4:30to represent what the time should look
- 4:32like and then the color we want the text
- 4:33color to be white and that all looks
- 4:35pretty good let's check on mobile and
- 4:37yeah we can see we do want to move that
- 4:38text label down a little bit so let's go
- 4:40ahead and try to position it further
- 4:42down slightly so like five two five five
- 4:45two five and that looks decent maybe we
- 4:48wanna move it down a little bit more i
- 4:49don't know that looks kind of good
- 4:50honestly but we could move it down a
- 4:52little bit more if we wanted to so we
- 4:53moved it down to point 55 and it looks
- 4:55decent now it looks pretty good but you
- 4:57guys might want to play around with this
- 4:58a little bit more if you find any issues
- 5:00with it so now apart from that we should
- 5:01be good with the model what we then want
- 5:03to do is we want to move this model into
- 5:06the scriptable objects folder that we
- 5:07already have inside of our workspace and
- 5:09then we want to go into the server
- 5:10script service into the scriptable
- 5:12object script and now we'll add in the
- 5:14daily reward to this script so let's
- 5:16rename this to daily reward with no
- 5:18space between the words and then we can
- 5:20pretty much just copy the cell.touch
- 5:22that we already have right there and
- 5:23then we are going to say scriptable
- 5:25objects folder dot daily reward dot and
- 5:28remember we made a specific part called
- 5:30touch because we want to listen to when
- 5:31that gets touched so inside of the daily
- 5:33reward we want to look for the part
- 5:34called touch and then we want to listen
- 5:36for whenever that part is touched and
- 5:38then we can delete this stuff inside of
- 5:40the player if statement what we then
- 5:41want to do is we just want to print out
- 5:43true to see if this actually works when
- 5:45we touch this part now it should print
- 5:47out true so let's go ahead walk over to
- 5:49here and we can see true is now printed
- 5:51every single time that we are touching
- 5:52that part so that works all good now the
- 5:54next thing that we need to do is inside
- 5:56of the player data we actually want to
- 5:58add the daily reward to the player's
- 6:00data the reason that we want to add this
- 6:01to the player's data is because we need
- 6:03a cooldown of some sorts to track when
- 6:04the player is able to receive the reward
- 6:06once again so inside of the setup player
- 6:09function we're gonna scroll down right
- 6:10after we're looping through the dna
- 6:12config and we're gonna basically copy
- 6:14what we have right here just to make it
- 6:15simple instead of calling this equip dna
- 6:17we're gonna call this daily reward and
- 6:19then let's go ahead and copy that and
- 6:20paste that so we know that we're
- 6:21changing the daily reward name and the
- 6:23value and the name of this is actually
- 6:25going to be daily reward make sure you
- 6:27remember the capitalization so capital d
- 6:29and capital r or however you want to do
- 6:31it just make sure that you remember how
- 6:32this is spelled and then instead of a
- 6:34string value it's actually going to be a
- 6:36number value and the parent of this
- 6:38instead of the inventory folder is
- 6:40actually going to be the player so we
- 6:41have the daily reward we're creating a
- 6:43new number value we're parenting that to
- 6:45the player we're setting the name of it
- 6:47to daily reward and the number that we
- 6:49actually want to set is zero because
- 6:51we're counting this as the first time
- 6:52the player actually gets this value and
- 6:54this means that the player has not
- 6:56received the reward yet now inside of
- 6:57here where we grab the saved data and
- 6:59give it to the player what we're gonna
- 7:00do is we're going to say player dot
- 7:02daily reward dot value equals and then
- 7:05if return value so if we have saved data
- 7:08which contains daily reward and that
- 7:10does not equal nil then we're going to
- 7:12set the value of that to whatever that
- 7:14value is otherwise we're just going to
- 7:16set it to zero so if the player does
- 7:18have a cooldown already we're going to
- 7:19give the player the cooldown otherwise
- 7:20we're just going to set it to zero and
- 7:22that's how we'll know that we should
- 7:23give the player the reward for the first
- 7:24time then we want to make sure that
- 7:25we're saving that data so right here we
- 7:27can see this is where we save the data
- 7:29what we're gonna do is we're gonna say
- 7:30local daily reward equals player dot
- 7:34daily reward dot value and then what
- 7:37we're gonna do is we're gonna add a
- 7:39comma here and save that as daily reward
- 7:42with a capital d and a capital r and
- 7:44we're gonna set that to the value of
- 7:46daily reward which is the variable that
- 7:47we just created right here so that might
- 7:49be a little bit confusing but don't
- 7:50worry as we go through and actually
- 7:51start scripting out and using this data
- 7:53you'll probably understand why we're
- 7:55doing exactly what we're doing back
- 7:56inside of the scriptable objects what we
- 7:58now want to do is handle giving the
- 7:59player the reward and setting their
- 8:01cooldown so we're gonna do is inside of
- 8:03this if statement we're gonna check if
- 8:05the player.dailyreward.value
- 8:08equals zero because if it equals zero
- 8:10then we want to give the player the
- 8:12reward so we're gonna say then and now
- 8:14realistically you have to decide on how
- 8:15you want to reward the player for their
- 8:17daily reward in this scenario what i'm
- 8:19gonna do is i'm gonna use our rewards
- 8:20module and we're just gonna give them
- 8:22coins and we're gonna pass through the
- 8:24player and the amount of coins that we
- 8:25want to pass through we're just gonna
- 8:27say 1 000 for every time the player gets
- 8:29the daily reward like i said you can
- 8:31make your own system for deciding how
- 8:32many coins you want to give the player
- 8:34and we will use the multiplier as well
- 8:36so there we go that will now reward the
- 8:37player when they claim their daily
- 8:38reward the next thing that we need to do
- 8:40is we need to add a cooldown to this now
- 8:42the way that we're going to add the
- 8:43cooldown to this is by actually using
- 8:44the daily reward value so we're going to
- 8:46actually set this value to os dot time
- 8:49now you might not be familiar with
- 8:51os.time what this does is well we can
- 8:53read the description it returns how many
- 8:54seconds have passed since the unix epoch
- 8:57january 1st 1970 at zero zero zero zero
- 9:00zero zero under current utc time now
- 9:02that probably made no sense to you but
- 9:04don't worry i'll explain it on screen
- 9:06right now we're on a website called unix
- 9:08timestamp this right here is what
- 9:10os.time would return because this is the
- 9:12current amount of seconds which have
- 9:14passed since january 1st 1970. so every
- 9:17single second that passed through adds
- 9:19to this number right here and this is
- 9:21the amount of seconds that have passed
- 9:22since this date and time so what we're
- 9:24going to do is we're going to take the
- 9:25player's current time and that's going
- 9:27to give us this number then we want to
- 9:28add the amount of seconds that are in a
- 9:30day to that number and that will
- 9:32basically give us a 24 hour or a one day
- 9:35cooldown for when the player is able to
- 9:36receive their daily rewards and by
- 9:38looking at this website we can easily
- 9:40see how many seconds are in a day and
- 9:42that's eighty six thousand four hundred
- 9:43so we wanna add eighty six thousand four
- 9:45hundred seconds onto the player's
- 9:47current time and that's we're gonna set
- 9:49the daily reward value to so that we
- 9:51know that that's how long the player
- 9:52needs to wait before they're eligible
- 9:54for the daily reward once again so back
- 9:56inside of the studio we have the os dot
- 9:58time and now we are going to add on the
- 10:0086
- 10:01400 seconds to this specific time now
- 10:04remember this is 24 hours so we're
- 10:06basically adding 24 hours to the current
- 10:08time and we're setting the player's
- 10:10daily reward to this so we're setting it
- 10:12to 24 hours in the future so now if the
- 10:14player steps on this part once again
- 10:16obviously this will not run again
- 10:17because the daily reward no longer
- 10:19equals zero but we need to make another
- 10:21check for this because it should only
- 10:23ever equal zero if it's the first time
- 10:25the player has joined the game so we're
- 10:26gonna say or and we're once again gonna
- 10:28check the player's daily reward value
- 10:30but we're gonna say if the current os
- 10:32dot time so the current time is greater
- 10:34than or equal to and now we want to use
- 10:36the player's daily reward value and we
- 10:38want to add on 86 400 seconds once again
- 10:42hey so monster from the future here
- 10:43while i was editing the episode i
- 10:45realized i made a slight mistake and
- 10:46rather than re-recording the entire
- 10:48episode i felt that i could just make
- 10:49this little fix real quick and tell you
- 10:51guys the mistake and the solution to fix
- 10:52it i say that the comparison should be
- 10:54the current time is either greater than
- 10:56or equal to the player's cooldown plus a
- 10:59hour cooldown this is actually incorrect
- 11:01we don't need to add a 24 hour cooldown
- 11:03to the player's already existing
- 11:05cooldown because that wouldn't make
- 11:06sense when we set the daily reward value
- 11:08right here we're adding the current time
- 11:10plus 24 hours ahead so that's why alls
- 11:13we need to do is we just need to compare
- 11:15the current time to the player's 24 hour
- 11:18cooldown and that's the proper check if
- 11:20we add another 24 hours to the player's
- 11:22cooldown then that would actually be a
- 11:2348 hour cooldown which is probably not
- 11:26what you want now for the rest of the
- 11:27video you're going to be seeing the
- 11:29previous check which would be adding the
- 11:3024 hour cooldown to this because i
- 11:33didn't realize this until i went through
- 11:34the editing process so hopefully it
- 11:36doesn't confuse you too much the correct
- 11:38check that you should be doing is just
- 11:39comparing the current time is greater
- 11:41than or equal to and then the player
- 11:43daily reward value not adding an
- 11:45additional 86 400 seconds to it my
- 11:48apologies for making a mistake luckily i
- 11:49did just realize it so that i can fix it
- 11:51for you guys anyway enjoy the rest of
- 11:53the episode so what this is saying is if
- 11:55the current time is greater than the
- 11:57player's cooldown plus 86 400 then we
- 12:00want to run this so basically if the
- 12:02player is off cooldown then we want to
- 12:04run this give them the cooldown and then
- 12:06they won't be able to claim the reward
- 12:07again for another 24 hours and there we
- 12:09go now that i'm thinking about this we
- 12:11actually don't need the
- 12:12player.dailyreport.value equals to zero
- 12:15because zero plus
- 12:1786400 is always going to be less than
- 12:19the current time anyways so that check
- 12:21wasn't necessary anyway let's go ahead
- 12:24and make sure that we put this print
- 12:25statement inside of here so that we can
- 12:27verify that this works and then we'll
- 12:29actually make an else statement inside
- 12:31of here and then we will put a print
- 12:33false statement inside of here so that
- 12:34we can tell if the player gets the
- 12:36reward or if they're not able to get the
- 12:37reward and now let's start this up and
- 12:39test it out so let's go ahead walk over
- 12:41touch it and we can see true is printed
- 12:42out and now false is continuously
- 12:44printed out because we're no longer able
- 12:46to get the reward so that worked
- 12:47perfectly so now that we know that we're
- 12:49giving the player the reward what we
- 12:50then want to do is we want to actually
- 12:52make a gui and notify the player that
- 12:54they are receiving the reward so what
- 12:56we're gonna do is we're gonna go inside
- 12:57of the starter gui we're then gonna
- 12:59clone the max food gui and we can rename
- 13:02this to daily reward and let's go ahead
- 13:04and enable it so we can see this and the
- 13:06reason that we're duplicating max food
- 13:07is because this frame already looks like
- 13:09the frame that eating simulator uses for
- 13:11the daily reward anyway so rather than
- 13:13recreating this entire thing it's much
- 13:15easier to just start with this base
- 13:16plate right here so we're going to
- 13:17delete the extra frame and we now just
- 13:19have the notification frame let's open
- 13:21up the notification frame and we're
- 13:22going to remove the cell and shot button
- 13:26and now we have the message the title
- 13:27and the exit button so for the title
- 13:29we're actually going to change the text
- 13:30from mac's food to chess opened and then
- 13:33for the message we are going to change
- 13:35that from sell your food or upgrade your
- 13:38dna to come back tomorrow for more
- 13:41awesome rewards there we go we've got
- 13:45that now we probably want to resize this
- 13:47a little bit so we'll stretch this out a
- 13:49little bit just like that let's make
- 13:52sure that this is centered so there we
- 13:55go now let's duplicate the message text
- 13:56label and bring that down a little bit
- 13:58and this is going to display the reward
- 14:00that we get so we'll rename this to
- 14:02reward and we'll set the text to our
- 14:04money symbol and
- 14:061
- 14:07000 so there we go that will display the
- 14:10reward that we receive and we could make
- 14:11this smaller if you feel like it should
- 14:13be smaller i think that's probably
- 14:16pretty good now let's adjust the
- 14:17position to make sure once again that it
- 14:19is centered and there we go that looks
- 14:21pretty perfect actually the title is
- 14:23bothering me a little bit i think i want
- 14:24to move it down slightly so something
- 14:28like that okay i think that's pretty
- 14:29good now then what we want to do is we
- 14:31want to duplicate this title text label
- 14:33and move that just into the daily reward
- 14:36frame and this is going to be used for
- 14:37when the player is unable to claim the
- 14:38daily reward but they try to claim the
- 14:40daily reward so we're going to change
- 14:42the text from chest open to you cannot
- 14:45claim this chest right now and then the
- 14:49text color is going to be sort of a red
- 14:51with a stroke of black and now we're
- 14:54going to make this a little bit smaller
- 14:57probably something like that i guess
- 15:00let's just make sure that we position it
- 15:02in the center of the screen so there we
- 15:04go now it's centered in the screen and i
- 15:06think that looks pretty good let's also
- 15:08check the mobile view to make sure that
- 15:09everything looks good everything looks
- 15:10scaled no issues there alright perfect
- 15:13so now that we have all that what we're
- 15:14gonna do is we're gonna set the
- 15:15visibility of both of these to false so
- 15:18that we no longer see them we now need
- 15:19to come up with a way of the server
- 15:21telling the client that they just
- 15:23received the daily reward or they're
- 15:24unable to receive the daily rewards so
- 15:26that we can display those two new guis
- 15:28of course the way we're going to do this
- 15:30is go inside of the replicated storage
- 15:31inside the remotes folder and we're
- 15:33going to create a new remote event this
- 15:34remote event is going to be daily reward
- 15:37and we'll use that remote inside of our
- 15:40scriptable object script so we already
- 15:42have the remotes folder right here we're
- 15:43gonna say remotes dot daily reward fire
- 15:47client and we'll send that to the player
- 15:49and we'll pass through true as the
- 15:50second argument and that's basically
- 15:52saying that the player did receive the
- 15:53reward and if the player does not
- 15:55receive the reward or is unable to we're
- 15:57going to pass through false so now the
- 15:59server is telling the client if they did
- 16:00get the reward or if they're unable to
- 16:02get the reward we now need to set this
- 16:04up on the client side so we can actually
- 16:05do something with that information so
- 16:07inside the daily roar gy we have the
- 16:08manager script already made up because
- 16:10we duplicated this from the max food gui
- 16:12what we can do is we can pretty much
- 16:14just delete all of this for the most
- 16:16part and then we need to reset up
- 16:18certain variables instead of the max
- 16:20fuji we're going to say the daily reward
- 16:22gui is the script.parent and then we can
- 16:25just delete both of these as well and
- 16:26we're gonna say local notification
- 16:29frame equals daily reward gui dot
- 16:32notification and then inside of the
- 16:34frame the only thing that we need to get
- 16:36is the exit button and the reward
- 16:37because we're never going to change the
- 16:38message or the title so let's go ahead
- 16:41and get both of those we're just going
- 16:43to copy that variable and we're going to
- 16:44say exit button and that's going to be
- 16:46set to
- 16:47notification frame dot exit button and
- 16:50then the last thing that we need to get
- 16:52is the reward text so notification
- 16:54frame.reward and reward text
- 16:58reward you could say just reward or
- 17:00reward text or reward text label it
- 17:02doesn't really matter and we also want
- 17:03to get the title as well instead of
- 17:05saying title we could call this like
- 17:06warning or decline because remember this
- 17:09is the text that's displayed to the
- 17:10player when they're unable to accept the
- 17:12daily reward so i'm just going to call
- 17:13this warning just because it's simple
- 17:15enough to remember so we're going to say
- 17:17local warning equals daily reward gy dot
- 17:20warning and there we go we now have that
- 17:22text label so now that we have all of
- 17:23those components of the gui we now need
- 17:26to use the remotes and we already
- 17:28actually have the remotes folder here so
- 17:29we're going to say remote dot daily
- 17:32reward dot on client event and we're
- 17:34gonna connect that to a new function and
- 17:36we're actually gonna create a new
- 17:37function we're gonna say local function
- 17:39reward so then inside of here we're
- 17:41gonna pass through reward we're gonna
- 17:43say reward so that'll call the reward
- 17:45function and then of course with the
- 17:46reward function we need to accept a
- 17:48boolean argument so we're going to say
- 17:49reward and bullying because that's going
- 17:52to be either true or false now we can do
- 17:54is we can say if reward then so if the
- 17:57player is able to receive the reward
- 17:59what we want to do is we want to make
- 18:01the notification frame visible so we're
- 18:03going to set the visibility to true and
- 18:05actually i just forgot something instead
- 18:07of passing through true or false we're
- 18:08actually just going to send either the
- 18:10amount or just the player through and
- 18:12you might be confused by that but i'll
- 18:13show you how we can easily handle that
- 18:15in a second so back inside of the
- 18:16manager instead of the reward being a
- 18:18bullying it's actually going to be a
- 18:20number and it's going to be optional so
- 18:22what we're saying with if reward we're
- 18:24saying if the reward exists so if it is
- 18:26not nil then what we're going to do is
- 18:28we're going to make the frame visible
- 18:30and we actually want to set the reward
- 18:32text to the amount of the reward that we
- 18:34got so we're going to pass through the
- 18:37money bag icon because that's our
- 18:39currency oh and that oh that worked
- 18:42actually okay and then we want to
- 18:43combine that with the reward so there we
- 18:46go that should display the reward that
- 18:48we got and now we can also take a peek
- 18:50back at what our frame actually looks
- 18:52like so let's make this visible and yeah
- 18:54okay we see that the money icon with the
- 18:56money i don't know if there's a space
- 18:57between those two but you can choose if
- 18:58you want to put a space between those
- 19:00two or not doesn't really matter so once
- 19:02we get the reward it's going to make it
- 19:04visible so that we see that guy it's
- 19:06going to set the text to the reward that
- 19:07we actually got and then we want to do
- 19:09is we want to use
- 19:10task.delay and we want to set the amount
- 19:12of time that we want the gy to be
- 19:14visible for which is probably something
- 19:15like five seconds and then we're going
- 19:17to create an inline function and then
- 19:18what we're going to do is we're actually
- 19:20going to hide the notification frame so
- 19:22we're going to set the visibility of
- 19:23that to false now the reason that we're
- 19:25using task.delay is because this will
- 19:27run is because this will run this
- 19:28function on a separate thread and it
- 19:30won't actually pause this script at all
- 19:32at the same time this is kind of
- 19:33unnecessary because of how we have this
- 19:35function set up this is sort of just a
- 19:37habit that i got into and i'd say this
- 19:38is probably best practice or better than
- 19:40actually stalling this thread
- 19:41realistically it's a little bit
- 19:42complicated but i'll show you the
- 19:44equivalent to that which is a lot
- 19:46simpler we could do test.wait and then
- 19:47we could just do the
- 19:49notificationframe.visible equals false
- 19:50and now these two lines are equivalent
- 19:53to these lines right here but task that
- 19:55delay is a little bit different let's
- 19:56say that we're not using the task.wait
- 19:58and then we had print true right here
- 20:00what it will do instead of pausing this
- 20:02entire function right here when we call
- 20:04the task.delay this will basically spawn
- 20:06a new thread which is counting down five
- 20:08seconds but instantly after calling this
- 20:10it's going to instantly print true so
- 20:12it's not gonna wait the five seconds and
- 20:13then print true which would happen if we
- 20:15use task.wait five seconds it's going to
- 20:18instantly print instead of waiting
- 20:19because task.delay is spawning on a new
- 20:22threat anyway that's really complicated
- 20:23and hopefully i'm not confusing you by
- 20:25explaining all this but it is pretty
- 20:26nice to know anyway quick recap of
- 20:28what's gonna happen if we get the reward
- 20:29we're gonna set it to visible we're
- 20:30gonna set the notification for
- 20:31indivisible we're gonna change the text
- 20:33to the reward that the player received
- 20:34and then five seconds later we're gonna
- 20:36hide the frame now if the player is not
- 20:37getting the reward what we then want to
- 20:39do is we then want to display the
- 20:40warning text so we're gonna say warning
- 20:42dot visible equals true and now once
- 20:44again we can also do the task.delay and
- 20:46instead of the notification frame this
- 20:47time we can say warning dot visible
- 20:49equals false and that will make the text
- 20:51go away after five seconds or two
- 20:53seconds however long you want it to last
- 20:54now the final thing is the exit button i
- 20:56guess i kind of forgot about the exit
- 20:58button existing so realistically you
- 21:00don't need to set the visibility of this
- 21:02to false later you could just let the
- 21:04player click the exit button instead so
- 21:07we're gonna do is exit button dot mouse
- 21:08button one click connect function and
- 21:11then we are going to say notification
- 21:12frame dot visible equals false so now
- 21:15when the player clicks the x button on
- 21:17the reward frame it's just gonna make it
- 21:18not visible so that's why i removed the
- 21:20task.delay but we're still using the
- 21:22task.delay for the warning text because
- 21:24that obviously has no exit button okay
- 21:25so with all that being said that was a
- 21:27lot let's go ahead and test this out
- 21:29let's reset our i don't know if we need
- 21:31to reset our data because we might have
- 21:33already gotten the cooldown but let's go
- 21:34ahead and do that just in case and start
- 21:36up our game and see what happens so
- 21:38we're going to go over to here we're
- 21:39going to step on this we see that we did
- 21:41get the reward the notification popped
- 21:43up and the warning notification popped
- 21:44up as well we also did get the reward
- 21:46but if we step on this again we can see
- 21:48you cannot claim this chest right now
- 21:49and that's exactly what we want let's
- 21:51close that notification it closes and it
- 21:53doesn't open again we're not getting
- 21:54rewarded again so that works perfectly
- 21:56the next thing that we want to do is we
- 21:57want to make this cool down display
- 21:58properly so we're going to create a new
- 22:00function inside of here and that is
- 22:02going to be called display time and what
- 22:04we're going to do is we're going to get
- 22:06the player's daily reward so we're going
- 22:07to say localcooldown equals
- 22:11dot player.dailyreward.value and that's
- 22:12going to get the cooldown from the
- 22:13player and now let's think about when we
- 22:14want to call this function we actually
- 22:16want to listen to when the daily reward
- 22:18number value changes so we can get the
- 22:20daily reward object and then we can use
- 22:21the changed event onto there and we can
- 22:24connect that to a function and this
- 22:26function is going to pass through the
- 22:27value of what the new value is and we're
- 22:29going to connect that to display time so
- 22:31we don't actually really need the value
- 22:33per se and then also we want to call the
- 22:35display time function when the script
- 22:37starts up for the first time as well and
- 22:38that's why we're calling the function
- 22:39down here so now inside of the display
- 22:41time we're getting the player's cooldown
- 22:43we then want to also make a variable for
- 22:45the daily reward which is inside of the
- 22:47scriptable objects folder and we
- 22:49actually already have the cell part and
- 22:50the shot part which we don't need for
- 22:52this specific script so we're going to
- 22:53change this a little bit inside of the
- 22:54scriptable objects we want to get the
- 22:56daily rewards so there we go and we're
- 22:58just going to rename this to daily
- 22:59reward part and there we go we now have
- 23:02that part back inside of the display
- 23:03time function we're going to say if the
- 23:05cooldown is less than the current time
- 23:09of the player then we're basically just
- 23:10going to break the script currently and
- 23:12not do anything else for right now so
- 23:14now this might look really weird for you
- 23:16this is equivalent to writing it out
- 23:18just like this it's just formatted a
- 23:20little bit differently on one line
- 23:21instead of being spread out on three
- 23:23different lines so it's a little bit
- 23:24more compact and it looks a little bit
- 23:26nicer if we call this function and the
- 23:28cooldown is actually less than the
- 23:29current time then we don't want to do
- 23:31anything else in this function and
- 23:33you'll see why in a second so if that's
- 23:34not true then what we want to actually
- 23:36do is we want to get the daily reward
- 23:38and we want to get the billboard gui
- 23:40inside of it and we want to make the
- 23:41time visible so we're going to set the
- 23:43visibility of that to true and also
- 23:44right now we want to make sure that time
- 23:46is not visible because we don't want
- 23:48that to be visible by default so there
- 23:50we go we're going to make that visible
- 23:51if it should be visible and then we're
- 23:53going to create a while loop and we're
- 23:54going to say while the cooldown is
- 23:56greater than the player's time what
- 23:59we're going to do is we're going to set
- 24:00the time text so we're going to copy and
- 24:03paste that again and we're going to say
- 24:04text and we're going to set that text to
- 24:07the cooldown minus the current time and
- 24:10we want to wait one second every single
- 24:12time so let's go ahead and start our
- 24:14game and see how this looks in the game
- 24:15and now that actually looks decently
- 24:17good so what this is doing is it's
- 24:18displaying the cooldown and it's
- 24:19basically going down by one every single
- 24:22second we now want to convert this into
- 24:24an hour minute and second format rather
- 24:26than coming up with our own method of
- 24:27converting all those seconds into an
- 24:29hour minute and second format i'm just
- 24:31gonna search it up on google and we're
- 24:33gonna find the solution super easily so
- 24:35i literally googled convert seconds
- 24:37roblox dev and that's basically gonna
- 24:38come up with results from the dev forum
- 24:40and we can see this result right here
- 24:41converting seconds to h min and second
- 24:44and that's the exact format that we're
- 24:45looking for so we go ahead and click
- 24:47inside of here and we can see solved so
- 24:49we already found the solution and this
- 24:51is a nice looking function right here
- 24:53that works and we can see this has 124
- 24:55likes so we can probably assume that
- 24:56that works pretty well then we can see
- 24:58there's an even simpler solution right
- 25:00here which is just all one line and
- 25:02that's what we're actually going to use
- 25:04instead so let's go ahead highlight this
- 25:06copy that go back into the studio and we
- 25:09can use that right here so we're just
- 25:10going to paste that real quick and i
- 25:12guess it would be easier just to make a
- 25:13separate function for this so we're
- 25:15going to say local function format
- 25:18time and we'll pass through
- 25:20seconds which is going to be a number
- 25:23and that's what we'll do so we'll change
- 25:25the s variable to seconds seconds and
- 25:29seconds and we're going to return that
- 25:30string so we're going to call format
- 25:32time and pass through the cooldown minus
- 25:35the current player's time and there we
- 25:37go we'll start the game and see what
- 25:38that returns and we look at that and we
- 25:40now see 23 colon 50 colon 34 33 32 31
- 25:46and that almost looks like how we want
- 25:47it but we want it to look slightly
- 25:49different so let's go ahead and modify
- 25:50it so rather than the colons we actually
- 25:52want to have commas and we also want to
- 25:54have h for the hours so h comma and then
- 25:57once again replace the colon m comma and
- 25:59finally we want to have s for seconds
- 26:02hours minutes seconds and don't remove
- 26:04the i that's specifically used in the
- 26:06string format function you want to keep
- 26:08those eyes they don't actually appear in
- 26:10the text that's being displayed and you
- 26:12can see that but you might get confused
- 26:13by that so i did want to make note of
- 26:15that that see we don't see the eyes in
- 26:16here and we did keep them in that string
- 26:18and those are for a specific reason for
- 26:20the string format anyway that time is
- 26:22now displayed perfectly the last thing
- 26:24that we need to do is we need to make
- 26:25sure that if the player is playing our
- 26:27game and the cooldown ends we want to
- 26:29actually set the time text label to not
- 26:31visible anymore because that means that
- 26:32the player is off cooldown so now if the
- 26:34player comes off cooldown the time will
- 26:36no longer be displayed and it will no
- 26:37longer be visible and that's exactly
- 26:39what we want the final thing that we
- 26:40probably want to do is we want to format
- 26:42the number that is displayed in the
- 26:44rewards text right here and if you guys
- 26:46remember the last episode we actually
- 26:48did this and we can actually look inside
- 26:49of our currency gy look inside of the
- 26:51manager and get the format number and
- 26:53use the exact same method that we did
- 26:55here so we'll paste that right there
- 26:57we've got the format number and then all
- 26:58we have to do is call format number
- 27:00format compact if that's what we want to
- 27:02do and we can go ahead and use that
- 27:05function right there and put the reward
- 27:07inside of there and there we go let's go
- 27:09ahead reset our data inside of the
- 27:11player data so that we don't have a
- 27:12cooldown anymore start up our game and
- 27:14test it out so upon going into the game
- 27:16we don't see any cooldown visible right
- 27:18there so we know that we can claim it
- 27:19let's step on it we see that we just got
- 27:211k the cooldown is now visible we see
- 27:23how long we have to wait we can close
- 27:25this and if we step on again we can see
- 27:27the notification that we cannot claim
- 27:29this chest right now so that works
- 27:30exactly as we wanted it with that being
- 27:32said ladies and gentlemen that's gonna
- 27:33be it for this episode hopefully you
- 27:34guys did enjoy if this video did help
- 27:36you guys out make sure you smash the
- 27:37like button also hit the subscribe
- 27:38button and turn this notifications on if
- 27:40you want to get notified when i upload
- 27:41more roblox spelman content additionally
- 27:42i do have patreon if you guys like to
- 27:44support me and get access to all the
- 27:45scripts and the game file that i made
- 27:46during this episode there's a link down
- 27:47below description and you guys can go
- 27:49and check that out with that being said
- 27:50i hope that you guys have a great day
- 27:51and i'll see you guys in the next
- 27:52episode
About this transcript
This page contains the full transcript of Creating Daily Rewards! Roblox Studio Simulator Guide Episode 17 by MonzterDEV, generated from the public captions YouTube serves with the video. The transcript has 6,929 words across 920 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.