YouTube2Text

Creating Daily Rewards! Roblox Studio Simulator Guide Episode 17 — Transcript

by MonzterDEV · 6,929 words · 920 segments · language en · Watch on YouTube

Full transcript

  1. 0:00what's going on ladies and gentlemen
  2. 0:00hopefully having a great day welcome
  3. 0:02back to the simulator series in today's
  4. 0:03episode we are going to be going over
  5. 0:05how to create a daily reward system in
  6. 0:07your simulator as always if this video
  7. 0:09does help you guys out or you do enjoy
  8. 0:10make sure you smash the like button also
  9. 0:12hit the subscribe button and turn this
  10. 0:13post notifications on if you want to get
  11. 0:14notified when i upload more roblox
  12. 0:16development content additionally i do a
  13. 0:17patreon if you guys like to support me
  14. 0:19and getting access to all the scripts
  15. 0:20and the game file that make during this
  16. 0:22episode there's a link down below in the
  17. 0:23description and you guys can go check
  18. 0:24that out with that being said let's get
  19. 0:26into it now to quickly showcase the
  20. 0:27feature that we're going to be creating
  21. 0:28today we can see loading into our game
  22. 0:30we have a part right here which says
  23. 0:31daily reward and since we already
  24. 0:33claimed the reward we can see that if we
  25. 0:34step on the part we get a notification
  26. 0:36that says you cannot claim this chest
  27. 0:38right now and then also if we look at
  28. 0:39the part itself it says daily reward and
  29. 0:41has the time displayed underneath it for
  30. 0:42when we're able to actually claim it
  31. 0:44once again and the time is constantly
  32. 0:46updating as well now if we haven't
  33. 0:47already claimed the reward we can see
  34. 0:48there is no time being displayed under
  35. 0:50here and we can go ahead and step on the
  36. 0:51part and now we can see a little
  37. 0:53notification pops up that says chest
  38. 0:54open come back tomorrow for more awesome
  39. 0:56rewards we received 200 coins and we can
  40. 0:59now see that the cooldown is displayed
  41. 1:00underneath of the daily reward text as
  42. 1:02well so to get right into the tutorial
  43. 1:03the first thing that we want to do is we
  44. 1:05actually want to create the daily reward
  45. 1:07part now as you saw when i previewed
  46. 1:08this feature i had a little chest with
  47. 1:10some coins and a little circle similar
  48. 1:12to our cell circle with some text
  49. 1:13displayed as well and that's what we're
  50. 1:14going to be using as our part as well
  51. 1:16because that looks pretty similar to the
  52. 1:17one in eating simulator now the way that
  53. 1:19i got that was pretty simple if you go
  54. 1:20to the toolbox and in the models you
  55. 1:22search for daily you should be able to
  56. 1:23find one pretty easily i think the one
  57. 1:25that i got specifically was from blue
  58. 1:27boo right here and all we're going to do
  59. 1:28is we're going to click that add it to
  60. 1:30our game and there we go we have the
  61. 1:31text we have the model and it all looks
  62. 1:33pretty good let's go ahead and flip this
  63. 1:35a little bit move it around and now of
  64. 1:36course you guys could make your own but
  65. 1:38i'm just going to take one from the
  66. 1:39toolbox as this is just for a learning
  67. 1:41process inside of the model what i'm
  68. 1:42gonna do is i'm gonna delete all of the
  69. 1:44stuff that we don't actually need all we
  70. 1:46want are the actual parts and that's it
  71. 1:48so then what we're gonna do is we're
  72. 1:50gonna drag all these parts and put that
  73. 1:52directly into there delete the parts
  74. 1:54model and now we have all of our parts
  75. 1:55inside of here what we then want to do
  76. 1:56is we want to make sure that everything
  77. 1:58is anchored which they all are currently
  78. 2:00and now we could organize this a little
  79. 2:02bit more if we wanted to like most of
  80. 2:03these parts seem to be coins and stuff
  81. 2:05like that so we could put them into
  82. 2:06their own folder or into their own model
  83. 2:08or we could really just highlight all of
  84. 2:10them right click click group and we
  85. 2:12could rename them to coins if we wanted
  86. 2:14to you don't need to do this and i'm not
  87. 2:15really going to do this i just wanted to
  88. 2:16show an example the next thing that i'm
  89. 2:18going to do is i'm going to delete this
  90. 2:20one cell part because we don't actually
  91. 2:22need that and we also have another part
  92. 2:23named cell right here and this is
  93. 2:24actually the yellow circle and what i'm
  94. 2:26going to do is because it looks like
  95. 2:27it's actually above the ground right
  96. 2:29here all i'm going to do is i'm simply
  97. 2:30going to move this down a little bit and
  98. 2:32there we go it now is touching the
  99. 2:34ground and it all looks pretty good the
  100. 2:35last thing that i want to do is make a
  101. 2:36specific part for being touched so when
  102. 2:39the player walks over this it's kind of
  103. 2:40like giving this model a hitbox so when
  104. 2:42the player walks into a certain area
  105. 2:44that'll trigger the daily reward to be
  106. 2:45given to the player we already pretty
  107. 2:46much did this with our cell part and
  108. 2:48kind of with the shot part as well what
  109. 2:49i'm going to do is i'm just going to
  110. 2:51duplicate the cell part that we already
  111. 2:52have right here because it's the same
  112. 2:54width and length as the model already
  113. 2:56all we're going to do is we're going to
  114. 2:57increase its height then we want to make
  115. 2:58sure that we delete this decal right
  116. 3:01here we want to make sure that it is not
  117. 3:03collidable so that players can walk
  118. 3:05through it and we're also going to
  119. 3:06rename this to touch and then it should
  120. 3:09be anchored already but let's just make
  121. 3:10sure and yes it's already anchored so
  122. 3:12that should all be good the last thing
  123. 3:13that we need to do is i guess i deleted
  124. 3:15whatever part had the billboard gy on it
  125. 3:18so what we're gonna do is we're actually
  126. 3:19gonna go to this part right here which
  127. 3:21is our cell part and we're actually just
  128. 3:23gonna take this billboard gy and move
  129. 3:25that over to our daily reward so we can
  130. 3:27put it right in there and we can see how
  131. 3:28this looks so that looks centered it
  132. 3:30looks nice it looks actually pretty good
  133. 3:32we then want to open up the billboard
  134. 3:34gui and change the text label to daily
  135. 3:38chest and see how that looks so we want
  136. 3:40to make the size of the billboard gy a
  137. 3:41little bit bigger so the width is
  138. 3:43probably going to be like five and the
  139. 3:45height could probably be like five as
  140. 3:47well and then we're going to set this to
  141. 3:50title because remember we're gonna have
  142. 3:51two text labels inside of here so the
  143. 3:53size of this instead of making it the
  144. 3:55full height we can make this like .5
  145. 3:57probably so that looks decent we should
  146. 3:59probably make this a little bit wider
  147. 4:01though so once again the size we're
  148. 4:03going to change the size to 10. and
  149. 4:05there we go now the words daily chest
  150. 4:07all fit on one line what we're then
  151. 4:09going to do is we're going to duplicate
  152. 4:10this by hitting ctrl d and selecting it
  153. 4:12and then we're going to rename this to
  154. 4:14time we're going to set the position
  155. 4:15first the anchor point 2.5 for the y and
  156. 4:18the position to 0.5 as well for the y
  157. 4:21and that looks pretty good but we might
  158. 4:22want to move it down a little bit more
  159. 4:24anyway we're going to set the text to 23
  160. 4:26h 59 m 59 s so that's and that's going
  161. 4:30to represent what the time should look
  162. 4:32like and then the color we want the text
  163. 4:33color to be white and that all looks
  164. 4:35pretty good let's check on mobile and
  165. 4:37yeah we can see we do want to move that
  166. 4:38text label down a little bit so let's go
  167. 4:40ahead and try to position it further
  168. 4:42down slightly so like five two five five
  169. 4:45two five and that looks decent maybe we
  170. 4:48wanna move it down a little bit more i
  171. 4:49don't know that looks kind of good
  172. 4:50honestly but we could move it down a
  173. 4:52little bit more if we wanted to so we
  174. 4:53moved it down to point 55 and it looks
  175. 4:55decent now it looks pretty good but you
  176. 4:57guys might want to play around with this
  177. 4:58a little bit more if you find any issues
  178. 5:00with it so now apart from that we should
  179. 5:01be good with the model what we then want
  180. 5:03to do is we want to move this model into
  181. 5:06the scriptable objects folder that we
  182. 5:07already have inside of our workspace and
  183. 5:09then we want to go into the server
  184. 5:10script service into the scriptable
  185. 5:12object script and now we'll add in the
  186. 5:14daily reward to this script so let's
  187. 5:16rename this to daily reward with no
  188. 5:18space between the words and then we can
  189. 5:20pretty much just copy the cell.touch
  190. 5:22that we already have right there and
  191. 5:23then we are going to say scriptable
  192. 5:25objects folder dot daily reward dot and
  193. 5:28remember we made a specific part called
  194. 5:30touch because we want to listen to when
  195. 5:31that gets touched so inside of the daily
  196. 5:33reward we want to look for the part
  197. 5:34called touch and then we want to listen
  198. 5:36for whenever that part is touched and
  199. 5:38then we can delete this stuff inside of
  200. 5:40the player if statement what we then
  201. 5:41want to do is we just want to print out
  202. 5:43true to see if this actually works when
  203. 5:45we touch this part now it should print
  204. 5:47out true so let's go ahead walk over to
  205. 5:49here and we can see true is now printed
  206. 5:51every single time that we are touching
  207. 5:52that part so that works all good now the
  208. 5:54next thing that we need to do is inside
  209. 5:56of the player data we actually want to
  210. 5:58add the daily reward to the player's
  211. 6:00data the reason that we want to add this
  212. 6:01to the player's data is because we need
  213. 6:03a cooldown of some sorts to track when
  214. 6:04the player is able to receive the reward
  215. 6:06once again so inside of the setup player
  216. 6:09function we're gonna scroll down right
  217. 6:10after we're looping through the dna
  218. 6:12config and we're gonna basically copy
  219. 6:14what we have right here just to make it
  220. 6:15simple instead of calling this equip dna
  221. 6:17we're gonna call this daily reward and
  222. 6:19then let's go ahead and copy that and
  223. 6:20paste that so we know that we're
  224. 6:21changing the daily reward name and the
  225. 6:23value and the name of this is actually
  226. 6:25going to be daily reward make sure you
  227. 6:27remember the capitalization so capital d
  228. 6:29and capital r or however you want to do
  229. 6:31it just make sure that you remember how
  230. 6:32this is spelled and then instead of a
  231. 6:34string value it's actually going to be a
  232. 6:36number value and the parent of this
  233. 6:38instead of the inventory folder is
  234. 6:40actually going to be the player so we
  235. 6:41have the daily reward we're creating a
  236. 6:43new number value we're parenting that to
  237. 6:45the player we're setting the name of it
  238. 6:47to daily reward and the number that we
  239. 6:49actually want to set is zero because
  240. 6:51we're counting this as the first time
  241. 6:52the player actually gets this value and
  242. 6:54this means that the player has not
  243. 6:56received the reward yet now inside of
  244. 6:57here where we grab the saved data and
  245. 6:59give it to the player what we're gonna
  246. 7:00do is we're going to say player dot
  247. 7:02daily reward dot value equals and then
  248. 7:05if return value so if we have saved data
  249. 7:08which contains daily reward and that
  250. 7:10does not equal nil then we're going to
  251. 7:12set the value of that to whatever that
  252. 7:14value is otherwise we're just going to
  253. 7:16set it to zero so if the player does
  254. 7:18have a cooldown already we're going to
  255. 7:19give the player the cooldown otherwise
  256. 7:20we're just going to set it to zero and
  257. 7:22that's how we'll know that we should
  258. 7:23give the player the reward for the first
  259. 7:24time then we want to make sure that
  260. 7:25we're saving that data so right here we
  261. 7:27can see this is where we save the data
  262. 7:29what we're gonna do is we're gonna say
  263. 7:30local daily reward equals player dot
  264. 7:34daily reward dot value and then what
  265. 7:37we're gonna do is we're gonna add a
  266. 7:39comma here and save that as daily reward
  267. 7:42with a capital d and a capital r and
  268. 7:44we're gonna set that to the value of
  269. 7:46daily reward which is the variable that
  270. 7:47we just created right here so that might
  271. 7:49be a little bit confusing but don't
  272. 7:50worry as we go through and actually
  273. 7:51start scripting out and using this data
  274. 7:53you'll probably understand why we're
  275. 7:55doing exactly what we're doing back
  276. 7:56inside of the scriptable objects what we
  277. 7:58now want to do is handle giving the
  278. 7:59player the reward and setting their
  279. 8:01cooldown so we're gonna do is inside of
  280. 8:03this if statement we're gonna check if
  281. 8:05the player.dailyreward.value
  282. 8:08equals zero because if it equals zero
  283. 8:10then we want to give the player the
  284. 8:12reward so we're gonna say then and now
  285. 8:14realistically you have to decide on how
  286. 8:15you want to reward the player for their
  287. 8:17daily reward in this scenario what i'm
  288. 8:19gonna do is i'm gonna use our rewards
  289. 8:20module and we're just gonna give them
  290. 8:22coins and we're gonna pass through the
  291. 8:24player and the amount of coins that we
  292. 8:25want to pass through we're just gonna
  293. 8:27say 1 000 for every time the player gets
  294. 8:29the daily reward like i said you can
  295. 8:31make your own system for deciding how
  296. 8:32many coins you want to give the player
  297. 8:34and we will use the multiplier as well
  298. 8:36so there we go that will now reward the
  299. 8:37player when they claim their daily
  300. 8:38reward the next thing that we need to do
  301. 8:40is we need to add a cooldown to this now
  302. 8:42the way that we're going to add the
  303. 8:43cooldown to this is by actually using
  304. 8:44the daily reward value so we're going to
  305. 8:46actually set this value to os dot time
  306. 8:49now you might not be familiar with
  307. 8:51os.time what this does is well we can
  308. 8:53read the description it returns how many
  309. 8:54seconds have passed since the unix epoch
  310. 8:57january 1st 1970 at zero zero zero zero
  311. 9:00zero zero under current utc time now
  312. 9:02that probably made no sense to you but
  313. 9:04don't worry i'll explain it on screen
  314. 9:06right now we're on a website called unix
  315. 9:08timestamp this right here is what
  316. 9:10os.time would return because this is the
  317. 9:12current amount of seconds which have
  318. 9:14passed since january 1st 1970. so every
  319. 9:17single second that passed through adds
  320. 9:19to this number right here and this is
  321. 9:21the amount of seconds that have passed
  322. 9:22since this date and time so what we're
  323. 9:24going to do is we're going to take the
  324. 9:25player's current time and that's going
  325. 9:27to give us this number then we want to
  326. 9:28add the amount of seconds that are in a
  327. 9:30day to that number and that will
  328. 9:32basically give us a 24 hour or a one day
  329. 9:35cooldown for when the player is able to
  330. 9:36receive their daily rewards and by
  331. 9:38looking at this website we can easily
  332. 9:40see how many seconds are in a day and
  333. 9:42that's eighty six thousand four hundred
  334. 9:43so we wanna add eighty six thousand four
  335. 9:45hundred seconds onto the player's
  336. 9:47current time and that's we're gonna set
  337. 9:49the daily reward value to so that we
  338. 9:51know that that's how long the player
  339. 9:52needs to wait before they're eligible
  340. 9:54for the daily reward once again so back
  341. 9:56inside of the studio we have the os dot
  342. 9:58time and now we are going to add on the
  343. 10:0086
  344. 10:01400 seconds to this specific time now
  345. 10:04remember this is 24 hours so we're
  346. 10:06basically adding 24 hours to the current
  347. 10:08time and we're setting the player's
  348. 10:10daily reward to this so we're setting it
  349. 10:12to 24 hours in the future so now if the
  350. 10:14player steps on this part once again
  351. 10:16obviously this will not run again
  352. 10:17because the daily reward no longer
  353. 10:19equals zero but we need to make another
  354. 10:21check for this because it should only
  355. 10:23ever equal zero if it's the first time
  356. 10:25the player has joined the game so we're
  357. 10:26gonna say or and we're once again gonna
  358. 10:28check the player's daily reward value
  359. 10:30but we're gonna say if the current os
  360. 10:32dot time so the current time is greater
  361. 10:34than or equal to and now we want to use
  362. 10:36the player's daily reward value and we
  363. 10:38want to add on 86 400 seconds once again
  364. 10:42hey so monster from the future here
  365. 10:43while i was editing the episode i
  366. 10:45realized i made a slight mistake and
  367. 10:46rather than re-recording the entire
  368. 10:48episode i felt that i could just make
  369. 10:49this little fix real quick and tell you
  370. 10:51guys the mistake and the solution to fix
  371. 10:52it i say that the comparison should be
  372. 10:54the current time is either greater than
  373. 10:56or equal to the player's cooldown plus a
  374. 10:59hour cooldown this is actually incorrect
  375. 11:01we don't need to add a 24 hour cooldown
  376. 11:03to the player's already existing
  377. 11:05cooldown because that wouldn't make
  378. 11:06sense when we set the daily reward value
  379. 11:08right here we're adding the current time
  380. 11:10plus 24 hours ahead so that's why alls
  381. 11:13we need to do is we just need to compare
  382. 11:15the current time to the player's 24 hour
  383. 11:18cooldown and that's the proper check if
  384. 11:20we add another 24 hours to the player's
  385. 11:22cooldown then that would actually be a
  386. 11:2348 hour cooldown which is probably not
  387. 11:26what you want now for the rest of the
  388. 11:27video you're going to be seeing the
  389. 11:29previous check which would be adding the
  390. 11:3024 hour cooldown to this because i
  391. 11:33didn't realize this until i went through
  392. 11:34the editing process so hopefully it
  393. 11:36doesn't confuse you too much the correct
  394. 11:38check that you should be doing is just
  395. 11:39comparing the current time is greater
  396. 11:41than or equal to and then the player
  397. 11:43daily reward value not adding an
  398. 11:45additional 86 400 seconds to it my
  399. 11:48apologies for making a mistake luckily i
  400. 11:49did just realize it so that i can fix it
  401. 11:51for you guys anyway enjoy the rest of
  402. 11:53the episode so what this is saying is if
  403. 11:55the current time is greater than the
  404. 11:57player's cooldown plus 86 400 then we
  405. 12:00want to run this so basically if the
  406. 12:02player is off cooldown then we want to
  407. 12:04run this give them the cooldown and then
  408. 12:06they won't be able to claim the reward
  409. 12:07again for another 24 hours and there we
  410. 12:09go now that i'm thinking about this we
  411. 12:11actually don't need the
  412. 12:12player.dailyreport.value equals to zero
  413. 12:15because zero plus
  414. 12:1786400 is always going to be less than
  415. 12:19the current time anyways so that check
  416. 12:21wasn't necessary anyway let's go ahead
  417. 12:24and make sure that we put this print
  418. 12:25statement inside of here so that we can
  419. 12:27verify that this works and then we'll
  420. 12:29actually make an else statement inside
  421. 12:31of here and then we will put a print
  422. 12:33false statement inside of here so that
  423. 12:34we can tell if the player gets the
  424. 12:36reward or if they're not able to get the
  425. 12:37reward and now let's start this up and
  426. 12:39test it out so let's go ahead walk over
  427. 12:41touch it and we can see true is printed
  428. 12:42out and now false is continuously
  429. 12:44printed out because we're no longer able
  430. 12:46to get the reward so that worked
  431. 12:47perfectly so now that we know that we're
  432. 12:49giving the player the reward what we
  433. 12:50then want to do is we want to actually
  434. 12:52make a gui and notify the player that
  435. 12:54they are receiving the reward so what
  436. 12:56we're gonna do is we're gonna go inside
  437. 12:57of the starter gui we're then gonna
  438. 12:59clone the max food gui and we can rename
  439. 13:02this to daily reward and let's go ahead
  440. 13:04and enable it so we can see this and the
  441. 13:06reason that we're duplicating max food
  442. 13:07is because this frame already looks like
  443. 13:09the frame that eating simulator uses for
  444. 13:11the daily reward anyway so rather than
  445. 13:13recreating this entire thing it's much
  446. 13:15easier to just start with this base
  447. 13:16plate right here so we're going to
  448. 13:17delete the extra frame and we now just
  449. 13:19have the notification frame let's open
  450. 13:21up the notification frame and we're
  451. 13:22going to remove the cell and shot button
  452. 13:26and now we have the message the title
  453. 13:27and the exit button so for the title
  454. 13:29we're actually going to change the text
  455. 13:30from mac's food to chess opened and then
  456. 13:33for the message we are going to change
  457. 13:35that from sell your food or upgrade your
  458. 13:38dna to come back tomorrow for more
  459. 13:41awesome rewards there we go we've got
  460. 13:45that now we probably want to resize this
  461. 13:47a little bit so we'll stretch this out a
  462. 13:49little bit just like that let's make
  463. 13:52sure that this is centered so there we
  464. 13:55go now let's duplicate the message text
  465. 13:56label and bring that down a little bit
  466. 13:58and this is going to display the reward
  467. 14:00that we get so we'll rename this to
  468. 14:02reward and we'll set the text to our
  469. 14:04money symbol and
  470. 14:061
  471. 14:07000 so there we go that will display the
  472. 14:10reward that we receive and we could make
  473. 14:11this smaller if you feel like it should
  474. 14:13be smaller i think that's probably
  475. 14:16pretty good now let's adjust the
  476. 14:17position to make sure once again that it
  477. 14:19is centered and there we go that looks
  478. 14:21pretty perfect actually the title is
  479. 14:23bothering me a little bit i think i want
  480. 14:24to move it down slightly so something
  481. 14:28like that okay i think that's pretty
  482. 14:29good now then what we want to do is we
  483. 14:31want to duplicate this title text label
  484. 14:33and move that just into the daily reward
  485. 14:36frame and this is going to be used for
  486. 14:37when the player is unable to claim the
  487. 14:38daily reward but they try to claim the
  488. 14:40daily reward so we're going to change
  489. 14:42the text from chest open to you cannot
  490. 14:45claim this chest right now and then the
  491. 14:49text color is going to be sort of a red
  492. 14:51with a stroke of black and now we're
  493. 14:54going to make this a little bit smaller
  494. 14:57probably something like that i guess
  495. 15:00let's just make sure that we position it
  496. 15:02in the center of the screen so there we
  497. 15:04go now it's centered in the screen and i
  498. 15:06think that looks pretty good let's also
  499. 15:08check the mobile view to make sure that
  500. 15:09everything looks good everything looks
  501. 15:10scaled no issues there alright perfect
  502. 15:13so now that we have all that what we're
  503. 15:14gonna do is we're gonna set the
  504. 15:15visibility of both of these to false so
  505. 15:18that we no longer see them we now need
  506. 15:19to come up with a way of the server
  507. 15:21telling the client that they just
  508. 15:23received the daily reward or they're
  509. 15:24unable to receive the daily rewards so
  510. 15:26that we can display those two new guis
  511. 15:28of course the way we're going to do this
  512. 15:30is go inside of the replicated storage
  513. 15:31inside the remotes folder and we're
  514. 15:33going to create a new remote event this
  515. 15:34remote event is going to be daily reward
  516. 15:37and we'll use that remote inside of our
  517. 15:40scriptable object script so we already
  518. 15:42have the remotes folder right here we're
  519. 15:43gonna say remotes dot daily reward fire
  520. 15:47client and we'll send that to the player
  521. 15:49and we'll pass through true as the
  522. 15:50second argument and that's basically
  523. 15:52saying that the player did receive the
  524. 15:53reward and if the player does not
  525. 15:55receive the reward or is unable to we're
  526. 15:57going to pass through false so now the
  527. 15:59server is telling the client if they did
  528. 16:00get the reward or if they're unable to
  529. 16:02get the reward we now need to set this
  530. 16:04up on the client side so we can actually
  531. 16:05do something with that information so
  532. 16:07inside the daily roar gy we have the
  533. 16:08manager script already made up because
  534. 16:10we duplicated this from the max food gui
  535. 16:12what we can do is we can pretty much
  536. 16:14just delete all of this for the most
  537. 16:16part and then we need to reset up
  538. 16:18certain variables instead of the max
  539. 16:20fuji we're going to say the daily reward
  540. 16:22gui is the script.parent and then we can
  541. 16:25just delete both of these as well and
  542. 16:26we're gonna say local notification
  543. 16:29frame equals daily reward gui dot
  544. 16:32notification and then inside of the
  545. 16:34frame the only thing that we need to get
  546. 16:36is the exit button and the reward
  547. 16:37because we're never going to change the
  548. 16:38message or the title so let's go ahead
  549. 16:41and get both of those we're just going
  550. 16:43to copy that variable and we're going to
  551. 16:44say exit button and that's going to be
  552. 16:46set to
  553. 16:47notification frame dot exit button and
  554. 16:50then the last thing that we need to get
  555. 16:52is the reward text so notification
  556. 16:54frame.reward and reward text
  557. 16:58reward you could say just reward or
  558. 17:00reward text or reward text label it
  559. 17:02doesn't really matter and we also want
  560. 17:03to get the title as well instead of
  561. 17:05saying title we could call this like
  562. 17:06warning or decline because remember this
  563. 17:09is the text that's displayed to the
  564. 17:10player when they're unable to accept the
  565. 17:12daily reward so i'm just going to call
  566. 17:13this warning just because it's simple
  567. 17:15enough to remember so we're going to say
  568. 17:17local warning equals daily reward gy dot
  569. 17:20warning and there we go we now have that
  570. 17:22text label so now that we have all of
  571. 17:23those components of the gui we now need
  572. 17:26to use the remotes and we already
  573. 17:28actually have the remotes folder here so
  574. 17:29we're going to say remote dot daily
  575. 17:32reward dot on client event and we're
  576. 17:34gonna connect that to a new function and
  577. 17:36we're actually gonna create a new
  578. 17:37function we're gonna say local function
  579. 17:39reward so then inside of here we're
  580. 17:41gonna pass through reward we're gonna
  581. 17:43say reward so that'll call the reward
  582. 17:45function and then of course with the
  583. 17:46reward function we need to accept a
  584. 17:48boolean argument so we're going to say
  585. 17:49reward and bullying because that's going
  586. 17:52to be either true or false now we can do
  587. 17:54is we can say if reward then so if the
  588. 17:57player is able to receive the reward
  589. 17:59what we want to do is we want to make
  590. 18:01the notification frame visible so we're
  591. 18:03going to set the visibility to true and
  592. 18:05actually i just forgot something instead
  593. 18:07of passing through true or false we're
  594. 18:08actually just going to send either the
  595. 18:10amount or just the player through and
  596. 18:12you might be confused by that but i'll
  597. 18:13show you how we can easily handle that
  598. 18:15in a second so back inside of the
  599. 18:16manager instead of the reward being a
  600. 18:18bullying it's actually going to be a
  601. 18:20number and it's going to be optional so
  602. 18:22what we're saying with if reward we're
  603. 18:24saying if the reward exists so if it is
  604. 18:26not nil then what we're going to do is
  605. 18:28we're going to make the frame visible
  606. 18:30and we actually want to set the reward
  607. 18:32text to the amount of the reward that we
  608. 18:34got so we're going to pass through the
  609. 18:37money bag icon because that's our
  610. 18:39currency oh and that oh that worked
  611. 18:42actually okay and then we want to
  612. 18:43combine that with the reward so there we
  613. 18:46go that should display the reward that
  614. 18:48we got and now we can also take a peek
  615. 18:50back at what our frame actually looks
  616. 18:52like so let's make this visible and yeah
  617. 18:54okay we see that the money icon with the
  618. 18:56money i don't know if there's a space
  619. 18:57between those two but you can choose if
  620. 18:58you want to put a space between those
  621. 19:00two or not doesn't really matter so once
  622. 19:02we get the reward it's going to make it
  623. 19:04visible so that we see that guy it's
  624. 19:06going to set the text to the reward that
  625. 19:07we actually got and then we want to do
  626. 19:09is we want to use
  627. 19:10task.delay and we want to set the amount
  628. 19:12of time that we want the gy to be
  629. 19:14visible for which is probably something
  630. 19:15like five seconds and then we're going
  631. 19:17to create an inline function and then
  632. 19:18what we're going to do is we're actually
  633. 19:20going to hide the notification frame so
  634. 19:22we're going to set the visibility of
  635. 19:23that to false now the reason that we're
  636. 19:25using task.delay is because this will
  637. 19:27run is because this will run this
  638. 19:28function on a separate thread and it
  639. 19:30won't actually pause this script at all
  640. 19:32at the same time this is kind of
  641. 19:33unnecessary because of how we have this
  642. 19:35function set up this is sort of just a
  643. 19:37habit that i got into and i'd say this
  644. 19:38is probably best practice or better than
  645. 19:40actually stalling this thread
  646. 19:41realistically it's a little bit
  647. 19:42complicated but i'll show you the
  648. 19:44equivalent to that which is a lot
  649. 19:46simpler we could do test.wait and then
  650. 19:47we could just do the
  651. 19:49notificationframe.visible equals false
  652. 19:50and now these two lines are equivalent
  653. 19:53to these lines right here but task that
  654. 19:55delay is a little bit different let's
  655. 19:56say that we're not using the task.wait
  656. 19:58and then we had print true right here
  657. 20:00what it will do instead of pausing this
  658. 20:02entire function right here when we call
  659. 20:04the task.delay this will basically spawn
  660. 20:06a new thread which is counting down five
  661. 20:08seconds but instantly after calling this
  662. 20:10it's going to instantly print true so
  663. 20:12it's not gonna wait the five seconds and
  664. 20:13then print true which would happen if we
  665. 20:15use task.wait five seconds it's going to
  666. 20:18instantly print instead of waiting
  667. 20:19because task.delay is spawning on a new
  668. 20:22threat anyway that's really complicated
  669. 20:23and hopefully i'm not confusing you by
  670. 20:25explaining all this but it is pretty
  671. 20:26nice to know anyway quick recap of
  672. 20:28what's gonna happen if we get the reward
  673. 20:29we're gonna set it to visible we're
  674. 20:30gonna set the notification for
  675. 20:31indivisible we're gonna change the text
  676. 20:33to the reward that the player received
  677. 20:34and then five seconds later we're gonna
  678. 20:36hide the frame now if the player is not
  679. 20:37getting the reward what we then want to
  680. 20:39do is we then want to display the
  681. 20:40warning text so we're gonna say warning
  682. 20:42dot visible equals true and now once
  683. 20:44again we can also do the task.delay and
  684. 20:46instead of the notification frame this
  685. 20:47time we can say warning dot visible
  686. 20:49equals false and that will make the text
  687. 20:51go away after five seconds or two
  688. 20:53seconds however long you want it to last
  689. 20:54now the final thing is the exit button i
  690. 20:56guess i kind of forgot about the exit
  691. 20:58button existing so realistically you
  692. 21:00don't need to set the visibility of this
  693. 21:02to false later you could just let the
  694. 21:04player click the exit button instead so
  695. 21:07we're gonna do is exit button dot mouse
  696. 21:08button one click connect function and
  697. 21:11then we are going to say notification
  698. 21:12frame dot visible equals false so now
  699. 21:15when the player clicks the x button on
  700. 21:17the reward frame it's just gonna make it
  701. 21:18not visible so that's why i removed the
  702. 21:20task.delay but we're still using the
  703. 21:22task.delay for the warning text because
  704. 21:24that obviously has no exit button okay
  705. 21:25so with all that being said that was a
  706. 21:27lot let's go ahead and test this out
  707. 21:29let's reset our i don't know if we need
  708. 21:31to reset our data because we might have
  709. 21:33already gotten the cooldown but let's go
  710. 21:34ahead and do that just in case and start
  711. 21:36up our game and see what happens so
  712. 21:38we're going to go over to here we're
  713. 21:39going to step on this we see that we did
  714. 21:41get the reward the notification popped
  715. 21:43up and the warning notification popped
  716. 21:44up as well we also did get the reward
  717. 21:46but if we step on this again we can see
  718. 21:48you cannot claim this chest right now
  719. 21:49and that's exactly what we want let's
  720. 21:51close that notification it closes and it
  721. 21:53doesn't open again we're not getting
  722. 21:54rewarded again so that works perfectly
  723. 21:56the next thing that we want to do is we
  724. 21:57want to make this cool down display
  725. 21:58properly so we're going to create a new
  726. 22:00function inside of here and that is
  727. 22:02going to be called display time and what
  728. 22:04we're going to do is we're going to get
  729. 22:06the player's daily reward so we're going
  730. 22:07to say localcooldown equals
  731. 22:11dot player.dailyreward.value and that's
  732. 22:12going to get the cooldown from the
  733. 22:13player and now let's think about when we
  734. 22:14want to call this function we actually
  735. 22:16want to listen to when the daily reward
  736. 22:18number value changes so we can get the
  737. 22:20daily reward object and then we can use
  738. 22:21the changed event onto there and we can
  739. 22:24connect that to a function and this
  740. 22:26function is going to pass through the
  741. 22:27value of what the new value is and we're
  742. 22:29going to connect that to display time so
  743. 22:31we don't actually really need the value
  744. 22:33per se and then also we want to call the
  745. 22:35display time function when the script
  746. 22:37starts up for the first time as well and
  747. 22:38that's why we're calling the function
  748. 22:39down here so now inside of the display
  749. 22:41time we're getting the player's cooldown
  750. 22:43we then want to also make a variable for
  751. 22:45the daily reward which is inside of the
  752. 22:47scriptable objects folder and we
  753. 22:49actually already have the cell part and
  754. 22:50the shot part which we don't need for
  755. 22:52this specific script so we're going to
  756. 22:53change this a little bit inside of the
  757. 22:54scriptable objects we want to get the
  758. 22:56daily rewards so there we go and we're
  759. 22:58just going to rename this to daily
  760. 22:59reward part and there we go we now have
  761. 23:02that part back inside of the display
  762. 23:03time function we're going to say if the
  763. 23:05cooldown is less than the current time
  764. 23:09of the player then we're basically just
  765. 23:10going to break the script currently and
  766. 23:12not do anything else for right now so
  767. 23:14now this might look really weird for you
  768. 23:16this is equivalent to writing it out
  769. 23:18just like this it's just formatted a
  770. 23:20little bit differently on one line
  771. 23:21instead of being spread out on three
  772. 23:23different lines so it's a little bit
  773. 23:24more compact and it looks a little bit
  774. 23:26nicer if we call this function and the
  775. 23:28cooldown is actually less than the
  776. 23:29current time then we don't want to do
  777. 23:31anything else in this function and
  778. 23:33you'll see why in a second so if that's
  779. 23:34not true then what we want to actually
  780. 23:36do is we want to get the daily reward
  781. 23:38and we want to get the billboard gui
  782. 23:40inside of it and we want to make the
  783. 23:41time visible so we're going to set the
  784. 23:43visibility of that to true and also
  785. 23:44right now we want to make sure that time
  786. 23:46is not visible because we don't want
  787. 23:48that to be visible by default so there
  788. 23:50we go we're going to make that visible
  789. 23:51if it should be visible and then we're
  790. 23:53going to create a while loop and we're
  791. 23:54going to say while the cooldown is
  792. 23:56greater than the player's time what
  793. 23:59we're going to do is we're going to set
  794. 24:00the time text so we're going to copy and
  795. 24:03paste that again and we're going to say
  796. 24:04text and we're going to set that text to
  797. 24:07the cooldown minus the current time and
  798. 24:10we want to wait one second every single
  799. 24:12time so let's go ahead and start our
  800. 24:14game and see how this looks in the game
  801. 24:15and now that actually looks decently
  802. 24:17good so what this is doing is it's
  803. 24:18displaying the cooldown and it's
  804. 24:19basically going down by one every single
  805. 24:22second we now want to convert this into
  806. 24:24an hour minute and second format rather
  807. 24:26than coming up with our own method of
  808. 24:27converting all those seconds into an
  809. 24:29hour minute and second format i'm just
  810. 24:31gonna search it up on google and we're
  811. 24:33gonna find the solution super easily so
  812. 24:35i literally googled convert seconds
  813. 24:37roblox dev and that's basically gonna
  814. 24:38come up with results from the dev forum
  815. 24:40and we can see this result right here
  816. 24:41converting seconds to h min and second
  817. 24:44and that's the exact format that we're
  818. 24:45looking for so we go ahead and click
  819. 24:47inside of here and we can see solved so
  820. 24:49we already found the solution and this
  821. 24:51is a nice looking function right here
  822. 24:53that works and we can see this has 124
  823. 24:55likes so we can probably assume that
  824. 24:56that works pretty well then we can see
  825. 24:58there's an even simpler solution right
  826. 25:00here which is just all one line and
  827. 25:02that's what we're actually going to use
  828. 25:04instead so let's go ahead highlight this
  829. 25:06copy that go back into the studio and we
  830. 25:09can use that right here so we're just
  831. 25:10going to paste that real quick and i
  832. 25:12guess it would be easier just to make a
  833. 25:13separate function for this so we're
  834. 25:15going to say local function format
  835. 25:18time and we'll pass through
  836. 25:20seconds which is going to be a number
  837. 25:23and that's what we'll do so we'll change
  838. 25:25the s variable to seconds seconds and
  839. 25:29seconds and we're going to return that
  840. 25:30string so we're going to call format
  841. 25:32time and pass through the cooldown minus
  842. 25:35the current player's time and there we
  843. 25:37go we'll start the game and see what
  844. 25:38that returns and we look at that and we
  845. 25:40now see 23 colon 50 colon 34 33 32 31
  846. 25:46and that almost looks like how we want
  847. 25:47it but we want it to look slightly
  848. 25:49different so let's go ahead and modify
  849. 25:50it so rather than the colons we actually
  850. 25:52want to have commas and we also want to
  851. 25:54have h for the hours so h comma and then
  852. 25:57once again replace the colon m comma and
  853. 25:59finally we want to have s for seconds
  854. 26:02hours minutes seconds and don't remove
  855. 26:04the i that's specifically used in the
  856. 26:06string format function you want to keep
  857. 26:08those eyes they don't actually appear in
  858. 26:10the text that's being displayed and you
  859. 26:12can see that but you might get confused
  860. 26:13by that so i did want to make note of
  861. 26:15that that see we don't see the eyes in
  862. 26:16here and we did keep them in that string
  863. 26:18and those are for a specific reason for
  864. 26:20the string format anyway that time is
  865. 26:22now displayed perfectly the last thing
  866. 26:24that we need to do is we need to make
  867. 26:25sure that if the player is playing our
  868. 26:27game and the cooldown ends we want to
  869. 26:29actually set the time text label to not
  870. 26:31visible anymore because that means that
  871. 26:32the player is off cooldown so now if the
  872. 26:34player comes off cooldown the time will
  873. 26:36no longer be displayed and it will no
  874. 26:37longer be visible and that's exactly
  875. 26:39what we want the final thing that we
  876. 26:40probably want to do is we want to format
  877. 26:42the number that is displayed in the
  878. 26:44rewards text right here and if you guys
  879. 26:46remember the last episode we actually
  880. 26:48did this and we can actually look inside
  881. 26:49of our currency gy look inside of the
  882. 26:51manager and get the format number and
  883. 26:53use the exact same method that we did
  884. 26:55here so we'll paste that right there
  885. 26:57we've got the format number and then all
  886. 26:58we have to do is call format number
  887. 27:00format compact if that's what we want to
  888. 27:02do and we can go ahead and use that
  889. 27:05function right there and put the reward
  890. 27:07inside of there and there we go let's go
  891. 27:09ahead reset our data inside of the
  892. 27:11player data so that we don't have a
  893. 27:12cooldown anymore start up our game and
  894. 27:14test it out so upon going into the game
  895. 27:16we don't see any cooldown visible right
  896. 27:18there so we know that we can claim it
  897. 27:19let's step on it we see that we just got
  898. 27:211k the cooldown is now visible we see
  899. 27:23how long we have to wait we can close
  900. 27:25this and if we step on again we can see
  901. 27:27the notification that we cannot claim
  902. 27:29this chest right now so that works
  903. 27:30exactly as we wanted it with that being
  904. 27:32said ladies and gentlemen that's gonna
  905. 27:33be it for this episode hopefully you
  906. 27:34guys did enjoy if this video did help
  907. 27:36you guys out make sure you smash the
  908. 27:37like button also hit the subscribe
  909. 27:38button and turn this notifications on if
  910. 27:40you want to get notified when i upload
  911. 27:41more roblox spelman content additionally
  912. 27:42i do have patreon if you guys like to
  913. 27:44support me and get access to all the
  914. 27:45scripts and the game file that i made
  915. 27:46during this episode there's a link down
  916. 27:47below description and you guys can go
  917. 27:49and check that out with that being said
  918. 27:50i hope that you guys have a great day
  919. 27:51and i'll see you guys in the next
  920. 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.