YouTube2Text

[Part8] Roblox Combat System for Beginners | Console/Mobile & More Effects — Transcript

by Senko · 6,948 words · 1,097 segments · language en · Watch on YouTube

Full transcript

  1. 0:01All right. So, this is going to be sort
  2. 0:02of a little introduction to episode 8,
  3. 0:06which is just going to go over a little
  4. 0:09few fixes of the game, as well as adding
  5. 0:11some more effects to it. For example, in
  6. 0:14this video, we just added some weapon
  7. 0:15trails and sprinting and dashing effects
  8. 0:18to the game, as well as some sounds for
  9. 0:21the dashing. And the main focus of the
  10. 0:23video entirely is on adding controller
  11. 0:25and mobile compatibility.
  12. 0:28And yeah, so for a little showcase, if
  13. 0:31we join the game and let me go ahead and
  14. 0:34disable my controller real
  15. 0:36quick and let's go ahead and equip our
  16. 0:41weapons. You notice that first thing we
  17. 0:43have is new dashing sounds like
  18. 0:46so. And dashing effects. Next thing we
  19. 0:49added is sword trails, which if you
  20. 0:51equip your sword, you have a sword
  21. 0:53trail. If you equip this, you have
  22. 0:55nothing. And dagger works. as well as a
  23. 0:58second trail. So you see a red trail on
  24. 1:01the dagger as well as a red trail on the
  25. 1:06sword. And now let me demonstrate for
  26. 1:09y'all controller. So if I hook up my
  27. 1:11controller like
  28. 1:14so. And let's go ahead and wait a little
  29. 1:16bit. You'll see that.
  30. 1:19Okay. And if we go ahead and equipped,
  31. 1:22let's say our sword and we hold it
  32. 1:24button X, you notice that the attacking
  33. 1:28works as well as holding block. And
  34. 1:31yeah, same with dashing. Dashing is our
  35. 1:32L3, which is the middle joystick. And it
  36. 1:36works like so. And another thing I want
  37. 1:38to note is we made it to where for
  38. 1:41dashing on mobile or no, sprinting on
  39. 1:43mobile and controller is automatically
  40. 1:46enabled.
  41. 1:48So, let me disconnect my controller now
  42. 1:51and switch over to mobile, which you can
  43. 1:53do so with the emulator. So, we'll do
  44. 1:56mobile iPhone XR. And if we play the
  45. 1:59game and give ourselves a sword, you
  46. 2:02notice that sprinting is also enabled
  47. 2:04and M1
  48. 2:06works. And blocking also works like
  49. 2:10so. And dashing, obviously, you can
  50. 2:15dash. So yeah, that's pretty much going
  51. 2:18to be the video. Please leave a like,
  52. 2:21comment, and
  53. 2:22subscribe. And thank you for watching
  54. 2:24the series so far. It's been it's been
  55. 2:28great. And the next episode is going to
  56. 2:30be the finale and the series ending,
  57. 2:32which is is going to go over all of the
  58. 2:35combat system in general, explaining
  59. 2:37things more in depth. So yeah, thank you
  60. 2:39for watching. The first thing I want to
  61. 2:41address is the can block function that
  62. 2:45we used uh
  63. 2:47to either destroy or allow you to
  64. 2:50sprint. This can be this is confusing
  65. 2:53especially for me too cuz rather than
  66. 2:55having a cam block function, we honestly
  67. 2:57should just have something called a can
  68. 2:59sprint function cuz we have can dash cam
  69. 3:02block. So it's obvious that we should
  70. 3:03also have can sprint. So we're going to
  71. 3:05add that in. So if state service check
  72. 3:09state character comma
  73. 3:12stunned or blocking
  74. 3:15attacking no sprint no
  75. 3:19move
  76. 3:22dashing dash cool
  77. 3:24down then return false otherwise you
  78. 3:27want to return true. So now if you go
  79. 3:29back to can block we can say if status
  80. 3:31folder find sh sprinting if not can
  81. 3:34sprint then status folder sprinting
  82. 3:37destroy like so and then we can just
  83. 3:40remove this.
  84. 3:43Now if we go over here to where we
  85. 3:45actually uh want to start sprinting we
  86. 3:47can say if can sprint then do
  87. 3:51this and we just get rid of
  88. 3:54this and over here. Yep, that should be
  89. 3:58good. So, we test the game. We should be
  90. 4:01able to sprint with a new. Okay, we have
  91. 4:05an error. Let's
  92. 4:06see. Error
  93. 4:09parsing. Let's see what the issue is.
  94. 4:12Oh, right here. Forgot an end right here
  95. 4:15because we need to end the if not can
  96. 4:17sprint part. And let's see. So, start
  97. 4:21sprinting and we stop. And yep, there we
  98. 4:25go.
  99. 4:28Obviously, if you dash, there's a bit of
  100. 4:30an end lag before you can sprint again.
  101. 4:31Like
  102. 4:35so. And
  103. 4:38yeah. All right. Next up, we want to uh
  104. 4:42make it to where you can dash a little
  105. 4:44bit further because if we play the game,
  106. 4:46you'll see that the dashing is a little
  107. 4:48bit too short. Like you're barely moving
  108. 4:51at all when you dash. So, we'll add that
  109. 4:54in.
  110. 4:56So right here you'll see that we have
  111. 4:57the body velocity.
  112. 4:59So there's one of two ways we can do
  113. 5:01this. We can either increase our dashing
  114. 5:04length or we can increase the velocity
  115. 5:07that we're dashing by. So in this case
  116. 5:10we'll just increase the velocity because
  117. 5:13if we increase the dashing length then
  118. 5:14that means we'll also have to increase
  119. 5:15the end lag for it to be proportioned to
  120. 5:17it.
  121. 5:19So we will just go over here and change
  122. 5:22this to maybe 70 and 70 across the
  123. 5:26board. And another thing I want to note
  124. 5:29is dash cool down which is 1.5. We need
  125. 5:32to go up here and remove that from the
  126. 5:34sprinting thing
  127. 5:37because we don't want the player to not
  128. 5:39be able to sprint if there's a cool
  129. 5:40down. That's that's kind of stupid. And
  130. 5:43now we should be able to dash further
  131. 5:45because we increased it from 50 to 70.
  132. 5:48So there we go. You hit dash further
  133. 5:50now. So obviously you can sort of adjust
  134. 5:54this based on how you want your game to
  135. 5:55be. But in this case, we'll just make it
  136. 5:5870. Once again, value changing aspect of
  137. 6:01Roblox. You can just change this to 50,
  138. 6:0360, 40 if you so desire to. And yeah,
  139. 6:08that's going to be that part.
  140. 6:10And now we're going to go on to adding
  141. 6:14weapon trails to our um
  142. 6:19weapons. So first off, let's do it for
  143. 6:22sword. So we can move our sword equipped
  144. 6:24into workspace to actually edit
  145. 6:27it. So for these weapon trails, we're
  146. 6:30going to make two trails. One is going
  147. 6:32to be for sprinting and one is going to
  148. 6:34be for our attacking.
  149. 6:37So in our
  150. 6:40in our sword equipped right here. We can
  151. 6:43add a trail called
  152. 6:47uh sprint trail like so. And you'll
  153. 6:50notice that trails have an have a
  154. 6:53property called attachment O and
  155. 6:55attachment one. So a brief overview of
  156. 6:58what trails do is that there's always a
  157. 7:00start point and an end point. So in this
  158. 7:03case we'll add
  159. 7:05a attachment to the
  160. 7:09blade and we can just call this
  161. 7:11attachment one or attachment O. An
  162. 7:13important thing to note is that
  163. 7:15attachments always need to be parented
  164. 7:17to a base part or some type of part. For
  165. 7:20example, you can't just parent it to a
  166. 7:21model like so. It won't
  167. 7:24work. But you can parent it to anything
  168. 7:26else. So, we'll just print the blade
  169. 7:29back. And we will move this to the start
  170. 7:31point, which is going to be around right
  171. 7:33here on our blade where we want our
  172. 7:36sprint
  173. 7:39sh around here. And we want to duplicate
  174. 7:42it to the end of the sword. So, around
  175. 7:45right here to the tip of the blade. And
  176. 7:47we call this attachment
  177. 7:49one. Naming these doesn't have an effect
  178. 7:52on the trail. It's just for us to know
  179. 7:54which attachment is what. So example, we
  180. 7:56can call this a start point and we call
  181. 7:57this end point. It doesn't really
  182. 7:59matter. So we can set attachment O to
  183. 8:02the start point and attachment one to
  184. 8:04the end point. And now if you move the
  185. 8:07sword around, you see that there's a
  186. 8:08trail following it like so. So we will
  187. 8:12want to edit the lifetime of this to
  188. 8:14around.3. And we want to make the
  189. 8:17transparency start at around 6 and then
  190. 8:19go to one. So it fades out. So now if we
  191. 8:23move it, you'll see that it has sort of
  192. 8:25like a fade out stroke.
  193. 8:28So I'm going to make this a bit more
  194. 8:29transparent. So we can change this to
  195. 8:31around 75.
  196. 8:34Now if you move it around, you see that
  197. 8:36it's more
  198. 8:38transparent. So we'll disable our sprint
  199. 8:40trail and we will parent it back to
  200. 8:43sword.
  201. 8:45Similarly, we will go over here to our
  202. 8:47dagger and go to dagger
  203. 8:49equipped and we will add in the dagger
  204. 8:52spin row. So, if we print it to our
  205. 8:55primary part and let's go ahead and
  206. 8:59reset the
  207. 9:01uh the origin of these to 00 which is
  208. 9:04the center of the blade and start point
  209. 9:07is going to be around right
  210. 9:10here. Oops.
  211. 9:16It's going to be down right
  212. 9:18here. And our end point is going to be
  213. 9:21across over here a little bit. And up
  214. 9:24like so. And now we can just duplicate
  215. 9:27our trail that we have in
  216. 9:29blade or right here. Where did I put it?
  217. 9:32Right here in the model. And we can just
  218. 9:36parent it to
  219. 9:38our D encrypted model. And we'll just
  220. 9:40change the values. So, we change this
  221. 9:42start point.
  222. 9:44Oops. Start point and end point. Now, if
  223. 9:48you move it, oh, we've enabled it first.
  224. 9:51So, now if we enable it, you know how
  225. 9:54the trail works. So, let's disable it
  226. 9:57and let's move this back into our dagger
  227. 10:01folder. Now, we can actually start
  228. 10:03working on the sprint trail now. So if
  229. 10:06we scroll down here and we find
  230. 10:08something called status
  231. 10:10folder find first child sprint scene.
  232. 10:15All right. So in here now we can
  233. 10:17actually add in the trails. So we can
  234. 10:19say add in the trails up
  235. 10:23here or instead of that we can just go
  236. 10:26down here to after animations and we can
  237. 10:28say
  238. 10:29uh enabling disabling sprint trails.
  239. 10:32Make it a comment like so. So we're
  240. 10:34going say if status folder find out
  241. 10:36sprinting then
  242. 10:38else. So now we can loop through our
  243. 10:41character
  244. 10:44underscore,
  245. 10:46trail question mark and character get
  246. 10:49ascends to a trail is a trail and
  247. 10:52trail.name is equal
  248. 10:55to whatever the trail is called which is
  249. 10:58sprint
  250. 10:59trail. Then we want to enable it. Enable
  251. 11:03it equals true. So the reason we say
  252. 11:05trail question mark is because of
  253. 11:07annotating which I mentioned a lot in
  254. 11:09the other videos. But this question mark
  255. 11:11over here is indicating that we're not
  256. 11:14sure if all the descendants are a trail
  257. 11:17but we still want to be able to use all
  258. 11:19the functions and methods that trail
  259. 11:21is. So that's that. And we enable the
  260. 11:25trail otherwise we just disable it. So
  261. 11:27we'll say disable trail like so.
  262. 11:30So now if we play the game, you notice
  263. 11:33that we don't have any trail right now.
  264. 11:34And if we go over here and equipped our
  265. 11:37weapons,
  266. 11:39wait, what's going on? Oh, okay. First
  267. 11:42thing we also want to do is we want to
  268. 11:44check for our weapon cuz obviously if
  269. 11:47we're sprinting then the trail should be
  270. 11:49enabled, but we also want to check if
  271. 11:51our weapon's equipped. So, we're going
  272. 11:53to say local weapon
  273. 11:56equals character find child, which is a
  274. 11:59weapon or not weapon, my bad, a
  275. 12:02tool. So, if weapon, then we can loop
  276. 12:07through the uh the tool, the weapon. So,
  277. 12:11we can get rid of this and we can loop
  278. 12:13through the weapon.
  279. 12:16And another extra sanity check we can do
  280. 12:18is we can say and weapon data module.get
  281. 12:22weapon data weapon.name like so. And
  282. 12:25we'll just go ahead and put that out
  283. 12:27here. So local weapon equals character
  284. 12:29shot as a
  285. 12:30tool. If weapon and weapon data
  286. 12:34get
  287. 12:36weapon.name then like so. And we can
  288. 12:39just copy and paste this in here. And
  289. 12:42we'll remove these lines.
  290. 12:46And we will format the
  291. 12:47script. And instead of character get
  292. 12:49ascendants, we will now do get a
  293. 12:50sentence for the weapon. And over here
  294. 12:53we can also do the same. And that should
  295. 12:55be
  296. 12:57good. So now if we play the game and we
  297. 13:01equipped our weapons, you notice how the
  298. 13:02sprint show is disabled. But if we equip
  299. 13:04our
  300. 13:05sword, oh, let's
  301. 13:07see. Let's go to our character. Let's
  302. 13:13see if weapon and weapon
  303. 13:19data if trail is a
  304. 13:22trail. Let's see. Oh, right. Our weapon
  305. 13:26model isn't parented to the weapon, but
  306. 13:28it's parented to the character. So, we
  307. 13:30just do a character get a
  308. 13:31descendence. Right. Now, if we play the
  309. 13:35game, you will see that our sword trail
  310. 13:38is out when we're sprinting and our
  311. 13:41dagger trails up. But another thing is
  312. 13:45that you'll see that it enables the
  313. 13:46trail for both the the katana and the
  314. 13:49dagger. And we only want the trail to be
  315. 13:52enabled for one.
  316. 13:54So what we want to do is we want to find
  317. 13:55the corresponding
  318. 13:58uh
  319. 14:01the corresponding models to the actual
  320. 14:03weapon name. So in here we can say we
  321. 14:06can add a value called
  322. 14:10uh weapon weapon name like so which is a
  323. 14:14string and we can call it stagger.
  324. 14:16Similarly, we can go over here and we
  325. 14:18can add a value called weapon name. And
  326. 14:20then we can call this uh
  327. 14:23sword. And then now we can just go ahead
  328. 14:26and loop through all of
  329. 14:29the the models in the character and
  330. 14:32check if it's if it has a value called
  331. 14:34weapon model and weapon name or an
  332. 14:36attribute. So we can say for underscore
  333. 14:39comma model
  334. 14:42uh model question mark and character get
  335. 14:45children do if model get attribute
  336. 14:48weapon model equals equals true and
  337. 14:52model get attribute weapon name equals
  338. 14:56our weapon.name then we can enable
  339. 15:00trails. So another thing important thing
  340. 15:02to note is that the weapon name needs to
  341. 15:04correspond to the actual name of the
  342. 15:06weapon or else this won't work. And we
  343. 15:09can say for underscore, trail. So we
  344. 15:11just copy and paste this
  345. 15:15uh in the model get a sentence to if
  346. 15:18it's a sprint trail then we want to
  347. 15:20enable it. Otherwise we want to disable
  348. 15:22it. So we'll enable it and then over
  349. 15:25here we'll just disable it.
  350. 15:29And over here, instead of looping
  351. 15:32through all these, just in case if any
  352. 15:34any trail called sprint trail is
  353. 15:36enabled, we want to disable it. So we
  354. 15:38just go over here and get rid of the
  355. 15:41weapon model loop. And we'll just go
  356. 15:42over here and do that. So character get
  357. 15:44descendants and we will disable all
  358. 15:47sprint trails in the
  359. 15:48character. Now, if you play the game,
  360. 15:52and we equipped our weapons, you'll
  361. 15:54notice that the sword trail is the only
  362. 15:55trail that's
  363. 15:57out. And let's see
  364. 16:01right over
  365. 16:04here. We will let's
  366. 16:08see. Oh, it's because we don't have a
  367. 16:10tool equipped.
  368. 16:13So, let's see. All right. Okay. So, we
  369. 16:16can just go over here and we
  370. 16:18can go outside of the weapon
  371. 16:23uh conditional and we can just disable
  372. 16:24all trails if we don't have a tool
  373. 16:26equipped like so.
  374. 16:29So now if we equipped when you equipped,
  375. 16:32you notice our chills disappear. And
  376. 16:34let's go ahead and equip our dagger too.
  377. 16:37Let's move our dagger to third. All
  378. 16:40right. So now if we equip our dagger,
  379. 16:42you notice the trails enabled.
  380. 16:44Unquipped. It's
  381. 16:47disabled. All right. And if we equip our
  382. 16:49sword, we dash. You see that the trail
  383. 16:52works. And this
  384. 16:56h let's see
  385. 17:04uh if model get attribute then
  386. 17:11okay so we can add another conditional
  387. 17:13here. So if model get attribute weapon
  388. 17:18name equals tool.name or weapon.name
  389. 17:21name then we can enable trails otherwise
  390. 17:24we want to loop through the model and
  391. 17:26disable all the trails else we want to
  392. 17:28disable the
  393. 17:30trails. So this might look like a lot
  394. 17:32but what we're saying is that if the
  395. 17:34model that we loop through which are
  396. 17:36these models have the weapon model
  397. 17:38attribute set to true then we'll check
  398. 17:41if the model's weapon name is our weapon
  399. 17:43name that we have equipped. If it does,
  400. 17:46then we'll enable all the sprint shells.
  401. 17:48But if it doesn't, then we'll disable
  402. 17:49all the sprint shells for the weapon
  403. 17:51model that's not equipped. So, play the
  404. 17:55game and equipped our
  405. 17:59weapons. And we can equip dagger, sword,
  406. 18:02and you see that now the trails don't
  407. 18:04actually overlap each other.
  408. 18:08So, all right. Now, we can work on
  409. 18:12adding
  410. 18:13uh attack controls.
  411. 18:16So,
  412. 18:18and here we can move our sword equip to
  413. 18:21the workspace and then we can duplicate
  414. 18:24this and we can call this
  415. 18:28attack like so.
  416. 18:31Then over here you can
  417. 18:34we can go over here to our blade deck.
  418. 18:37Or actually in this case we can just say
  419. 18:39that yeah we can just keep the start and
  420. 18:40end point the same because it's already
  421. 18:44set to this part or this point and this
  422. 18:46point. But in order to differentiate
  423. 18:49between the sprint attack trail, we'll
  424. 18:50change the trail color to a red color.
  425. 18:54We want able to see it work. So you see
  426. 18:56that. Okay, nice. It works.
  427. 18:59And also in here we can let's also make
  428. 19:03it bright. So we can set our light
  429. 19:04influence to zero and make this four to
  430. 19:06make it a bit brighter.
  431. 19:08Let's make this brighter a little bit.
  432. 19:10Set it to 10.
  433. 19:12All right. And then we can set the color
  434. 19:14to a really dark or deep red.
  435. 19:18There we go. And let's go ahead and
  436. 19:21disable our techro. And then we will
  437. 19:23move this into here back.
  438. 19:26Let's go ahead and copy and paste our
  439. 19:30attack trail into our dagger and set the
  440. 19:33attributes to start point and end point.
  441. 19:39Now if we go over here we can also check
  442. 19:42if we are attacking or not. So we say um
  443. 19:46enabling slashd disabling attack
  444. 19:50trolls. So say if status folder find
  445. 19:52first child attack that's hacking then
  446. 19:55we can do all this
  447. 19:58like
  448. 19:59so and we can go ahead and just copy and
  449. 20:03paste this code right here
  450. 20:07actually yeah we can just copy and paste
  451. 20:09that code and but instead of doing that
  452. 20:12we can let's
  453. 20:15see we can make a function so it doesn't
  454. 20:18look like a bunch of duplicated codes.
  455. 20:20So let's go over here and keep this
  456. 20:23conditional for now. And we can
  457. 20:25say local
  458. 20:28function. Let's put it down here a
  459. 20:30little bit. Local
  460. 20:34function enable or toggle trails. And we
  461. 20:37can say
  462. 20:38trail name as well as our
  463. 20:44[Music]
  464. 20:48um yeah I think that's fine. We can say
  465. 20:51yeah trail name and our boolean. So we
  466. 20:54want this to be a string and this the
  467. 20:57boolean to be boolean. And now we can
  468. 20:59say if trail
  469. 21:01name equals equals sprint trail
  470. 21:04then else if our trail name is equal to
  471. 21:07the attack trail then we want to do
  472. 21:09something different and let's go over
  473. 21:11here to our sprint trail and we can copy
  474. 21:14and paste this code right here.
  475. 21:19Let's go ahead and go in here.
  476. 21:24Copy and paste down here and we say
  477. 21:27local
  478. 21:32uh local finals that are status to check
  479. 21:35like so equals no and we can say if not
  480. 21:39status check then return end
  481. 21:42and here we can say status to check is
  482. 21:44equal to attacking status to check is
  483. 21:48equal to
  484. 21:52sprinting and then now we can go over
  485. 21:55here and say if satis folder. Find SH to
  486. 21:59check
  487. 22:00then and trail.name is equal to trail
  488. 22:05name trail name.
  489. 22:08And over here we can set this to bull
  490. 22:11and bull.
  491. 22:15And over here we can just disable all of
  492. 22:18the
  493. 22:21trails and trail.name name equals
  494. 22:25equals sprint trail or trail.name equals
  495. 22:28attack trail. Then we'll disable all
  496. 22:32the all the trails like so
  497. 22:38uh let's
  498. 22:40see and that should be good.
  499. 22:43So if we go over down here to our
  500. 22:45function, we can say toggle trail sprint
  501. 22:49trail and then we can say toggle trail
  502. 22:52attack trail like
  503. 22:54so. And we can say if says folder find
  504. 22:57sprinting then or no we don't need to do
  505. 23:02that. And over here we'll change we'll
  506. 23:06remove our boolean value and we'll just
  507. 23:08say true and false.
  508. 23:12All right. So, what these lines of code
  509. 23:14do is that if you see where we call the
  510. 23:17function, we just want to toggle the
  511. 23:21trails for the sprint and attack
  512. 23:24trail. And if we go up
  513. 23:26here, you'll see that okay, if we want
  514. 23:29to um either enable or disable the
  515. 23:31sprint trail, we want to check for the
  516. 23:32status code sprinting. And vice versa,
  517. 23:34if we have a tech trail, we want to
  518. 23:35check for
  519. 23:36attack. And then we can let's change
  520. 23:39this to if sets to check then cuz we
  521. 23:42don't want our script to return end
  522. 23:45because we want the trails to be
  523. 23:46disabled down here. So we'll go ahead
  524. 23:48and
  525. 23:50say if status to
  526. 23:53check
  527. 23:55then or we can go over here and say and
  528. 23:58status to check. All right. Now this is
  529. 24:01just the same code from before. We're
  530. 24:03checking for the weapon and the stats to
  531. 24:06check and everything like that. And
  532. 24:08we're checking if we find the status to
  533. 24:10check, which is either sprinting or
  534. 24:11attacking, then we want to either enable
  535. 24:13the trail or disable the
  536. 24:17trail. And then after that, if we don't
  537. 24:19have a weapon or anything like that,
  538. 24:20then we'll just disable the trail like
  539. 24:21so.
  540. 24:24And now if you go over here and you play
  541. 24:26the game
  542. 24:28and we add in our things, you'll see
  543. 24:30that, okay, the chill disables. Let's
  544. 24:33say we equip fist, it disables, and then
  545. 24:35we put
  546. 24:36dagger, it enables dagger trail. Now, if
  547. 24:39we start
  548. 24:40attacking, you see that we have the
  549. 24:42trail for the
  550. 24:44dagger. One thing you'll see is that the
  551. 24:46trail is still there.
  552. 24:48So down here we can say else if we don't
  553. 24:51find so status not found and this is
  554. 24:54over here status
  555. 24:56found then we can just loop through the
  556. 25:00character. So similarly we can go over
  557. 25:03here and copy and paste
  558. 25:06this and disable all of the
  559. 25:09trails and we can
  560. 25:14say and shrill.name
  561. 25:16name equals show name, then we just want
  562. 25:19to disable it. So now if you go over
  563. 25:22here and let's
  564. 25:27equip the weapon, it
  565. 25:29works. And you'll see that texture
  566. 25:35works. Here we
  567. 25:39go. All right. Now that the trails part
  568. 25:43is done, we want to add in the dashing
  569. 25:46stones because you notice that we don't
  570. 25:48have any dashing stones right now and
  571. 25:51it's really
  572. 25:52bland. So, I want to note that
  573. 25:55everything that you can find, other
  574. 25:56resources you can find is going to be in
  575. 25:58the um resource folder in the
  576. 26:00description. So, I have a new effect, a
  577. 26:03new sound called dash, which I've
  578. 26:05already parented to
  579. 26:07sounds, and you'll hear that as a dash
  580. 26:09sound. So we go to the function where we
  581. 26:13dash. So let's go over here time 70 just
  582. 26:15to find the velocity and we can add in
  583. 26:18our dashing sound. So we can say playing
  584. 26:21dash like so. And conveniently we
  585. 26:24already have a module called sound. So
  586. 26:28we want to require that because we
  587. 26:31cannot use fire client or fireall
  588. 26:33clients on the client. Those can only be
  589. 26:36called from the server. So we'll need to
  590. 26:38directly require the module. So we say
  591. 26:40local sound module equals
  592. 26:43require our modules client effects sound
  593. 26:48like so.
  594. 26:49And if we go down here to dashing, we
  595. 26:53can say sound module and get our
  596. 26:55argument data. And you'll notice that
  597. 26:57our argument data we have is sound name
  598. 26:59and the parent. So we'll just say sound
  599. 27:04name. Let's see what sound name is like
  600. 27:06that. All right. son name is equal to
  601. 27:10dash like
  602. 27:12so and then we can
  603. 27:15say parents is equal to humanoid
  604. 27:20report like so now if you play the game
  605. 27:23you'll notice that we have
  606. 27:29sounds and there we go.
  607. 27:33Now, since we're on the topic of sounds
  608. 27:34and dashing, we also want to add in
  609. 27:37dashing
  610. 27:38effects. So, once again, in the comment
  611. 27:41resource folder, we do have dash
  612. 27:43effects. So, we'll just go ahead and
  613. 27:44copy and paste those into our effects
  614. 27:46folder, which you already have. And
  615. 27:49we'll just clone these based on what the
  616. 27:51direction is. So, you see, we already
  617. 27:53have that. So, we can go over here.
  618. 27:56Oops.
  619. 27:58And we can
  620. 28:00say doing dash effects. And we'll put
  621. 28:03this in a separate thread so it doesn't
  622. 28:05yield the script. So local found dash
  623. 28:09effect
  624. 28:11equals assets effects dash effects find
  625. 28:15the shell direction. So we found it.
  626. 28:17Then we want to clone it. So clone and
  627. 28:20clone.parent is equal to
  628. 28:22workspace.worlds.x
  629. 28:24effects because we already made a folder
  630. 28:26in here called effects in
  631. 28:29here. So now we want to weld all of the
  632. 28:33things. So we're going to weld our dash
  633. 28:38effect. So weld.part O equals our root
  634. 28:41part. And then we want to weld it to we
  635. 28:44want to weld the root part to the clone
  636. 28:48or the dash effect. An important thing
  637. 28:50to note is that always make sure that
  638. 28:52can collide and mass is set to true
  639. 28:55because we don't want the character to
  640. 28:56be colliding with the dash effect or
  641. 28:58anything like that. Uh I remember noting
  642. 29:02this in the first video when we were
  643. 29:03discussing what hitbox is. So if you
  644. 29:05forgot refer back to that and we want to
  645. 29:08parent our weld to the clone. And now
  646. 29:11we'll just emit the or not omit we'll
  647. 29:14just enable the effects.
  648. 29:16So uh effect particle emitter question
  649. 29:21mark and clone get the sentence too. If
  650. 29:25effect is a particle emitter then we
  651. 29:29want to
  652. 29:30emit. So we'll say or not even
  653. 29:33emit we want
  654. 29:36to enable the
  655. 29:40particles and then we'll just wait the
  656. 29:42duration of the dash. So test at delay.3
  657. 29:45which is the duration and then we'll go
  658. 29:47ahead and disable the
  659. 29:49effects and then we want to destroy the
  660. 29:52effects after some sort of time. So
  661. 29:55we'll say clone comma
  662. 29:57say
  663. 29:591.5 one and a half
  664. 30:02seconds and then we'll get rid of all
  665. 30:04the white space and now we have our dust
  666. 30:06effect.
  667. 30:08So now if we play the game,
  668. 30:11you notice that we have dust.
  669. 30:19And there we go.
  670. 30:22All right. Now that all of that part is
  671. 30:24out the way, all of the semi- difficult
  672. 30:26things, we can start working on
  673. 30:29controller and mobile compatibility.
  674. 30:32So, in the combat resources, I have the
  675. 30:36UI for it already made for y'all.
  676. 30:39And then we'll just go ahead and parent
  677. 30:40this to the starter UI. You'll notice
  678. 30:44that all of the visibility for these for
  679. 30:47these uh frames are disabled. And that's
  680. 30:50um that's intentional. So, let's make a
  681. 30:53local script in here called client. And
  682. 30:56let's call this
  683. 30:58controller/mobile compatibility.
  684. 31:01compatibility.
  685. 31:03All
  686. 31:04right, now we want to get user input
  687. 31:07service as one of the
  688. 31:09services. Let's go ahead and start with
  689. 31:12our controller
  690. 31:13compatibility
  691. 31:15compatibility. So we can say user input
  692. 31:19service.gamepad not even that we can
  693. 31:21make a run
  694. 31:25service get service run service. We say
  695. 31:29run service render select to connect
  696. 31:31function and we can check if we have a
  697. 31:34gamepad enabled which is in this case
  698. 31:37either your Xbox or your PS5 uh
  699. 31:40controller and then we can either
  700. 31:42disable or enable the console controls
  701. 31:45frame. So we can say local UI parent
  702. 31:49local console controls frame UI with
  703. 31:53child console controls mobile frame
  704. 31:55equals UI with child mobile frame and
  705. 31:58then we can say okay if it's enabled
  706. 32:01then we will make the visible true and
  707. 32:04if it's disabled then we will just set
  708. 32:07the console frame to
  709. 32:13false. All right. And let's make a cut
  710. 32:15from the video here. Remember to get the
  711. 32:19controller and demonstrate
  712. 32:25it. All right. Now that that works, we
  713. 32:28can start doing our mobile frame and
  714. 32:32making the mobile frame appear if you're
  715. 32:33on
  716. 32:34mobile. So let's remove that comment. We
  717. 32:37can say if user input service dot
  718. 32:40uh let's see touch
  719. 32:42enabled then we want to enable the
  720. 32:45mobile frame else we'll just go ahead
  721. 32:48and disable it.
  722. 32:50You'll notice that there's a lot of
  723. 32:52repetitive repetitiveness with this. So
  724. 32:56let's refer back to
  725. 32:59our thing right here. So you see that
  726. 33:01gamepad enabled returns a boolean value.
  727. 33:04So since we know that we can just say
  728. 33:07console controls frame visible equals
  729. 33:09user input service.gamepad enabled like
  730. 33:12so and that'll remove the need for that
  731. 33:15and then as well we can say mobile
  732. 33:17frame.visible equals user input service
  733. 33:19dot uh touch enabled
  734. 33:24and that should work. So now if we play
  735. 33:26the game, you notice that none of the
  736. 33:29GUIs are enabled. But let's go ahead and
  737. 33:32go over here to our emulator. So in
  738. 33:34order to access this little emulator
  739. 33:36thing, we can you have to go to test and
  740. 33:39you'll see something called device uh
  741. 33:42controller and
  742. 33:44player. So we can click on device and
  743. 33:47it'll it'll enable that. And we can go
  744. 33:49to our iPhone XR or whatever you want.
  745. 33:52So now if you play the game, you'll
  746. 33:53notice that we have our GUI pop up for
  747. 33:56mobile.
  748. 33:58And then we can just go over here to HD
  749. 34:011080 and you'll see that that's uh not
  750. 34:04enabled anymore.
  751. 34:07So also if we go on PS5 and we play the
  752. 34:10game, you notice that we have our
  753. 34:13controller things enabled.
  754. 34:18So let's switch back to here.
  755. 34:22and go to our client again.
  756. 34:26So now we actually want to make these
  757. 34:28buttons work. So let's start with our
  758. 34:30mobile frame
  759. 34:31first. We'll want to add in the
  760. 34:35M1's. So we can
  761. 34:38say user let's not do that. We can say
  762. 34:42mobile frame dot mobile one.button
  763. 34:45button dot mouse button
  764. 34:48one down connect function. So that's
  765. 34:51when you put your finger down on the
  766. 34:53button. We want to make the person start
  767. 34:56attacking. So in here you remember that
  768. 34:58we just fire a server for attack and
  769. 35:01then we did all these prerequisite
  770. 35:03functions over here. So in order to do
  771. 35:06that again we can just require the state
  772. 35:09service local state service or local
  773. 35:12[Music]
  774. 35:14modules and then we can get our state
  775. 35:19service dot state service and we'll just
  776. 35:22do that. And we also want to get our
  777. 35:24character.
  778. 35:27So let's do that.
  779. 35:36And there we go. That should be good.
  780. 35:38And we also want to get our
  781. 35:43remotes. And now our mobile thing should
  782. 35:49work. All right. Now that that's done,
  783. 35:51let's go ahead and play the game and
  784. 35:53equipped a weapon. So, let's go equip
  785. 35:56our dagger, for example.
  786. 36:02And you see that once we hold down M1,
  787. 36:05it'll work.
  788. 36:11But if we let go, it will stop working.
  789. 36:14And you'll notice that our jump button
  790. 36:15disappears because that's how we
  791. 36:17scripted it. We want the jump to be
  792. 36:19disabled while they're winning.
  793. 36:27Now, let's stop playing the game and
  794. 36:28let's go back to this
  795. 36:31And now we want to work on our mobile
  796. 36:34blocking.
  797. 36:37So we can say mobile frame mobile block
  798. 36:42dot mouse button one or button mouse
  799. 36:46button one down connect function. So
  800. 36:49this is when we're holding it down. We
  801. 36:50want them to block. So let's go over
  802. 36:53here and we'll look at how we did the
  803. 36:56blocking.block
  804. 36:59block fire
  805. 37:01server. And let's
  806. 37:05see. All
  807. 37:09right. Uh right
  808. 37:15here. Uh let's see how it wants to do
  809. 37:21this. All right. So we can go over here
  810. 37:23and we can say if not status folder find
  811. 37:26child blocking. Let's get our status
  812. 37:29folder. So we can say status folder
  813. 37:30equals character with child
  814. 37:32status, not
  815. 37:35huge. Then we'll just start let them
  816. 37:38block otherwise we'll just unblock. So
  817. 37:41we can say mobile block button mouse
  818. 37:44button went up. So it's when you release
  819. 37:46it, we can make them stop blocking. Stop
  820. 37:49blocking. So there we go. That should
  821. 37:53work. Oops. Need to switch it over to
  822. 37:56our mobile device.
  823. 37:58Then if you play the game and we will
  824. 38:00equip fists in this case
  825. 38:04and let's hold block. Oops.
  826. 38:18Wait. It's because I am on PC. I'm
  827. 38:22trying to attack because you notice that
  828. 38:23if I'm clicking on the screen, it'll
  829. 38:24attack because it because I'm on PC and
  830. 38:27the button works. But if you're on
  831. 38:30mobile, this will definitely work.
  832. 38:36Uh let's see what else you want. Okay,
  833. 38:39in order to fix that, we can do one
  834. 38:40thing. We can go over here and we can
  835. 38:44change this and we can
  836. 38:47say if if press one and we can say
  837. 38:52if if not user input service uh touch
  838. 38:57enabled or we can say if user input
  839. 38:59service touch enabled or user input
  840. 39:01service.gamepad enabled then we just
  841. 39:03want to not do anything because we don't
  842. 39:06want them to be accessing mobile and
  843. 39:08controller functions at the same time.
  844. 39:10Similarly, we will do the same with
  845. 39:12attacking or blocking.
  846. 39:15So over here, we can say that else we
  847. 39:18will allow them to block.
  848. 39:24Uh let's see what else we want to do
  849. 39:26right here as well. We can say
  850. 39:29if user service then else we will do it
  851. 39:33because we want to override
  852. 39:35functionality if they're on either um
  853. 39:37mobile or controller. And as for
  854. 39:40sprinting, let's see where we add in
  855. 39:42sprinting. It was this at the same spot
  856. 39:44right here.
  857. 39:47So, if um if they hold left shift or
  858. 39:51they're on
  859. 39:53mobile dot touch enabled, then we want
  860. 39:57them to sprint regardless cuz mobile
  861. 40:00players have a hard time like holding
  862. 40:02down both um both fingers at once. So,
  863. 40:06we just want to say, okay, if they're on
  864. 40:08mobile, we just give them automatic
  865. 40:10sprinting. So, now if we play the game,
  866. 40:13you notice that our M1 functionality
  867. 40:15isn't working anymore. If you click on
  868. 40:16the
  869. 40:17screen, and then if we go over here,
  870. 40:19you'll notice that we sprint immediately
  871. 40:21on mobile. And if we equipped M, our
  872. 40:24fist, M1 isn't working, but the M1 on
  873. 40:26the screen is working.
  874. 40:30If you hold block, you know this set
  875. 40:35works.
  876. 40:40So, all right. And if we go back to our
  877. 40:45screen and let's go ahead and add in
  878. 40:48dashing.
  879. 40:50So
  880. 40:53let's see how we worked on dashing
  881. 40:58over
  882. 41:01here. There we go. All right. So in
  883. 41:06[Music]
  884. 41:10our in our input script, we can make a
  885. 41:13function called dash like so, which
  886. 41:16would just handle all of our dashing
  887. 41:19things. I'm going just do dash.
  888. 41:22All right.
  889. 41:25So, rather than having to just add in a
  890. 41:27ton of new lines of code for just a
  891. 41:30single mobile dashing thing, we can just
  892. 41:32get the um the dash button and the
  893. 41:35mobile frame. So, in here we can say
  894. 41:38local player
  895. 41:39GUI equals Oh, wait. Yeah. Equals
  896. 41:45our local players G um local players
  897. 41:48GUI.
  898. 41:52We can say player width of child player
  899. 41:55GUI comma m.h
  900. 41:58and we'll get our
  901. 42:00controller mobile
  902. 42:02frame
  903. 42:07controller/mo.h and then now we can go
  904. 42:09ahead and get the mobile dash
  905. 42:11button. So down here we can say
  906. 42:14controller mobile frame mobile frame
  907. 42:17mobile dash
  908. 42:19that button, the mouse button, one
  909. 42:20click, connect function.
  910. 42:24And then we can just
  911. 42:26dash like so.
  912. 42:28And that should
  913. 42:32work. Now, if we play the
  914. 42:34game, you'll notice
  915. 42:38that we're dashing like
  916. 42:43so. And obviously you're on mobile, you
  917. 42:46can pre you can move your mouse while
  918. 42:48pressing dash at the same time.
  919. 42:51But if let's say if you're sitting
  920. 42:53still, we just want you to automatically
  921. 42:55be able to dash forward. So in the get
  922. 42:57dash direction function, we
  923. 43:00can see where I put it right
  924. 43:03here. We can just say return forward
  925. 43:07like so. So now regardless if you're
  926. 43:10moving or not, if you press dash, you
  927. 43:12just dash forward like so.
  928. 43:15And that's going to be the mobile
  929. 43:17compatibility thing. So once again,
  930. 43:21sword, you have
  931. 43:23betrayal, and then if you're blocking,
  932. 43:25you notice that okay,
  933. 43:30works. And once again, you see that,
  934. 43:33okay, your sprinting is constantly
  935. 43:36enabled. Do
  936. 43:37that. All right, now let's stop playing
  937. 43:39the game.
  938. 43:41Then now since we're done with our
  939. 43:44mobile compatibility, we can work on the
  940. 43:47controller.
  941. 43:52So we can
  942. 43:55say if user input service is uh key down
  943. 44:00enam.o
  944. 44:03um button A I believe is what the attack
  945. 44:07is. Let's
  946. 44:09see. or no button X.
  947. 44:13So if that button is held down, we will
  948. 44:16allow the player to
  949. 44:17attack. So we'll just say over here and
  950. 44:21allow them to attack.
  951. 44:23So now if you play the game
  952. 44:26and let's go ahead and enable our
  953. 44:29controller and let's move up a little
  954. 44:32bit and get a sword.
  955. 44:36Let's flip our sword.
  956. 44:37Let's hold uh let's hold X. Oops. All
  957. 44:41right. So now a fix for this is what we
  958. 44:44can do. We can just say
  959. 44:45is gamepad button
  960. 44:48down enum.gamepad one. And then we can
  961. 44:51say
  962. 44:53enam.keycode.button X I believe. Uh yes,
  963. 44:57button X. And now if we play the game,
  964. 45:00it should work. So let's go ahead and
  965. 45:02give us a sword. Let's hold down X. And
  966. 45:07now you notice that the slash finally
  967. 45:09works. And now we can do the same thing
  968. 45:13with blocking. So in here you'll notice
  969. 45:16that we have
  970. 45:17blocking. And now we just copy and paste
  971. 45:20this code up here.
  972. 45:23And then we can remove
  973. 45:25this. So we just comment controller or
  974. 45:28mobile.
  975. 45:31And then right here we'll just say
  976. 45:34remotes or
  977. 45:37if
  978. 45:39not go
  979. 45:41over here
  980. 45:47and let's do that.
  981. 45:52And we can say if not is typing
  982. 45:57then we
  983. 46:01say if controller then if user service
  984. 46:06if not user service is key down my key
  985. 46:11code.f then we want them to stop
  986. 46:14blocking. Otherwise, we'll go over here
  987. 46:17and copy and paste uh this right here.
  988. 46:22And for controller, we can say if not is
  989. 46:26button down button B, I believe, then we
  990. 46:29just want them to stop
  991. 46:31walking. And mobile remember is
  992. 46:33something different for that. And now
  993. 46:35over here, we can say
  994. 46:39if not status folder and if they're
  995. 46:42holding F then we want them to block.
  996. 46:44And same thing if set 45 have a shell
  997. 46:47blocking or not a shell blocking then we
  998. 46:50want to
  999. 46:51block. So if we play the game and we
  1000. 46:54equip the
  1001. 46:56tool you'll notice that if we equipped
  1002. 47:00our tool right here X and if we hold B,
  1003. 47:04you'll notice that we're blocking
  1004. 47:05now. And obviously our well it seems
  1005. 47:09like our unblocking thing is working. So
  1006. 47:12the only part that could be is right
  1007. 47:14around here.
  1008. 47:17So let's see.
  1009. 47:19All right. So one thing we can do is
  1010. 47:21just go over here, remove the not is
  1011. 47:23typing part and format our
  1012. 47:28script. So right here, we'll just go
  1013. 47:30ahead and remove all of this right
  1014. 47:33here and remove this end and format the
  1015. 47:36script.
  1016. 47:38So we can go over here and
  1017. 47:42say and not is typing. And we can go
  1018. 47:45over here and say and not is
  1019. 47:48typing. All right. And we can say else
  1020. 47:51and we can copy and paste this. If
  1021. 47:53status folder shell is blocking then
  1022. 47:55false. And same thing over here. We can
  1023. 47:58just say
  1024. 48:00else. And that should be good.
  1025. 48:04If we play the game and give ourself a
  1026. 48:07sword and hold X, it'll work. If we
  1027. 48:11block and unblock, it also works, too.
  1028. 48:13Which is exactly what we want.
  1029. 48:18All right. And the next thing we want to
  1030. 48:20do is we also want to enable sprinting
  1031. 48:22for uh controller as well. And this is a
  1032. 48:26pretty simple oneliner. We go over here
  1033. 48:28to our
  1034. 48:30sprinting. Let's go ahead and find
  1035. 48:32sprinting.
  1036. 48:35uh right here or user input
  1037. 48:38service.gamepad enabled
  1038. 48:40then we want to constantly sprint. So
  1039. 48:43you see that we constantly sprint now.
  1040. 48:49All right. Now let's
  1041. 48:53see the next thing we want to do is we
  1042. 48:56want to add dashing for the
  1043. 49:01for the
  1044. 49:03controller. All right. Now, so if we
  1045. 49:05want to add dashing, we can say
  1046. 49:06input.keycode
  1047. 49:08equals
  1048. 49:10enum.keycode.button L3. Then we just
  1049. 49:13want to dash like
  1050. 49:14so. Now, if we play the game and we
  1051. 49:17start
  1052. 49:21dashing, oops, you notice that dashing
  1053. 49:25works. And button 03 is basically just
  1054. 49:29this button right here, the middle
  1055. 49:30button. If we pressed on that, you see
  1056. 49:33that it
  1057. 49:34works. So, yeah, that's good. And once
  1058. 49:37again, if we go over here
  1059. 49:39and get us a
  1060. 49:41weapon, in this case, we'll get pissed.
  1061. 49:46And then we will equip our fist.
  1062. 49:50Notice how the punching works. And if we
  1063. 49:52dash
  1064. 49:53or block, it works as well.
  1065. 49:56And then if we punch the
  1066. 50:01dummy and blocking also works.
  1067. 50:06All
  1068. 50:07right.
  1069. 50:09Now, the next thing we want to do is
  1070. 50:11just do a slight little uh bug fix,
  1071. 50:14which is where making it to where you
  1072. 50:16can't do any action at all when you die.
  1073. 50:20So, if we go over here to our input, we
  1074. 50:23can just say if we died like so, it says
  1075. 50:27for find died, then we want to just
  1076. 50:29disable the script. So, script.enabled
  1077. 50:32equals false.
  1078. 50:34And that should be good.
  1079. 50:38So, that's pretty much going to wrap up
  1080. 50:41this video. What we did today is that we
  1081. 50:44just added in weapon trails and things
  1082. 50:46like that. Just a few extra details and
  1083. 50:50cosmetics to the game to make it look
  1084. 50:52more more full. And we also add dashing
  1085. 50:55sounds, which you see like that, and
  1086. 50:57dashing
  1087. 50:59effects. Um, so yeah, thank you for
  1088. 51:01watching. Tomorrow's video is going to
  1089. 51:04be the series finale or the ending of
  1090. 51:07the whole combat series tutorial.
  1091. 51:10Um, it'll just show everything that we
  1092. 51:12added and go through every every single
  1093. 51:15one of the scripts and explain a bit
  1094. 51:17more in depth of what the thought
  1095. 51:19process was behind it. And yeah, please
  1096. 51:22leave a like uh and subscribe and thank
  1097. 51:24you for watching.

About this transcript

This page contains the full transcript of [Part8] Roblox Combat System for Beginners | Console/Mobile & More Effects by Senko, generated from the public captions YouTube serves with the video. The transcript has 6,948 words across 1,097 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.