YouTube2Text

Scripting the Settings Gui! Roblox Studio Simulator Guide Episode 20 — Transcript

by MonzterDEV · 4,912 words · 660 segments · language en · Watch on YouTube

Full transcript

  1. 0:00hey what's going on ladies and gentlemen
  2. 0:01welcome back to the simulator series in
  3. 0:02today's episode we are gonna be
  4. 0:03scripting the settings gui that we
  5. 0:05created in the last episode as always if
  6. 0:07this video does help you guys out or you
  7. 0:08guys do enjoy it make sure you smash
  8. 0:10like button also hit the subscribe
  9. 0:11button and turn this post notifications
  10. 0:12on if you want to get notified when i
  11. 0:13upload more roblox development content
  12. 0:15additionally i do a patreon if you would
  13. 0:16like to support me and gain access to
  14. 0:18all the scripts and the game file then
  15. 0:19make during this episode there's a link
  16. 0:21down below in the description and you
  17. 0:22guys can go and check that out with that
  18. 0:23being said let's get into it to showcase
  19. 0:25the features that we're going to be
  20. 0:26creating today as we can see on the
  21. 0:28right hand side of the screen we have
  22. 0:29the settings button when we click this a
  23. 0:31little menu pops up and it has a couple
  24. 0:33of the different settings we have the
  25. 0:34pop-up effects music sfx and trade
  26. 0:36requests whenever we click on one of
  27. 0:38these buttons it goes from the bond
  28. 0:39being green and displaying on to being
  29. 0:41red and displaying off and it also does
  30. 0:43what those specific settings do as well
  31. 0:45additionally if we hit the x button
  32. 0:47right here that closes the gui and
  33. 0:49that's exactly what we're going to be
  34. 0:50recreating today so hopping right back
  35. 0:52into the studio if we go inside of the
  36. 0:53storage ui and we look inside of
  37. 0:55settings let's go ahead and re-enable
  38. 0:56this so we can actually see the gui now
  39. 0:59inside of the syncs gui we have a script
  40. 1:01named manager because i believe we
  41. 1:02duplicated the max food gui and used
  42. 1:04that as sort of the template for making
  43. 1:06this gui let's go ahead and open up the
  44. 1:08manager script and we see we have a
  45. 1:09bunch of different variables already
  46. 1:11created in here which most of these we
  47. 1:12can delete so we most likely won't need
  48. 1:14any of these parts we might need remote
  49. 1:16so i'll leave that for now with the
  50. 1:18workspace we probably won't need each of
  51. 1:20these buttons we'll delete because we'll
  52. 1:21manually add them ourselves and then for
  53. 1:23the gy let's rename this to screen gui
  54. 1:26that will be the script.parent so
  55. 1:28that'll be the settings gui right there
  56. 1:30and let's start making a couple more
  57. 1:31variables so we're going to say local
  58. 1:32frame equals screen gy dot frame then
  59. 1:35what we're going to need is we need the
  60. 1:36exit button and also the container those
  61. 1:39are probably the only things that we're
  62. 1:40actually going to be changing or
  63. 1:42scripting the title and the subtitle
  64. 1:44don't ever need to be modified so we
  65. 1:45won't be using them so let's go ahead
  66. 1:47and initialize variable for the exit
  67. 1:48button so we can just say exit or exit
  68. 1:50button equals frame dot exit button
  69. 1:53there we go we've now got that and then
  70. 1:54let's also add the container as well so
  71. 1:56local container equals frame dot
  72. 1:58container now instead of saying just
  73. 2:00frame dot container because this is just
  74. 2:02a frame and remember inside of our
  75. 2:04container frame we have a container
  76. 2:06scrolling frame which will be the actual
  77. 2:08container we only made this container
  78. 2:10frame specifically so that we can have
  79. 2:12the ui corner so this is kind of like a
  80. 2:14fake container it's basically just a
  81. 2:15normal frame and we're not actually
  82. 2:17using this as a container hopefully
  83. 2:18that's not too confusing but what we're
  84. 2:20going to initialize the container
  85. 2:22variable 2 is not actually just
  86. 2:24frame.container it's actually going to
  87. 2:25be
  88. 2:26frame.container.container and this will
  89. 2:27be the scrolling frame the real
  90. 2:29container now inside of the container we
  91. 2:31also have the template if you guys
  92. 2:32watched my video when i made the shop gy
  93. 2:34we also had a template inside of this
  94. 2:36one as well but rather than being inside
  95. 2:38of the container we actually parented
  96. 2:40that to the manager module script
  97. 2:41recently when i've been working on other
  98. 2:43projects rather than putting this
  99. 2:44somewhere outside of the actual
  100. 2:45container i've been leaving this in for
  101. 2:47now so in this episode i'm going to be
  102. 2:48showing you guys a different way of
  103. 2:50handling this compared to when we
  104. 2:51created the shop gy but when you think
  105. 2:53about this just remember how we did the
  106. 2:54template back when we created the shop
  107. 2:56gy we're going to be going through a
  108. 2:57very similar process while creating the
  109. 2:59settings ui as well and hopefully by the
  110. 3:01end of the video you guys will know
  111. 3:02exactly what i mean if this is confusing
  112. 3:04to you at all so what we then also want
  113. 3:06to do is we want to initialize a
  114. 3:07variable for the template so we're going
  115. 3:08to say local template equals container
  116. 3:11dot template so now we got most of the
  117. 3:13variables that we're going to be using
  118. 3:14initialized i actually forgot one pretty
  119. 3:16important thing and the thing that we
  120. 3:17should have done first is actually
  121. 3:18scripting the settings button so let's
  122. 3:20go ahead and open up the button screen
  123. 3:21gui and inside of the button holder is
  124. 3:23where we have the actual settings button
  125. 3:25itself now one way that we could go
  126. 3:26about this is inside of the bun's gui we
  127. 3:28have the manager script right here and
  128. 3:30what we could do is we could initialize
  129. 3:32a variable similar to how we have the
  130. 3:33cell button already created we could
  131. 3:35also create the settings button and then
  132. 3:36handle it the same exact way rather than
  133. 3:38doing that we're gonna handle it a
  134. 3:39little bit differently as well hopefully
  135. 3:41me showing you guys multiple ways of
  136. 3:42handling the same thing will help you
  137. 3:44guys learn for the future all the
  138. 3:46different ways that you guys can do this
  139. 3:47and i really hope it isn't causing more
  140. 3:49confusion than it is helping and
  141. 3:51learning definitely leave me feedback in
  142. 3:52the comment section down below though
  143. 3:53because it really helps me learn the
  144. 3:54best way to actually teach you guys and
  145. 3:56present you guys the different ideas and
  146. 3:58ways of doing stuff with that being said
  147. 3:59we're going to close this manager and
  148. 4:01we're going to go back inside of the
  149. 4:03settings ui and we're going to create
  150. 4:04another local script and we're just
  151. 4:06going to call this button what i'm going
  152. 4:07to do is we want to create a variable
  153. 4:09for the buttons gui so what we're going
  154. 4:10to do is we're going to say local
  155. 4:12buttons gui equals script dot parent dot
  156. 4:16parent now remember script.parent would
  157. 4:18be settings dot parent would then be the
  158. 4:20starter gy in this example and then what
  159. 4:22we could do is we could say dot buttons
  160. 4:24which gives us the bun screen gui now
  161. 4:26from here we want to create a variable
  162. 4:28specifically for the settings button and
  163. 4:30that's going to be equal to the bungee y
  164. 4:32dot button holder dot settings and now
  165. 4:34we have the settings button we'll also
  166. 4:36create a variable for the screen gui
  167. 4:38which is going to be the settings gui so
  168. 4:40local screen gy equals script dot parent
  169. 4:44and that's equal to the settings gui
  170. 4:46then we want to do is whenever we click
  171. 4:48the settings button so settings button
  172. 4:51dot now spawn one click connect and
  173. 4:53we'll just create a new function inside
  174. 4:54of here so we'll say function screen gui
  175. 4:57dot enabled equals not screen gui dot
  176. 5:00enabled so if it's enabled then it'll
  177. 5:02set that to not enabled so if enabled is
  178. 5:04set to true it'll then set the false or
  179. 5:06if it's equal to false then it'll set to
  180. 5:08true and we can go ahead and start up
  181. 5:09our game and test this out ourselves if
  182. 5:10we click on settings we can see it's no
  183. 5:12longer visible if we click the button
  184. 5:13again it becomes invisible and we can
  185. 5:15keep doing that and it works exactly as
  186. 5:17it should so now we should be completely
  187. 5:18done with this script we can go ahead
  188. 5:20and close the button script and move on
  189. 5:21from there what we want to do is we want
  190. 5:22to create a module script which contains
  191. 5:24all the settings and some different
  192. 5:26information about them it's basically
  193. 5:27going to be a config file that we
  194. 5:29already have experience with creating so
  195. 5:30let's go inside of the replicated
  196. 5:31storage inside of the config folder and
  197. 5:33let's just go ahead and create a new
  198. 5:35module script we'll rename this to
  199. 5:37settings and now we have local module
  200. 5:39equals the table and then we return that
  201. 5:41so installing the table we want to
  202. 5:42create a new table and each individual
  203. 5:44table is going to hold all the
  204. 5:45properties of specific settings so the
  205. 5:47first property is going to be id and the
  206. 5:50first setting we'll create is pop-up
  207. 5:51underscore effects and remember this is
  208. 5:54going off eating simulator so this is
  209. 5:55just going to be an example and it's
  210. 5:57going to be using the settings that they
  211. 5:58also use so we're going to set the id to
  212. 6:00pop-up effects we'll also set a
  213. 6:02description as well and the description
  214. 6:04for this setting is disable the pop-up
  215. 6:06effects for coins and food we'll also
  216. 6:07have an enabled property and we'll set
  217. 6:09that to true because by default all the
  218. 6:11settings in evening simulator are set to
  219. 6:13true and now we want to add another
  220. 6:15setting to this as well so we'll just
  221. 6:16copy this table and then just paste it
  222. 6:18and now instead of filling out all these
  223. 6:20properties or all these fields again
  224. 6:21what i'm gonna do is we're just gonna
  225. 6:23set the description to something
  226. 6:24different so we can easily see that when
  227. 6:26we display this in the gui okay the
  228. 6:28description is this of course if you're
  229. 6:30making your own game and you already
  230. 6:31have your ideas for the settings you can
  231. 6:32of course input the actual description
  232. 6:34so the next thing that we're gonna do is
  233. 6:36music we'll also duplicate this again
  234. 6:39and instead of music we'll say sfx and
  235. 6:41we'll set this description to two two
  236. 6:43two two two we could actually set this
  237. 6:44to one one one one to make it more easy
  238. 6:46to differentiate between them and then
  239. 6:48finally we have trade requests and we're
  240. 6:50gonna set this to three three three
  241. 6:52three three there we go so that's gonna
  242. 6:53be all of our settings for right now
  243. 6:55let's hop back into our manager script
  244. 6:56and let's also close all the guise that
  245. 6:58we're not gonna be using so just close
  246. 7:00the buns gui and there we go now inside
  247. 7:02of here what we want to do is we want to
  248. 7:03get the settings config file so we're
  249. 7:05going to say local settings equals
  250. 7:07replicated storage wait for child config
  251. 7:10wait for child settings there we go we
  252. 7:12now have the settings now the first
  253. 7:14thing we can do which is the easiest
  254. 7:15just to get out of the way is we can
  255. 7:16script the exit button so we have exit
  256. 7:19mouse button one click connect create a
  257. 7:21function inside of here and whenever we
  258. 7:23click this we want to set the screen gy
  259. 7:25enabled to false so we want to make it
  260. 7:28not visible and now that's completely
  261. 7:30out of the way let's then create a new
  262. 7:32function and we're going to call this
  263. 7:33generate setting now the parameter this
  264. 7:35is going to accept is going to be called
  265. 7:37setting and it's actually going to be a
  266. 7:38table because it's going to be one of
  267. 7:40the tables that we created in the
  268. 7:41settings config file for example we'll
  269. 7:43pass this entire table through to this
  270. 7:45specific function now what we're going
  271. 7:46to do is we want to create a new
  272. 7:48variable called clone and that's
  273. 7:50actually going to be the template and
  274. 7:51we're going to clone this once we clone
  275. 7:54this what we want to do is we want to
  276. 7:55then parent this to the container
  277. 7:57because we want to have all of our
  278. 7:58settings inside of the container then
  279. 8:00let's rename the frame to the specific
  280. 8:02setting and remember the way that we
  281. 8:03have the name set up inside of our
  282. 8:05setting is by the id property so we're
  283. 8:07going to say setting dot id if we look
  284. 8:09inside of the frame inside of the
  285. 8:10container and inside of the template
  286. 8:12this is the clone just for reference if
  287. 8:14you guys aren't following along exactly
  288. 8:15this template is what we're cloning
  289. 8:17right here so this would be the clone
  290. 8:19variable inside of the template we have
  291. 8:20the title if we look at the title this
  292. 8:22is the name of the setting so what we're
  293. 8:24then going to do is we're going to say
  294. 8:26clone dot title dot text equals and we
  295. 8:29want to also set that to the setting dot
  296. 8:32id now since setting that id is a string
  297. 8:35we can actually use a method on this
  298. 8:37called g sub this basically allows you
  299. 8:39to filter out certain characters or
  300. 8:41letters inside of a specific string so
  301. 8:43we're going to say g sub and then we're
  302. 8:45going to pass through is what we want to
  303. 8:46replace and what we want to replace
  304. 8:48inside of the id is underscore and the
  305. 8:51reason that we want to replace
  306. 8:52underscore is because we have pop-up
  307. 8:54underscore effects if we display pop-up
  308. 8:56underscore effects in the gui we don't
  309. 8:58want the underscore to be there we want
  310. 9:00the underscore to actually be replaced
  311. 9:01by a space like we have right here so
  312. 9:04inside of the g sub we now have this is
  313. 9:06what we want to be replaced comma and
  314. 9:08this is what we're going to replace it
  315. 9:09with and then we're just going to hit
  316. 9:11space the next thing that we want to do
  317. 9:12is we want to get the description so if
  318. 9:14we see right here the description is a
  319. 9:16text label and we're going to set that
  320. 9:18text to setting dot description the next
  321. 9:21thing we want to do is we have the
  322. 9:23button right here and currently it
  323. 9:24displays on and its background color is
  324. 9:27also a pretty bright green so what we
  325. 9:28want to do is we want to decide on the
  326. 9:30on and off colors for instance right now
  327. 9:33it's 47 214 and 28 so what we're gonna
  328. 9:36do is at the top of our manager script
  329. 9:38right underneath template we're gonna
  330. 9:39create a constant variable we're gonna
  331. 9:41say local on color equals color three
  332. 9:45dot from rgb and we're gonna paste this
  333. 9:48color into there and as we can see the
  334. 9:50color is displayed right there that nice
  335. 9:51green that we already have and then we
  336. 9:53create another one instead of on this is
  337. 9:55going to be off so this is the color
  338. 9:56that is specifically going to be
  339. 9:57whenever we set the value to off and
  340. 9:59we'll just set it to a nice little red
  341. 10:01just like that so we've got green for on
  342. 10:03and we've got red for off the reason
  343. 10:05that we're putting in all capital
  344. 10:06letters is because that is what a
  345. 10:07constant is this variable will never
  346. 10:10change we're just always going to
  347. 10:11reference this at a specific time what
  348. 10:12we then want to do is we want to say
  349. 10:14clone dot button dot background color 3
  350. 10:18equals and now what we want to do is we
  351. 10:20want to say if the setting dot enabled
  352. 10:22which means that the setting is enabled
  353. 10:24or enabled equals true then we want to
  354. 10:27set it to the on color else we want to
  355. 10:30set it to the off color so if enabled
  356. 10:32equals false for that specific setting
  357. 10:34then the off color will be used but if
  358. 10:35enabled equals true then the on color
  359. 10:37will be used exactly as it should be
  360. 10:39additionally we want to set the
  361. 10:40clone.button
  362. 10:42text to on or off based on if it is
  363. 10:45enabled or not so what we can do is we
  364. 10:47can just copy this and paste it so if
  365. 10:49setting dot enabled is true then we want
  366. 10:51to set the text to on but if it's false
  367. 10:54then we want to set it to off the final
  368. 10:56thing that we want to do is we want to
  369. 10:57set the visibility of this to true and
  370. 11:00you might be confused by that but the
  371. 11:02reason for that is because we're
  372. 11:03actually going to set the template to
  373. 11:05not visible because we don't want a
  374. 11:07template to be displayed we only want
  375. 11:08the ones that we create to be displayed
  376. 11:10and that's why we're leaving the
  377. 11:12template inside of here because we can
  378. 11:13easily just set it to not visible and
  379. 11:15then set all the duplicates or clones of
  380. 11:17it to visible when we need to so we're
  381. 11:19then gonna do is in between the exit
  382. 11:21button and the function that we just
  383. 11:22created let's loop through all of the
  384. 11:25settings so we're gonna say setting
  385. 11:27table in pairs and we'll loop through
  386. 11:29settings and then we're going to call
  387. 11:31the generate setting function and we'll
  388. 11:33pass through the setting table
  389. 11:35additionally let's hide the settings ui
  390. 11:36by setting the enable to false and start
  391. 11:39per game and test this out ah of course
  392. 11:40i made a little mistake when we
  393. 11:42initialized the settings variable i
  394. 11:43actually forgot the keyword which is
  395. 11:45required because that is a module script
  396. 11:47so we need to surround that in a
  397. 11:49required statement and now that should
  398. 11:51work perfectly so let's go ahead and
  399. 11:52start this up and test it out so now
  400. 11:54upon starting you up you can hit the
  401. 11:55settings guy button and we can see that
  402. 11:57music was generated with the one one one
  403. 11:59description and we can even confirm this
  404. 12:01by looking in the model script itself so
  405. 12:03we can see one one one one two two two
  406. 12:04two two and three three three three
  407. 12:06three those all worked exactly as they
  408. 12:08should and let's also click the exit
  409. 12:10button and we can see that now hides the
  410. 12:11gui which is perfect additionally we
  411. 12:13need a script when we click on the on
  412. 12:15button and set that to off and we also
  413. 12:17need to script the individual settings
  414. 12:19as well back inside of the manager below
  415. 12:21where we set the visibility to true what
  416. 12:23we want to do is we want to get the
  417. 12:24button and we want to do something
  418. 12:26whenever we click this so the first
  419. 12:28thing we want to do is if we remember
  420. 12:29back to the settings module script we
  421. 12:31created we have the little enabled
  422. 12:33property right here we actually want to
  423. 12:34change the value of this to the opposite
  424. 12:36of what it currently is whenever we
  425. 12:38click the button and we've already done
  426. 12:39this with the screen gui in the button
  427. 12:41script example and what i mean by that
  428. 12:43is anytime we click the settings button
  429. 12:45we set the enabled to the opposite of
  430. 12:47what it already is and that's exactly
  431. 12:48what we're going to do here so we're
  432. 12:50going to say setting dot enabled equals
  433. 12:53not setting dot enabled so that'll set
  434. 12:56it to the opposite of what it currently
  435. 12:57is then we also want to change the
  436. 12:58background color of the bun exactly like
  437. 13:00how we already do here so we can just
  438. 13:02copy and paste that directly into here
  439. 13:03and then the same exact thing goes with
  440. 13:05the text we can copy and paste that
  441. 13:07directly into here as well because if
  442. 13:08it's currently on and we set that to off
  443. 13:10we then want to change the color and the
  444. 13:12text so it displays that as well let's
  445. 13:13go ahead and start this up and make sure
  446. 13:15that all works perfectly so open up
  447. 13:17settings click on it now changes to off
  448. 13:19and that should work for all of them and
  449. 13:21it does so that works exactly as it
  450. 13:22should perfect so now we're gonna do is
  451. 13:24we're gonna actually add music to our
  452. 13:26game so that i can showcase how you guys
  453. 13:28can actually disable or enable certain
  454. 13:30things in your game when it comes to
  455. 13:32settings considering we're all trading
  456. 13:34and that's a lot harder to implement i
  457. 13:35figured music would be the easiest one
  458. 13:37for me to display how you could actually
  459. 13:38use settings in your game so to add
  460. 13:40music into our game what we're simply
  461. 13:41going to do is we're going to go inside
  462. 13:43of the sound service right down here and
  463. 13:45we're going to add in a sound now just
  464. 13:47for this specific sound i'm going to add
  465. 13:49in some random music that i found from
  466. 13:51the marketplace the sound id is going to
  467. 13:53be this one right here you can use
  468. 13:54whatever sound id you want for your own
  469. 13:56music then what we also want to do is
  470. 13:58since this is going to be the background
  471. 13:59music that is playing while our player
  472. 14:01just passively plays the game we're
  473. 14:02going to set loop to true so that the
  474. 14:04song is always repeating itself even
  475. 14:06when it runs the full duration
  476. 14:07additionally we want to rename this just
  477. 14:09to background music so that we know what
  478. 14:12it is the next thing we want to do is
  479. 14:14inside of the settings gui let's make a
  480. 14:16brand new module script and we're going
  481. 14:18to rename this to handler now this is
  482. 14:20going to handle how the settings
  483. 14:22actually change or affect certain things
  484. 14:24so the first thing that we want to do is
  485. 14:26let's go ahead and get the sound service
  486. 14:28so we're going to say local sound
  487. 14:30service equals game get service sound
  488. 14:34service we can also get the background
  489. 14:36music so we can say local background
  490. 14:38music equals sound service wait for
  491. 14:41child background music and now when our
  492. 14:44game starts up we actually want to play
  493. 14:45the background music so we're gonna add
  494. 14:47that right down here we're gonna say
  495. 14:49background music play so that it begins
  496. 14:51playing the music and now just so i
  497. 14:52could quickly test this out and show you
  498. 14:54guys that this works let's go inside of
  499. 14:56our manager and just require this script
  500. 14:58real quick so we're going to say local
  501. 15:00handler equals require script dot parent
  502. 15:05dot handler and now that will require
  503. 15:07the module script meaning that the
  504. 15:08module script will run through so let's
  505. 15:09go ahead start per game and make sure
  506. 15:11that the background music does play okay
  507. 15:13so we can now hear the background music
  508. 15:14playing it is a really weird music i'm
  509. 15:16not gonna lie but it is playing so
  510. 15:18that's good the next thing we need to do
  511. 15:19is we need to actually get the settings
  512. 15:21config file that we made earlier we
  513. 15:23already did this inside of our manager
  514. 15:25script so what we're going to do is
  515. 15:26we're just going to copy and paste
  516. 15:27exactly how we already did it so we just
  517. 15:29need to get the settings variable and
  518. 15:31the replicated storage and there we go
  519. 15:33we now have the settings config module
  520. 15:35let's go ahead and create a function
  521. 15:36inside of this module which is going to
  522. 15:38be a public function so we're going to
  523. 15:39say module dot music and this will
  524. 15:42control the music setting so what we
  525. 15:44want to do is let's just say for example
  526. 15:46just to build this out we're going to
  527. 15:47say if true then and then of course if
  528. 15:49the setting is true we want to play the
  529. 15:52music so we're going to say play
  530. 15:53otherwise we want to pause the song so
  531. 15:56if we set the setting to true we want to
  532. 15:58play if we set the false then we want it
  533. 15:59to stop or pause now the thing is is
  534. 16:01that we could call this function but we
  535. 16:03need to figure out what the value of
  536. 16:06what enabled is for the music set and
  537. 16:08since this is an array and it's not
  538. 16:10actually a dictionary we can't index
  539. 16:11this table with the id so we can't say
  540. 16:14something like if
  541. 16:15settings.music because that music
  542. 16:18doesn't actually exist so we need to
  543. 16:20make a specific function to do this so
  544. 16:22let's create a new function and this is
  545. 16:23going to be called get
  546. 16:24setting
  547. 16:25by id and it's going to accept id which
  548. 16:28is a string so we want to do is
  549. 16:30similarly to how we loop through the
  550. 16:32settings in our manager script we're
  551. 16:34going to loop through them the exact
  552. 16:35same way so we're going to say for
  553. 16:37underscore because we're not using the
  554. 16:39index setting table in pairs settings do
  555. 16:42then we're going to do is we're going to
  556. 16:43say if the setting table dot id equals
  557. 16:47the id that we passed through then we
  558. 16:49just want to return the setting table so
  559. 16:50back inside of the music method what
  560. 16:52we're going to do is we're going to say
  561. 16:53local info equals get setting by id and
  562. 16:57we're going to pass through music and
  563. 16:58now inside of our if statement instead
  564. 17:00of saying if true we're going to say if
  565. 17:02info dot
  566. 17:03then and we're going to say play or
  567. 17:05pause based on whatever that value is
  568. 17:07additionally whenever we call this
  569. 17:09method let's go ahead and print out the
  570. 17:11info.enable just so we can visually see
  571. 17:13this as well now back inside of our
  572. 17:15manager we already required the script
  573. 17:17so we have the handler right there what
  574. 17:19we then want to do is whenever we click
  575. 17:20this button we want to actually call one
  576. 17:22of those specific methods now this is
  577. 17:24something that's pretty cool that we
  578. 17:25haven't gone over in this series and it
  579. 17:27might be a little confusing at first but
  580. 17:29you'll understand it and get used to it
  581. 17:30eventually we want to specifically
  582. 17:32remember the id of the specific setting
  583. 17:34and make sure that any function we
  584. 17:35create inside of this module script is
  585. 17:38named the exact same way that we have
  586. 17:41the id so for pop-up effects what we
  587. 17:43would do is we would say let's just copy
  588. 17:45this for example just so i could show
  589. 17:47you this we're going to say module dot
  590. 17:49pop-up underscore effects and make sure
  591. 17:51it is exactly the same way as the id and
  592. 17:54you're going to see why we want to do
  593. 17:55that in a sec so back inside of the
  594. 17:57manager whenever we click this button
  595. 17:58what we want to do is we want to call
  596. 18:00the handler and then we're going to
  597. 18:01index this like we would index a table
  598. 18:04and we're going to say setting dot id
  599. 18:06and then we want to use parentheses and
  600. 18:08what this is going to do is it's going
  601. 18:09to be similar to indexing a table so if
  602. 18:11we look inside the module script if we
  603. 18:13had a variable inside of here called
  604. 18:15module.music and let's just set that to
  605. 18:1710 and we also set this to a variable
  606. 18:19for example right so local test equals
  607. 18:21this helper and then the setting id
  608. 18:24would actually index to this specific
  609. 18:26variable right here because module.music
  610. 18:29equals 10 and we're just saying that we
  611. 18:30pass through music in this generate
  612. 18:32setting for example now we don't want it
  613. 18:34to index a variable we want it to
  614. 18:35actually index and call a specific
  615. 18:37function the way that we do this is by
  616. 18:39saying handler and then the setting.id
  617. 18:41and then we just need to add parentheses
  618. 18:43to the end of this and then that is how
  619. 18:45we will call a specific function
  620. 18:47additionally we'll delete this variable
  621. 18:49that we created right there just for me
  622. 18:50to show you guys whenever we interact
  623. 18:52with the music setting it will directly
  624. 18:54call this function right here which is
  625. 18:55why we need to add the parenthesis so
  626. 18:57that we're letting this know it is a
  627. 18:59function call so what we can do is we
  628. 19:00can go ahead and test this by starting
  629. 19:02your game let's open up the settings we
  630. 19:03can hear the music playing in the
  631. 19:04background currently now if we hit off
  632. 19:06we can see that false is printed to the
  633. 19:08console which means that the setting is
  634. 19:09now equal to false and we can hear the
  635. 19:11music is no longer playing then if we
  636. 19:13click the button again we can see it's
  637. 19:14set back to true and the music resumes
  638. 19:16playing so that setting works exactly as
  639. 19:18it should now if you click any of these
  640. 19:20other ones you're going to get an error
  641. 19:21because we don't actually have those
  642. 19:22functions created so with that being
  643. 19:24said ladies and gentlemen that's gonna
  644. 19:25be it for this episode hopefully you
  645. 19:26guys did enjoy and hopefully it did help
  646. 19:27you guys out as always if it did make
  647. 19:29sure you smash like button also hit the
  648. 19:30subscribe button and turn this post
  649. 19:32notifications on if you want to get
  650. 19:33notified when i upload more roblox
  651. 19:34development content additionally i do
  652. 19:36with patreon if you'd like to support me
  653. 19:37and to gain access to all the scripts
  654. 19:39and the game file that i made during
  655. 19:40this episode there's a link down below
  656. 19:41in the description and you guys can go
  657. 19:42and check that out with that being said
  658. 19:44i hope that you guys have a great day
  659. 19:45and i'll see you guys in the next
  660. 19:46episode

About this transcript

This page contains the full transcript of Scripting the Settings Gui! Roblox Studio Simulator Guide Episode 20 by MonzterDEV, generated from the public captions YouTube serves with the video. The transcript has 4,912 words across 660 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.