YouTube2Text

Badges - Roblox Advanced Scripting #19 — Transcript

by BrawlDev · 4,720 words · 615 segments · language en · Watch on YouTube

Full transcript

  1. 0:00damn this Obby looks pretty difficult
  2. 0:02I'm gonna see if I can do
  3. 0:05it uh
  4. 0:07oh
  5. 0:11no yes I did it oh it looks like I got a
  6. 0:15badge for it too yeah boy I did the Obby
  7. 0:19I can now Flex to my friends about
  8. 0:22this
  9. 0:24uh nah I am not doing that do you see
  10. 0:28how long that goes I am done here I
  11. 0:31can't believe this all right let's think
  12. 0:33about what we just saw for a minute when
  13. 0:35I finished this Obby now this was a very
  14. 0:37difficult Obby I will admit that once I
  15. 0:39ended up finishing this Obby then I
  16. 0:42touched this part and when I touched
  17. 0:43this part it showed this little
  18. 0:45notification down here in the bottom
  19. 0:46right of my screen showing that I got a
  20. 0:48new badge now if you're unfamiliar with
  21. 0:51badges essentially they are achievements
  22. 0:54that you can obtain in a Roblox game if
  23. 0:56the developer decides to add them uh and
  24. 0:59when you obtain the these badges they
  25. 1:00can appear on your profile to show that
  26. 1:03you have earned these badges within a
  27. 1:06specific game on Roblox so that's what
  28. 1:09I'm going to be showing you how to do
  29. 1:10inside of this video I'm going to be
  30. 1:11showing you the scripting aspect of
  31. 1:13implementing these badges in your Roblox
  32. 1:15game so with that being said let's go
  33. 1:17straight into implementing badges inside
  34. 1:19of Roblox studio now that we understand
  35. 1:21it let's start implementing badges in
  36. 1:23our Roblox game but before we can do
  37. 1:25that we need to make sure that we are in
  38. 1:28Roblox Studio on a published game so we
  39. 1:32can't be working on this on a local file
  40. 1:34because badges can only be created on a
  41. 1:36published Roblox game and uh if you
  42. 1:38don't remember how to do that we
  43. 1:40basically just go to the top left hit
  44. 1:41file and then we hit publish to Roblox
  45. 1:44as and then if you need to create a new
  46. 1:46place or overwrite an already existing
  47. 1:48one then you can do that but I'm already
  48. 1:50in a published place so I don't need to
  49. 1:52do that uh so once you have that taken
  50. 1:54care of next what we're going to do is
  51. 1:56start creating our badges for our game
  52. 1:59one one place that we can create these
  53. 2:01badges is within our game settings so if
  54. 2:03we go to home and then click on game
  55. 2:05settings if we go down to monetization
  56. 2:08then there should be a badges section
  57. 2:11inside of here uh ignore this badge
  58. 2:13that's over here but basically we can
  59. 2:15create a new badge clicking this create
  60. 2:17button next to the badges text so if we
  61. 2:19click on this then what should happen is
  62. 2:21that we should be redirected to our
  63. 2:23creator dashboard but in order to create
  64. 2:26our badges we need to locate our game
  65. 2:29inside of our creation inside of our
  66. 2:31creator dashboard so in this case my
  67. 2:33game is called Data store test one uh so
  68. 2:35in order to create a badge we need to
  69. 2:37click on the three dots that are on the
  70. 2:39top right and then click on create badge
  71. 2:42so now we're on this creating a badge
  72. 2:43page where we can upload an image for a
  73. 2:46badge we can make a name for it and a
  74. 2:47description now if we are creating a
  75. 2:50badge we need an image and we also need
  76. 2:53a name for it the description is
  77. 2:54optional and there is a note down here
  78. 2:56saying that the first five badges that
  79. 2:58are created are free but afterwards you
  80. 3:02have to pay a 100 Robux for any
  81. 3:03additional badges um if you decide to
  82. 3:06create more than five badges in your
  83. 3:08game but for the first five luckily
  84. 3:10they're free to add so uh you can add
  85. 3:12whatever image you want as long as the
  86. 3:14format is correct with one of these four
  87. 3:16uh it doesn't really matter what you do
  88. 3:18in this case so I'm just going to pick
  89. 3:19this one uh and then we can change the
  90. 3:21name of it too to let's say test badge
  91. 3:24one uh and then you can add in a
  92. 3:26description as well we could just say
  93. 3:29something like this is the test badge
  94. 3:32one okay so now that we have all this
  95. 3:34information filled out let's hit create
  96. 3:36badge so what should happen is within
  97. 3:39our badges section in our game our badge
  98. 3:42has been uploaded but our image is
  99. 3:44currently being under moderation right
  100. 3:46now so now that we have our badge we can
  101. 3:47go back into Roblox studio and we can
  102. 3:50hit the refresh button to see our badge
  103. 3:53displayed on our badges category so we
  104. 3:56have our badge here and that is how you
  105. 3:58create badges in Rob roblo studio now
  106. 4:00that we have the badge let's start
  107. 4:02scripting it and the first thing we're
  108. 4:04going to do is award this badge to the
  109. 4:07player if they all of a sudden decide to
  110. 4:09start joining into the game um we're
  111. 4:11going to be doing that by inserting a
  112. 4:13script inside of server script service
  113. 4:15so let's hit the plus sign let's insert
  114. 4:16a script now inside of our script we're
  115. 4:19going to need access to the badge
  116. 4:22service that will allow us to award our
  117. 4:24badge to the player so we're going to
  118. 4:27make reference to badge service by
  119. 4:29saying local badge service equals game
  120. 4:33colon get service badge
  121. 4:35service now here's something important
  122. 4:37to know about how do we know which badge
  123. 4:39we're trying to give to the player so
  124. 4:42whenever we're creating badges so
  125. 4:44whenever we're working with badges in
  126. 4:46order to know which badge is associated
  127. 4:48with what we have to refer to its badge
  128. 4:51ID and if you want to know where the
  129. 4:53badge ID of our newly created badge is
  130. 4:56we're going to go back to our game hit
  131. 4:58game settings go to monetization and
  132. 5:01with our badge we're going to hit the
  133. 5:02three dots that are to the right of it
  134. 5:04and we're going to click this button
  135. 5:06that says copy ID to clipboard so if you
  136. 5:09remember how assets work in Roblox
  137. 5:11basically the way you distinguish one
  138. 5:13asset from another one is by its asset
  139. 5:16ID but for badges they have their own
  140. 5:19set of IDs independent from other assets
  141. 5:22on Roblox so it basically works the same
  142. 5:24way here so we're just going to hit copy
  143. 5:26ID to clipboard we're going to close out
  144. 5:28of this and then go back to our script
  145. 5:30so let's make a variable to know that
  146. 5:32this is going to be our um badge ID so
  147. 5:35we're going to say local badge ID equals
  148. 5:38and then hit and then right click paste
  149. 5:42so this is our badge ID right here and
  150. 5:45it's this very big number right here but
  151. 5:47now that we have our badge ID let's make
  152. 5:48it so that we can award this badge to
  153. 5:50the player when they join into the game
  154. 5:52for the first time so we're going to do
  155. 5:53is drop two lines and then make a player
  156. 5:55added event so we're going to say game.
  157. 5:57players. player add added connect
  158. 6:00function open close parentheses passing
  159. 6:02in the player argument and so now we're
  160. 6:05going to immediately award the badge to
  161. 6:07the players since they joined into the
  162. 6:09game so we're going to say badge service
  163. 6:12colon award and this function takes in
  164. 6:16two arguments so the first one is going
  165. 6:17to be the user ID and the second one is
  166. 6:19going to be the badge ID which we've
  167. 6:21displayed up here in this variable so
  168. 6:23the first argument is going to be the
  169. 6:25player player. user ID and then then the
  170. 6:29second one's going to be the badge ID so
  171. 6:32this is a very basic implementation of
  172. 6:35awarding badges to the player when they
  173. 6:37join into the game Let's also add a
  174. 6:39task. weight before awarding the badge
  175. 6:41just so that we can give the server
  176. 6:43enough time for the player to join into
  177. 6:45the game so that we can see our badge
  178. 6:47being awarded on the bottom right so
  179. 6:49let's now join into the game and see our
  180. 6:52result all right so I'm in the game and
  181. 6:53after about a few seconds it should
  182. 6:55display right there saying that I have
  183. 6:57been awarded the test badge badge one
  184. 7:00because we joined into the game and we
  185. 7:02told badge service to award the badge to
  186. 7:04our player so that is basically how you
  187. 7:07award badges to the player in the most
  188. 7:09barebone basic way so since we've been
  189. 7:11awarded the badge we now have it but
  190. 7:14according to our script if we join back
  191. 7:16into the game then badge service will
  192. 7:19still then Roblox will still attempt to
  193. 7:21give the badge to our player despite us
  194. 7:23having the badge already we obviously
  195. 7:26don't want this to happen if we're
  196. 7:27already if we already obtained the badge
  197. 7:30so what we need to do is make a check to
  198. 7:32see if the player already has the badge
  199. 7:34and what we're going to do is use a
  200. 7:36function that Roblox has provided for us
  201. 7:39called user has badge async so the way
  202. 7:41this is going to work is we're basically
  203. 7:44going to write a variable by saying
  204. 7:46local has badge equals and then what
  205. 7:49we're going to do is say badge service
  206. 7:52colon user has badge async and this also
  207. 7:56takes in two arguments that are
  208. 7:57basically the same as down here the
  209. 7:59first first one is going to be the user
  210. 8:00ID and the second one is going to be the
  211. 8:02badge ID so we're going to say player.
  212. 8:05use user ID and then badge ID so this is
  213. 8:09going to return a Boolean to check
  214. 8:11whether the player has the badge or not
  215. 8:12and if the player does have the badge
  216. 8:14then we don't need to award the player
  217. 8:16but if they don't then we should award
  218. 8:19the badge to the player so we're going
  219. 8:21to say if not has badge so if the player
  220. 8:24does not have the badge then we're going
  221. 8:26to award the badge to theer player but
  222. 8:30let's say if we don't but let's say if
  223. 8:32the player already does then we can just
  224. 8:35print out saying player. name uh and
  225. 8:38then we can say already has the test
  226. 8:42badge and so this is basically how our
  227. 8:45script is looking now when it comes to
  228. 8:46checking whether the player has the
  229. 8:48badge or not so let's go and hit play
  230. 8:50again so now what should happen is we
  231. 8:52already have the badge so on the output
  232. 8:55it should say that the player already
  233. 8:57has the test badge as you can see down
  234. 8:58here it's not going to award it to us
  235. 9:00because we already have it so there's
  236. 9:02another thing we can do with Badges and
  237. 9:03that's obtaining information about a
  238. 9:06specific badge if we need it in our
  239. 9:08Roblox game so right now I'm back in the
  240. 9:10Creator Hub and I'm checking the
  241. 9:12overview of the badge that we just
  242. 9:13created so we have things like our name
  243. 9:16the image the description and whether
  244. 9:18you can obtain this badge or not with
  245. 9:20these four bits of information we can
  246. 9:22actually retrieve this information in
  247. 9:24Roblox studio if we need it within the
  248. 9:26game specifically this so with what I'm
  249. 9:29about to show you we're able to access
  250. 9:31the name of the badge the description of
  251. 9:33the badge uh whether you can obtain it
  252. 9:35or not and the ID of the image so not
  253. 9:39the ID of the badge but the ID of the
  254. 9:42image for the badge so with that being
  255. 9:44said let's go back into studio and
  256. 9:46implement this so now that we're here
  257. 9:48we're going to use a method that will
  258. 9:51give us a table full of the information
  259. 9:52that we need called get badge info async
  260. 9:56so this is what it's going to look like
  261. 9:57we're going to make another variable by
  262. 9:59saying local badge info equals badge
  263. 10:04service colon get badge info async and
  264. 10:09the only argument that this needs is the
  265. 10:12badge ID which we already have as a
  266. 10:14variable so we're going to say badge ID
  267. 10:16and this is going to return a table full
  268. 10:18of information that we're going to use
  269. 10:21um inside of Roblox studio so if we
  270. 10:23let's say decided to Loop through all
  271. 10:26the values inside of our badge info
  272. 10:29variable uh so let's just do this really
  273. 10:31quick by putting in badge info do and
  274. 10:35then print V if we just go into the game
  275. 10:39and uh see the if we just go into the
  276. 10:41game and see the output uh what should
  277. 10:44be down there is okay so we have true
  278. 10:48and then this massive number and then we
  279. 10:50have the name of our badge and then we
  280. 10:51have the description of the badge so you
  281. 10:53can kind of get what sort of information
  282. 10:55is in here because I explained this
  283. 10:56earlier uh we have the badge name we
  284. 10:59have the badge description we have
  285. 11:01whether this is active or not and we
  286. 11:03have the ID of the image itself so if we
  287. 11:07want to be more specific about getting
  288. 11:10which information we can use the
  289. 11:12properties that badge info has just by
  290. 11:14saying print badge info. name so that is
  291. 11:20basically fetching the name of the badge
  292. 11:22and then we have badge
  293. 11:24info. description which gives us the
  294. 11:27description obviously and then we have
  295. 11:29badge info. is enabled which is the
  296. 11:33third property that tells us whether you
  297. 11:35can actually obtain this badge and then
  298. 11:37finally the last one is called icon
  299. 11:40image ID so these are the four
  300. 11:43properties that badge info has for us to
  301. 11:45use in a Roblox game in case we do need
  302. 11:48this information from the badge itself
  303. 11:50so that is another neat thing we can do
  304. 11:52with these badges in our game Okay so
  305. 11:54we've basically went over everything
  306. 11:56badge service has to offer but if I'm a
  307. 11:59be honest we did a pretty sloppy job
  308. 12:00with adding all of these different
  309. 12:02features that badge service has to offer
  310. 12:04it works but it is pretty unsecure with
  311. 12:07the way we've been trying to implement
  312. 12:08uh these features in Roblox studio so
  313. 12:10what we're going to do is add PE calls
  314. 12:13to our scripts so if you've been
  315. 12:15following along with my Advanced
  316. 12:16scripting series you might be familiar
  317. 12:19with PE calls because I explained how to
  318. 12:21use them uh when we're working with data
  319. 12:23stores and the same principle basically
  320. 12:26applies here with badge service because
  321. 12:28we're using functions that could be
  322. 12:30interrupted by the network when we're
  323. 12:32trying to do something and there is a
  324. 12:34very high possibility that it might not
  325. 12:37go through with what we're trying to do
  326. 12:39whether that would be trying to whether
  327. 12:41that would be trying to figure out
  328. 12:42whether the player has a badge or
  329. 12:44whether we were able to award the badge
  330. 12:46properly or whether we were able to get
  331. 12:48information about a badge specifically
  332. 12:50if we aren't certain about whether this
  333. 12:52is going to go through or not we need to
  334. 12:54know why it doesn't go through so that's
  335. 12:56why we need to use PE calls but here's
  336. 12:58but here's another thing I haven't
  337. 13:00really explained the syntax of PE calls
  338. 13:03and the different ways you can write PE
  339. 13:05calls when using this you still might be
  340. 13:06confused about why a PE call is
  341. 13:09structured the way it is so there's two
  342. 13:11ways of writing PE calls and the reason
  343. 13:13I'm explaining this is because we're
  344. 13:14going to be using the second way of
  345. 13:16writing PE calls that I haven't showed
  346. 13:18you yet so before we Implement that I
  347. 13:19want to show you how this works so
  348. 13:21there's two ways of writing PE calls and
  349. 13:23I've showed you how to do the first one
  350. 13:25if you've been following my Advanced
  351. 13:26scripting tutorial series because I did
  352. 13:28this when I was teaching you how to do
  353. 13:30data stores but it looks something along
  354. 13:32the lines of this so if I have our
  355. 13:34success variable like this with our
  356. 13:37error message right here uh this is
  357. 13:40basically going to tell us that if the P
  358. 13:41call failed then we're going to print
  359. 13:43this message but if it was successful
  360. 13:45then we're going to know with this
  361. 13:46Boolean value we're going to set this
  362. 13:48equal to P call function open close
  363. 13:50parentheses enter so this is this has
  364. 13:53been the structure of our PE call but
  365. 13:55now you might think why is it like this
  366. 13:58what's the significance of this syntax
  367. 14:01structure so I kind of want you to think
  368. 14:04of it like this if I let's say deleted
  369. 14:06these lines that are empty right
  370. 14:09here this is how you define a function
  371. 14:12so you have the function keyword uh with
  372. 14:15the open and close parenthesis and then
  373. 14:17you end it with an end statement and
  374. 14:18then between here is the the body of
  375. 14:21code so this is how you create a new
  376. 14:24function um and this is basically one
  377. 14:27argument in this PE call but then
  378. 14:30everything up until this point is any
  379. 14:32external argument that's going to be
  380. 14:34passed into these parameters that are
  381. 14:36inside of this function that you just
  382. 14:37created what I'm talking about is let's
  383. 14:40say I had a parameter in here called
  384. 14:42number one uh if I wanted to pass in a
  385. 14:45number that Associates with this
  386. 14:48parameter right here I'm going to pass
  387. 14:50it in after this function call right
  388. 14:52here so this can be whatever number I
  389. 14:54want it can be 100 so the first argument
  390. 14:57is going to be the function the second
  391. 14:59one is going to be any Associated
  392. 15:02arguments that are going to be passed
  393. 15:04into these parameters right here and so
  394. 15:06if I basically drop a line down here
  395. 15:08with the function this is basically what
  396. 15:11we had before with our PE call but this
  397. 15:13time we're adding in a parameter with an
  398. 15:17argument associated with it and this is
  399. 15:19how you structure the first PE call so
  400. 15:22if I let's say printed number one then
  401. 15:25what's going to happen is if I hit run
  402. 15:26inside of rope blocks then in the output
  403. 15:29it should print the number 100 because
  404. 15:31we were successfully able to know
  405. 15:33whether we were able to have this go
  406. 15:36through successfully or not and so this
  407. 15:37is one way of structuring PE calls and I
  408. 15:39hope that made sense to you okay but now
  409. 15:41I'm going to show you the second way of
  410. 15:42writing a PE call so this one takes in
  411. 15:45two required functions on top of any
  412. 15:48additional arguments that you want to
  413. 15:49put so for for our first example we only
  414. 15:52put in one required argument which was
  415. 15:55our function that we just created but
  416. 15:57this time if we let's say wanted to use
  417. 16:00a method from a specific class that
  418. 16:03Roblox has to offer which in this case
  419. 16:06we're going to be using a method from
  420. 16:07badge service we're going to need to
  421. 16:09specify which service we're trying to uh
  422. 16:12use and which method from that service
  423. 16:14we're trying to use so this is what it's
  424. 16:17going to look like we're going to have
  425. 16:19our same signature which is going to be
  426. 16:20local success error message we're going
  427. 16:24to set this equal to P call again but
  428. 16:25this time this is going to take in two
  429. 16:27parameters so the first one is going to
  430. 16:30be the the method of the class that
  431. 16:32we're trying to uh use rather than our
  432. 16:35own function that we're trying to create
  433. 16:37so so we're trying to use an existing
  434. 16:39function we're going to say badge
  435. 16:42service colon Award badge let's say in
  436. 16:46this case we're not going to put in any
  437. 16:47open and close parentheses we're just
  438. 16:49going to have it like this and then our
  439. 16:51second argument is going to be the
  440. 16:52instance also known as the service
  441. 16:55itself that we're going to pass in so
  442. 16:57it's going to just be badg service we're
  443. 16:58going to pass in badge service and then
  444. 17:02the rest are just additional arguments
  445. 17:04that we need to pass in but in this case
  446. 17:06we actually do need to pass in two
  447. 17:08arguments because we're trying to pass
  448. 17:11them into our Award badge method which
  449. 17:14if you remember Award badge takes in two
  450. 17:16arguments which the first one is the
  451. 17:18user ID and the second one is the badge
  452. 17:20ID so in this case we have to pass in
  453. 17:22our two parameters which is going to be
  454. 17:24the player. user ID but the thing is uh
  455. 17:27we're not inside of our uh player added
  456. 17:30event so we're actually going to copy
  457. 17:31this and we're going to paste this down
  458. 17:33here so that's going to take in our
  459. 17:36first argument the second one is going
  460. 17:37to be the badge ID because when we call
  461. 17:40Award badge we need to pass in the two
  462. 17:44arguments that need to be inside of a
  463. 17:46word badge which the first one's going
  464. 17:47to be the user ID and the second one is
  465. 17:48going to be the badge ID and the second
  466. 17:50argument is just going to be the
  467. 17:52instance of the method that we're trying
  468. 17:54to use okay so instead of using a colon
  469. 17:56we're actually going to use a DOT
  470. 17:57because award word badge in this case
  471. 18:00we're just trying to get the method of
  472. 18:01the service we're not trying to call it
  473. 18:03because if we were to try and call it we
  474. 18:04would use the colon with the open close
  475. 18:07parentheses like this but we're not
  476. 18:08going to do it like this uh we just need
  477. 18:10the method itself so that's why we're
  478. 18:12going to use a DOT and this is
  479. 18:14essentially the second way of how you
  480. 18:17write PE calls and I hope this analogy
  481. 18:19made sense to you okay but now let's go
  482. 18:21back and fix our already existing script
  483. 18:24to add PE calls to make it more safe so
  484. 18:26I'm going to block out uh this comment
  485. 18:29that I have down here and what we're
  486. 18:30going to do is copy what we had for our
  487. 18:33Award badge PE call and we're going to
  488. 18:36put this up here so we're going to paste
  489. 18:37it over here and we should have a
  490. 18:39success to tell us whether uh Award
  491. 18:42badge has been successful and so just to
  492. 18:44make this a little easier we're going to
  493. 18:46comment out everything we've had here up
  494. 18:48until this point so what let's say this
  495. 18:51did not go through let's check if this
  496. 18:53was not successful for awarding the
  497. 18:56badge to the player then what we're
  498. 18:57going to do is print out the error
  499. 19:00message so this is a more secure way of
  500. 19:04awarding the badge to the player just so
  501. 19:06that we know that it is possible just so
  502. 19:09that we know that it is possible to get
  503. 19:11errors when it comes to awarding uh the
  504. 19:13badge to the player so this is how you
  505. 19:15do it in a more secure way okay but now
  506. 19:17let's say we wanted to further improve
  507. 19:19on this by checking whether the player
  508. 19:21already has the badge or not so what
  509. 19:22we're going to do is say local has badge
  510. 19:27error message equals success has badge
  511. 19:33equals P call open and close parentheses
  512. 19:36what we're going to do is use the user
  513. 19:39has async user has badge async that we
  514. 19:42had down here uh as our first argument
  515. 19:44so we're just going to say badge
  516. 19:46service. user has badge async and then
  517. 19:51our second argument is going to be badge
  518. 19:53service itself and then we're going to
  519. 19:56pass in our two arguments that are
  520. 19:57required re ired for user has badge
  521. 19:59async which is going to be the player.
  522. 20:02user ID and then finally the badge ID
  523. 20:05and so now that we have that let's check
  524. 20:07if this wasn't successful so we're going
  525. 20:09to say if not success then we're just
  526. 20:12going to print out some error message
  527. 20:14saying that uh that we failed to get the
  528. 20:18that we failed to check if the player
  529. 20:19has the badge so we're going to say
  530. 20:21failed to check if player has badge okay
  531. 20:26and then what we're going to do is drop
  532. 20:28down here and say if has badge so if the
  533. 20:31player actually does have badge since
  534. 20:32user has badge async will return whether
  535. 20:35um the user has the badge or not we're
  536. 20:36going to take our original P call with
  537. 20:39awarding the badge and we're going to
  538. 20:41put this inside of our has badge if
  539. 20:43statement so already now what we've done
  540. 20:46is checked if the player has the badge
  541. 20:48or not in a more successful way and if
  542. 20:50they do then we're going to securely
  543. 20:53award the badge to them and finally
  544. 20:55we're going to get the badge info in a
  545. 20:57more secured way and this is what we're
  546. 20:58actually going to do to check whether we
  547. 21:00can actually award this badge or not so
  548. 21:03here's what we're going to do at the
  549. 21:04very beginning we're going to get the
  550. 21:06badge information so we're going to say
  551. 21:08local success to check whether this was
  552. 21:10successful again but then this time
  553. 21:12we're going to say badge info equals P
  554. 21:15call open close parenthesis we're going
  555. 21:17to write our P call the second way just
  556. 21:19like uh we've done every other time so
  557. 21:21we're going to say badge
  558. 21:23service. get badge info async and then
  559. 21:28then our second argument is just going
  560. 21:29to be badge service again and then this
  561. 21:31time badge get badge info async only
  562. 21:34takes in one argument which is just the
  563. 21:36badge ID so that's what we're going to
  564. 21:37put down here so what we're going to do
  565. 21:39is we can check whether this was
  566. 21:40successful or not successful but in this
  567. 21:42case what we're going to do is check if
  568. 21:44this was not successful then we're going
  569. 21:46to say if not success then we're going
  570. 21:50to print failed to get badge
  571. 21:54information okay and so now that we have
  572. 21:56this check for whether whether we
  573. 21:58weren't able to obtain the badge and
  574. 22:00this check whether the player already
  575. 22:01has the badge now we can finally go down
  576. 22:04here to actually award the badge to the
  577. 22:05player now here's another thing we can
  578. 22:08do to make sure that we can actually add
  579. 22:11that we can actually award the player
  580. 22:13the badge now that we have our badge
  581. 22:15info is if you remember we can check
  582. 22:17whether this badge is enabled so we can
  583. 22:20actually make that check down here
  584. 22:21before we award the badge to the player
  585. 22:23so what we're going to do is we're going
  586. 22:25to say if has badge and
  587. 22:28badge info. is enabled then we're going
  588. 22:32to attempt to award the badge to the
  589. 22:35player and so finally we've reached the
  590. 22:37end of our script in the most secure way
  591. 22:40possible at least to the way that I see
  592. 22:42it so this has basically been adding
  593. 22:44badges in Roblox Studio but of course
  594. 22:47you can experiment around with this and
  595. 22:49try to add even more badges if you were
  596. 22:51to loop loop all these around in a table
  597. 22:54uh to try and award specific badges to
  598. 22:56specific players if you decide to do so
  599. 22:58this is generally the way that we script
  600. 23:00badges in Roblox studio and I want you
  601. 23:02to get into the practice of writing
  602. 23:04these PE calls to make them more secure
  603. 23:06when you're trying to add them so that
  604. 23:08is basically going to be it for Badges
  605. 23:09and I hope you found this video to be
  606. 23:11helpful if you're still confused about
  607. 23:12peac calls I have another video where I
  608. 23:15go into PE calls in my data store video
  609. 23:17which I'm going to have a link for you
  610. 23:19right here to watch if you're interested
  611. 23:21but with that being said be sure to
  612. 23:22check out the rest of my playlist for my
  613. 23:23Advanced scripting tutorial guide and I
  614. 23:25will be seeing you in the next episode
  615. 23:28take care

About this transcript

This page contains the full transcript of Badges - Roblox Advanced Scripting #19 by BrawlDev, generated from the public captions YouTube serves with the video. The transcript has 4,720 words across 615 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.