[Part8] Roblox Combat System for Beginners | Console/Mobile & More Effects — Transcript
Full transcript
- 0:01All right. So, this is going to be sort
- 0:02of a little introduction to episode 8,
- 0:06which is just going to go over a little
- 0:09few fixes of the game, as well as adding
- 0:11some more effects to it. For example, in
- 0:14this video, we just added some weapon
- 0:15trails and sprinting and dashing effects
- 0:18to the game, as well as some sounds for
- 0:21the dashing. And the main focus of the
- 0:23video entirely is on adding controller
- 0:25and mobile compatibility.
- 0:28And yeah, so for a little showcase, if
- 0:31we join the game and let me go ahead and
- 0:34disable my controller real
- 0:36quick and let's go ahead and equip our
- 0:41weapons. You notice that first thing we
- 0:43have is new dashing sounds like
- 0:46so. And dashing effects. Next thing we
- 0:49added is sword trails, which if you
- 0:51equip your sword, you have a sword
- 0:53trail. If you equip this, you have
- 0:55nothing. And dagger works. as well as a
- 0:58second trail. So you see a red trail on
- 1:01the dagger as well as a red trail on the
- 1:06sword. And now let me demonstrate for
- 1:09y'all controller. So if I hook up my
- 1:11controller like
- 1:14so. And let's go ahead and wait a little
- 1:16bit. You'll see that.
- 1:19Okay. And if we go ahead and equipped,
- 1:22let's say our sword and we hold it
- 1:24button X, you notice that the attacking
- 1:28works as well as holding block. And
- 1:31yeah, same with dashing. Dashing is our
- 1:32L3, which is the middle joystick. And it
- 1:36works like so. And another thing I want
- 1:38to note is we made it to where for
- 1:41dashing on mobile or no, sprinting on
- 1:43mobile and controller is automatically
- 1:46enabled.
- 1:48So, let me disconnect my controller now
- 1:51and switch over to mobile, which you can
- 1:53do so with the emulator. So, we'll do
- 1:56mobile iPhone XR. And if we play the
- 1:59game and give ourselves a sword, you
- 2:02notice that sprinting is also enabled
- 2:04and M1
- 2:06works. And blocking also works like
- 2:10so. And dashing, obviously, you can
- 2:15dash. So yeah, that's pretty much going
- 2:18to be the video. Please leave a like,
- 2:21comment, and
- 2:22subscribe. And thank you for watching
- 2:24the series so far. It's been it's been
- 2:28great. And the next episode is going to
- 2:30be the finale and the series ending,
- 2:32which is is going to go over all of the
- 2:35combat system in general, explaining
- 2:37things more in depth. So yeah, thank you
- 2:39for watching. The first thing I want to
- 2:41address is the can block function that
- 2:45we used uh
- 2:47to either destroy or allow you to
- 2:50sprint. This can be this is confusing
- 2:53especially for me too cuz rather than
- 2:55having a cam block function, we honestly
- 2:57should just have something called a can
- 2:59sprint function cuz we have can dash cam
- 3:02block. So it's obvious that we should
- 3:03also have can sprint. So we're going to
- 3:05add that in. So if state service check
- 3:09state character comma
- 3:12stunned or blocking
- 3:15attacking no sprint no
- 3:19move
- 3:22dashing dash cool
- 3:24down then return false otherwise you
- 3:27want to return true. So now if you go
- 3:29back to can block we can say if status
- 3:31folder find sh sprinting if not can
- 3:34sprint then status folder sprinting
- 3:37destroy like so and then we can just
- 3:40remove this.
- 3:43Now if we go over here to where we
- 3:45actually uh want to start sprinting we
- 3:47can say if can sprint then do
- 3:51this and we just get rid of
- 3:54this and over here. Yep, that should be
- 3:58good. So, we test the game. We should be
- 4:01able to sprint with a new. Okay, we have
- 4:05an error. Let's
- 4:06see. Error
- 4:09parsing. Let's see what the issue is.
- 4:12Oh, right here. Forgot an end right here
- 4:15because we need to end the if not can
- 4:17sprint part. And let's see. So, start
- 4:21sprinting and we stop. And yep, there we
- 4:25go.
- 4:28Obviously, if you dash, there's a bit of
- 4:30an end lag before you can sprint again.
- 4:31Like
- 4:35so. And
- 4:38yeah. All right. Next up, we want to uh
- 4:42make it to where you can dash a little
- 4:44bit further because if we play the game,
- 4:46you'll see that the dashing is a little
- 4:48bit too short. Like you're barely moving
- 4:51at all when you dash. So, we'll add that
- 4:54in.
- 4:56So right here you'll see that we have
- 4:57the body velocity.
- 4:59So there's one of two ways we can do
- 5:01this. We can either increase our dashing
- 5:04length or we can increase the velocity
- 5:07that we're dashing by. So in this case
- 5:10we'll just increase the velocity because
- 5:13if we increase the dashing length then
- 5:14that means we'll also have to increase
- 5:15the end lag for it to be proportioned to
- 5:17it.
- 5:19So we will just go over here and change
- 5:22this to maybe 70 and 70 across the
- 5:26board. And another thing I want to note
- 5:29is dash cool down which is 1.5. We need
- 5:32to go up here and remove that from the
- 5:34sprinting thing
- 5:37because we don't want the player to not
- 5:39be able to sprint if there's a cool
- 5:40down. That's that's kind of stupid. And
- 5:43now we should be able to dash further
- 5:45because we increased it from 50 to 70.
- 5:48So there we go. You hit dash further
- 5:50now. So obviously you can sort of adjust
- 5:54this based on how you want your game to
- 5:55be. But in this case, we'll just make it
- 5:5870. Once again, value changing aspect of
- 6:01Roblox. You can just change this to 50,
- 6:0360, 40 if you so desire to. And yeah,
- 6:08that's going to be that part.
- 6:10And now we're going to go on to adding
- 6:14weapon trails to our um
- 6:19weapons. So first off, let's do it for
- 6:22sword. So we can move our sword equipped
- 6:24into workspace to actually edit
- 6:27it. So for these weapon trails, we're
- 6:30going to make two trails. One is going
- 6:32to be for sprinting and one is going to
- 6:34be for our attacking.
- 6:37So in our
- 6:40in our sword equipped right here. We can
- 6:43add a trail called
- 6:47uh sprint trail like so. And you'll
- 6:50notice that trails have an have a
- 6:53property called attachment O and
- 6:55attachment one. So a brief overview of
- 6:58what trails do is that there's always a
- 7:00start point and an end point. So in this
- 7:03case we'll add
- 7:05a attachment to the
- 7:09blade and we can just call this
- 7:11attachment one or attachment O. An
- 7:13important thing to note is that
- 7:15attachments always need to be parented
- 7:17to a base part or some type of part. For
- 7:20example, you can't just parent it to a
- 7:21model like so. It won't
- 7:24work. But you can parent it to anything
- 7:26else. So, we'll just print the blade
- 7:29back. And we will move this to the start
- 7:31point, which is going to be around right
- 7:33here on our blade where we want our
- 7:36sprint
- 7:39sh around here. And we want to duplicate
- 7:42it to the end of the sword. So, around
- 7:45right here to the tip of the blade. And
- 7:47we call this attachment
- 7:49one. Naming these doesn't have an effect
- 7:52on the trail. It's just for us to know
- 7:54which attachment is what. So example, we
- 7:56can call this a start point and we call
- 7:57this end point. It doesn't really
- 7:59matter. So we can set attachment O to
- 8:02the start point and attachment one to
- 8:04the end point. And now if you move the
- 8:07sword around, you see that there's a
- 8:08trail following it like so. So we will
- 8:12want to edit the lifetime of this to
- 8:14around.3. And we want to make the
- 8:17transparency start at around 6 and then
- 8:19go to one. So it fades out. So now if we
- 8:23move it, you'll see that it has sort of
- 8:25like a fade out stroke.
- 8:28So I'm going to make this a bit more
- 8:29transparent. So we can change this to
- 8:31around 75.
- 8:34Now if you move it around, you see that
- 8:36it's more
- 8:38transparent. So we'll disable our sprint
- 8:40trail and we will parent it back to
- 8:43sword.
- 8:45Similarly, we will go over here to our
- 8:47dagger and go to dagger
- 8:49equipped and we will add in the dagger
- 8:52spin row. So, if we print it to our
- 8:55primary part and let's go ahead and
- 8:59reset the
- 9:01uh the origin of these to 00 which is
- 9:04the center of the blade and start point
- 9:07is going to be around right
- 9:10here. Oops.
- 9:16It's going to be down right
- 9:18here. And our end point is going to be
- 9:21across over here a little bit. And up
- 9:24like so. And now we can just duplicate
- 9:27our trail that we have in
- 9:29blade or right here. Where did I put it?
- 9:32Right here in the model. And we can just
- 9:36parent it to
- 9:38our D encrypted model. And we'll just
- 9:40change the values. So, we change this
- 9:42start point.
- 9:44Oops. Start point and end point. Now, if
- 9:48you move it, oh, we've enabled it first.
- 9:51So, now if we enable it, you know how
- 9:54the trail works. So, let's disable it
- 9:57and let's move this back into our dagger
- 10:01folder. Now, we can actually start
- 10:03working on the sprint trail now. So if
- 10:06we scroll down here and we find
- 10:08something called status
- 10:10folder find first child sprint scene.
- 10:15All right. So in here now we can
- 10:17actually add in the trails. So we can
- 10:19say add in the trails up
- 10:23here or instead of that we can just go
- 10:26down here to after animations and we can
- 10:28say
- 10:29uh enabling disabling sprint trails.
- 10:32Make it a comment like so. So we're
- 10:34going say if status folder find out
- 10:36sprinting then
- 10:38else. So now we can loop through our
- 10:41character
- 10:44underscore,
- 10:46trail question mark and character get
- 10:49ascends to a trail is a trail and
- 10:52trail.name is equal
- 10:55to whatever the trail is called which is
- 10:58sprint
- 10:59trail. Then we want to enable it. Enable
- 11:03it equals true. So the reason we say
- 11:05trail question mark is because of
- 11:07annotating which I mentioned a lot in
- 11:09the other videos. But this question mark
- 11:11over here is indicating that we're not
- 11:14sure if all the descendants are a trail
- 11:17but we still want to be able to use all
- 11:19the functions and methods that trail
- 11:21is. So that's that. And we enable the
- 11:25trail otherwise we just disable it. So
- 11:27we'll say disable trail like so.
- 11:30So now if we play the game, you notice
- 11:33that we don't have any trail right now.
- 11:34And if we go over here and equipped our
- 11:37weapons,
- 11:39wait, what's going on? Oh, okay. First
- 11:42thing we also want to do is we want to
- 11:44check for our weapon cuz obviously if
- 11:47we're sprinting then the trail should be
- 11:49enabled, but we also want to check if
- 11:51our weapon's equipped. So, we're going
- 11:53to say local weapon
- 11:56equals character find child, which is a
- 11:59weapon or not weapon, my bad, a
- 12:02tool. So, if weapon, then we can loop
- 12:07through the uh the tool, the weapon. So,
- 12:11we can get rid of this and we can loop
- 12:13through the weapon.
- 12:16And another extra sanity check we can do
- 12:18is we can say and weapon data module.get
- 12:22weapon data weapon.name like so. And
- 12:25we'll just go ahead and put that out
- 12:27here. So local weapon equals character
- 12:29shot as a
- 12:30tool. If weapon and weapon data
- 12:34get
- 12:36weapon.name then like so. And we can
- 12:39just copy and paste this in here. And
- 12:42we'll remove these lines.
- 12:46And we will format the
- 12:47script. And instead of character get
- 12:49ascendants, we will now do get a
- 12:50sentence for the weapon. And over here
- 12:53we can also do the same. And that should
- 12:55be
- 12:57good. So now if we play the game and we
- 13:01equipped our weapons, you notice how the
- 13:02sprint show is disabled. But if we equip
- 13:04our
- 13:05sword, oh, let's
- 13:07see. Let's go to our character. Let's
- 13:13see if weapon and weapon
- 13:19data if trail is a
- 13:22trail. Let's see. Oh, right. Our weapon
- 13:26model isn't parented to the weapon, but
- 13:28it's parented to the character. So, we
- 13:30just do a character get a
- 13:31descendence. Right. Now, if we play the
- 13:35game, you will see that our sword trail
- 13:38is out when we're sprinting and our
- 13:41dagger trails up. But another thing is
- 13:45that you'll see that it enables the
- 13:46trail for both the the katana and the
- 13:49dagger. And we only want the trail to be
- 13:52enabled for one.
- 13:54So what we want to do is we want to find
- 13:55the corresponding
- 13:58uh
- 14:01the corresponding models to the actual
- 14:03weapon name. So in here we can say we
- 14:06can add a value called
- 14:10uh weapon weapon name like so which is a
- 14:14string and we can call it stagger.
- 14:16Similarly, we can go over here and we
- 14:18can add a value called weapon name. And
- 14:20then we can call this uh
- 14:23sword. And then now we can just go ahead
- 14:26and loop through all of
- 14:29the the models in the character and
- 14:32check if it's if it has a value called
- 14:34weapon model and weapon name or an
- 14:36attribute. So we can say for underscore
- 14:39comma model
- 14:42uh model question mark and character get
- 14:45children do if model get attribute
- 14:48weapon model equals equals true and
- 14:52model get attribute weapon name equals
- 14:56our weapon.name then we can enable
- 15:00trails. So another thing important thing
- 15:02to note is that the weapon name needs to
- 15:04correspond to the actual name of the
- 15:06weapon or else this won't work. And we
- 15:09can say for underscore, trail. So we
- 15:11just copy and paste this
- 15:15uh in the model get a sentence to if
- 15:18it's a sprint trail then we want to
- 15:20enable it. Otherwise we want to disable
- 15:22it. So we'll enable it and then over
- 15:25here we'll just disable it.
- 15:29And over here, instead of looping
- 15:32through all these, just in case if any
- 15:34any trail called sprint trail is
- 15:36enabled, we want to disable it. So we
- 15:38just go over here and get rid of the
- 15:41weapon model loop. And we'll just go
- 15:42over here and do that. So character get
- 15:44descendants and we will disable all
- 15:47sprint trails in the
- 15:48character. Now, if you play the game,
- 15:52and we equipped our weapons, you'll
- 15:54notice that the sword trail is the only
- 15:55trail that's
- 15:57out. And let's see
- 16:01right over
- 16:04here. We will let's
- 16:08see. Oh, it's because we don't have a
- 16:10tool equipped.
- 16:13So, let's see. All right. Okay. So, we
- 16:16can just go over here and we
- 16:18can go outside of the weapon
- 16:23uh conditional and we can just disable
- 16:24all trails if we don't have a tool
- 16:26equipped like so.
- 16:29So now if we equipped when you equipped,
- 16:32you notice our chills disappear. And
- 16:34let's go ahead and equip our dagger too.
- 16:37Let's move our dagger to third. All
- 16:40right. So now if we equip our dagger,
- 16:42you notice the trails enabled.
- 16:44Unquipped. It's
- 16:47disabled. All right. And if we equip our
- 16:49sword, we dash. You see that the trail
- 16:52works. And this
- 16:56h let's see
- 17:04uh if model get attribute then
- 17:11okay so we can add another conditional
- 17:13here. So if model get attribute weapon
- 17:18name equals tool.name or weapon.name
- 17:21name then we can enable trails otherwise
- 17:24we want to loop through the model and
- 17:26disable all the trails else we want to
- 17:28disable the
- 17:30trails. So this might look like a lot
- 17:32but what we're saying is that if the
- 17:34model that we loop through which are
- 17:36these models have the weapon model
- 17:38attribute set to true then we'll check
- 17:41if the model's weapon name is our weapon
- 17:43name that we have equipped. If it does,
- 17:46then we'll enable all the sprint shells.
- 17:48But if it doesn't, then we'll disable
- 17:49all the sprint shells for the weapon
- 17:51model that's not equipped. So, play the
- 17:55game and equipped our
- 17:59weapons. And we can equip dagger, sword,
- 18:02and you see that now the trails don't
- 18:04actually overlap each other.
- 18:08So, all right. Now, we can work on
- 18:12adding
- 18:13uh attack controls.
- 18:16So,
- 18:18and here we can move our sword equip to
- 18:21the workspace and then we can duplicate
- 18:24this and we can call this
- 18:28attack like so.
- 18:31Then over here you can
- 18:34we can go over here to our blade deck.
- 18:37Or actually in this case we can just say
- 18:39that yeah we can just keep the start and
- 18:40end point the same because it's already
- 18:44set to this part or this point and this
- 18:46point. But in order to differentiate
- 18:49between the sprint attack trail, we'll
- 18:50change the trail color to a red color.
- 18:54We want able to see it work. So you see
- 18:56that. Okay, nice. It works.
- 18:59And also in here we can let's also make
- 19:03it bright. So we can set our light
- 19:04influence to zero and make this four to
- 19:06make it a bit brighter.
- 19:08Let's make this brighter a little bit.
- 19:10Set it to 10.
- 19:12All right. And then we can set the color
- 19:14to a really dark or deep red.
- 19:18There we go. And let's go ahead and
- 19:21disable our techro. And then we will
- 19:23move this into here back.
- 19:26Let's go ahead and copy and paste our
- 19:30attack trail into our dagger and set the
- 19:33attributes to start point and end point.
- 19:39Now if we go over here we can also check
- 19:42if we are attacking or not. So we say um
- 19:46enabling slashd disabling attack
- 19:50trolls. So say if status folder find
- 19:52first child attack that's hacking then
- 19:55we can do all this
- 19:58like
- 19:59so and we can go ahead and just copy and
- 20:03paste this code right here
- 20:07actually yeah we can just copy and paste
- 20:09that code and but instead of doing that
- 20:12we can let's
- 20:15see we can make a function so it doesn't
- 20:18look like a bunch of duplicated codes.
- 20:20So let's go over here and keep this
- 20:23conditional for now. And we can
- 20:25say local
- 20:28function. Let's put it down here a
- 20:30little bit. Local
- 20:34function enable or toggle trails. And we
- 20:37can say
- 20:38trail name as well as our
- 20:44[Music]
- 20:48um yeah I think that's fine. We can say
- 20:51yeah trail name and our boolean. So we
- 20:54want this to be a string and this the
- 20:57boolean to be boolean. And now we can
- 20:59say if trail
- 21:01name equals equals sprint trail
- 21:04then else if our trail name is equal to
- 21:07the attack trail then we want to do
- 21:09something different and let's go over
- 21:11here to our sprint trail and we can copy
- 21:14and paste this code right here.
- 21:19Let's go ahead and go in here.
- 21:24Copy and paste down here and we say
- 21:27local
- 21:32uh local finals that are status to check
- 21:35like so equals no and we can say if not
- 21:39status check then return end
- 21:42and here we can say status to check is
- 21:44equal to attacking status to check is
- 21:48equal to
- 21:52sprinting and then now we can go over
- 21:55here and say if satis folder. Find SH to
- 21:59check
- 22:00then and trail.name is equal to trail
- 22:05name trail name.
- 22:08And over here we can set this to bull
- 22:11and bull.
- 22:15And over here we can just disable all of
- 22:18the
- 22:21trails and trail.name name equals
- 22:25equals sprint trail or trail.name equals
- 22:28attack trail. Then we'll disable all
- 22:32the all the trails like so
- 22:38uh let's
- 22:40see and that should be good.
- 22:43So if we go over down here to our
- 22:45function, we can say toggle trail sprint
- 22:49trail and then we can say toggle trail
- 22:52attack trail like
- 22:54so. And we can say if says folder find
- 22:57sprinting then or no we don't need to do
- 23:02that. And over here we'll change we'll
- 23:06remove our boolean value and we'll just
- 23:08say true and false.
- 23:12All right. So, what these lines of code
- 23:14do is that if you see where we call the
- 23:17function, we just want to toggle the
- 23:21trails for the sprint and attack
- 23:24trail. And if we go up
- 23:26here, you'll see that okay, if we want
- 23:29to um either enable or disable the
- 23:31sprint trail, we want to check for the
- 23:32status code sprinting. And vice versa,
- 23:34if we have a tech trail, we want to
- 23:35check for
- 23:36attack. And then we can let's change
- 23:39this to if sets to check then cuz we
- 23:42don't want our script to return end
- 23:45because we want the trails to be
- 23:46disabled down here. So we'll go ahead
- 23:48and
- 23:50say if status to
- 23:53check
- 23:55then or we can go over here and say and
- 23:58status to check. All right. Now this is
- 24:01just the same code from before. We're
- 24:03checking for the weapon and the stats to
- 24:06check and everything like that. And
- 24:08we're checking if we find the status to
- 24:10check, which is either sprinting or
- 24:11attacking, then we want to either enable
- 24:13the trail or disable the
- 24:17trail. And then after that, if we don't
- 24:19have a weapon or anything like that,
- 24:20then we'll just disable the trail like
- 24:21so.
- 24:24And now if you go over here and you play
- 24:26the game
- 24:28and we add in our things, you'll see
- 24:30that, okay, the chill disables. Let's
- 24:33say we equip fist, it disables, and then
- 24:35we put
- 24:36dagger, it enables dagger trail. Now, if
- 24:39we start
- 24:40attacking, you see that we have the
- 24:42trail for the
- 24:44dagger. One thing you'll see is that the
- 24:46trail is still there.
- 24:48So down here we can say else if we don't
- 24:51find so status not found and this is
- 24:54over here status
- 24:56found then we can just loop through the
- 25:00character. So similarly we can go over
- 25:03here and copy and paste
- 25:06this and disable all of the
- 25:09trails and we can
- 25:14say and shrill.name
- 25:16name equals show name, then we just want
- 25:19to disable it. So now if you go over
- 25:22here and let's
- 25:27equip the weapon, it
- 25:29works. And you'll see that texture
- 25:35works. Here we
- 25:39go. All right. Now that the trails part
- 25:43is done, we want to add in the dashing
- 25:46stones because you notice that we don't
- 25:48have any dashing stones right now and
- 25:51it's really
- 25:52bland. So, I want to note that
- 25:55everything that you can find, other
- 25:56resources you can find is going to be in
- 25:58the um resource folder in the
- 26:00description. So, I have a new effect, a
- 26:03new sound called dash, which I've
- 26:05already parented to
- 26:07sounds, and you'll hear that as a dash
- 26:09sound. So we go to the function where we
- 26:13dash. So let's go over here time 70 just
- 26:15to find the velocity and we can add in
- 26:18our dashing sound. So we can say playing
- 26:21dash like so. And conveniently we
- 26:24already have a module called sound. So
- 26:28we want to require that because we
- 26:31cannot use fire client or fireall
- 26:33clients on the client. Those can only be
- 26:36called from the server. So we'll need to
- 26:38directly require the module. So we say
- 26:40local sound module equals
- 26:43require our modules client effects sound
- 26:48like so.
- 26:49And if we go down here to dashing, we
- 26:53can say sound module and get our
- 26:55argument data. And you'll notice that
- 26:57our argument data we have is sound name
- 26:59and the parent. So we'll just say sound
- 27:04name. Let's see what sound name is like
- 27:06that. All right. son name is equal to
- 27:10dash like
- 27:12so and then we can
- 27:15say parents is equal to humanoid
- 27:20report like so now if you play the game
- 27:23you'll notice that we have
- 27:29sounds and there we go.
- 27:33Now, since we're on the topic of sounds
- 27:34and dashing, we also want to add in
- 27:37dashing
- 27:38effects. So, once again, in the comment
- 27:41resource folder, we do have dash
- 27:43effects. So, we'll just go ahead and
- 27:44copy and paste those into our effects
- 27:46folder, which you already have. And
- 27:49we'll just clone these based on what the
- 27:51direction is. So, you see, we already
- 27:53have that. So, we can go over here.
- 27:56Oops.
- 27:58And we can
- 28:00say doing dash effects. And we'll put
- 28:03this in a separate thread so it doesn't
- 28:05yield the script. So local found dash
- 28:09effect
- 28:11equals assets effects dash effects find
- 28:15the shell direction. So we found it.
- 28:17Then we want to clone it. So clone and
- 28:20clone.parent is equal to
- 28:22workspace.worlds.x
- 28:24effects because we already made a folder
- 28:26in here called effects in
- 28:29here. So now we want to weld all of the
- 28:33things. So we're going to weld our dash
- 28:38effect. So weld.part O equals our root
- 28:41part. And then we want to weld it to we
- 28:44want to weld the root part to the clone
- 28:48or the dash effect. An important thing
- 28:50to note is that always make sure that
- 28:52can collide and mass is set to true
- 28:55because we don't want the character to
- 28:56be colliding with the dash effect or
- 28:58anything like that. Uh I remember noting
- 29:02this in the first video when we were
- 29:03discussing what hitbox is. So if you
- 29:05forgot refer back to that and we want to
- 29:08parent our weld to the clone. And now
- 29:11we'll just emit the or not omit we'll
- 29:14just enable the effects.
- 29:16So uh effect particle emitter question
- 29:21mark and clone get the sentence too. If
- 29:25effect is a particle emitter then we
- 29:29want to
- 29:30emit. So we'll say or not even
- 29:33emit we want
- 29:36to enable the
- 29:40particles and then we'll just wait the
- 29:42duration of the dash. So test at delay.3
- 29:45which is the duration and then we'll go
- 29:47ahead and disable the
- 29:49effects and then we want to destroy the
- 29:52effects after some sort of time. So
- 29:55we'll say clone comma
- 29:57say
- 29:591.5 one and a half
- 30:02seconds and then we'll get rid of all
- 30:04the white space and now we have our dust
- 30:06effect.
- 30:08So now if we play the game,
- 30:11you notice that we have dust.
- 30:19And there we go.
- 30:22All right. Now that all of that part is
- 30:24out the way, all of the semi- difficult
- 30:26things, we can start working on
- 30:29controller and mobile compatibility.
- 30:32So, in the combat resources, I have the
- 30:36UI for it already made for y'all.
- 30:39And then we'll just go ahead and parent
- 30:40this to the starter UI. You'll notice
- 30:44that all of the visibility for these for
- 30:47these uh frames are disabled. And that's
- 30:50um that's intentional. So, let's make a
- 30:53local script in here called client. And
- 30:56let's call this
- 30:58controller/mobile compatibility.
- 31:01compatibility.
- 31:03All
- 31:04right, now we want to get user input
- 31:07service as one of the
- 31:09services. Let's go ahead and start with
- 31:12our controller
- 31:13compatibility
- 31:15compatibility. So we can say user input
- 31:19service.gamepad not even that we can
- 31:21make a run
- 31:25service get service run service. We say
- 31:29run service render select to connect
- 31:31function and we can check if we have a
- 31:34gamepad enabled which is in this case
- 31:37either your Xbox or your PS5 uh
- 31:40controller and then we can either
- 31:42disable or enable the console controls
- 31:45frame. So we can say local UI parent
- 31:49local console controls frame UI with
- 31:53child console controls mobile frame
- 31:55equals UI with child mobile frame and
- 31:58then we can say okay if it's enabled
- 32:01then we will make the visible true and
- 32:04if it's disabled then we will just set
- 32:07the console frame to
- 32:13false. All right. And let's make a cut
- 32:15from the video here. Remember to get the
- 32:19controller and demonstrate
- 32:25it. All right. Now that that works, we
- 32:28can start doing our mobile frame and
- 32:32making the mobile frame appear if you're
- 32:33on
- 32:34mobile. So let's remove that comment. We
- 32:37can say if user input service dot
- 32:40uh let's see touch
- 32:42enabled then we want to enable the
- 32:45mobile frame else we'll just go ahead
- 32:48and disable it.
- 32:50You'll notice that there's a lot of
- 32:52repetitive repetitiveness with this. So
- 32:56let's refer back to
- 32:59our thing right here. So you see that
- 33:01gamepad enabled returns a boolean value.
- 33:04So since we know that we can just say
- 33:07console controls frame visible equals
- 33:09user input service.gamepad enabled like
- 33:12so and that'll remove the need for that
- 33:15and then as well we can say mobile
- 33:17frame.visible equals user input service
- 33:19dot uh touch enabled
- 33:24and that should work. So now if we play
- 33:26the game, you notice that none of the
- 33:29GUIs are enabled. But let's go ahead and
- 33:32go over here to our emulator. So in
- 33:34order to access this little emulator
- 33:36thing, we can you have to go to test and
- 33:39you'll see something called device uh
- 33:42controller and
- 33:44player. So we can click on device and
- 33:47it'll it'll enable that. And we can go
- 33:49to our iPhone XR or whatever you want.
- 33:52So now if you play the game, you'll
- 33:53notice that we have our GUI pop up for
- 33:56mobile.
- 33:58And then we can just go over here to HD
- 34:011080 and you'll see that that's uh not
- 34:04enabled anymore.
- 34:07So also if we go on PS5 and we play the
- 34:10game, you notice that we have our
- 34:13controller things enabled.
- 34:18So let's switch back to here.
- 34:22and go to our client again.
- 34:26So now we actually want to make these
- 34:28buttons work. So let's start with our
- 34:30mobile frame
- 34:31first. We'll want to add in the
- 34:35M1's. So we can
- 34:38say user let's not do that. We can say
- 34:42mobile frame dot mobile one.button
- 34:45button dot mouse button
- 34:48one down connect function. So that's
- 34:51when you put your finger down on the
- 34:53button. We want to make the person start
- 34:56attacking. So in here you remember that
- 34:58we just fire a server for attack and
- 35:01then we did all these prerequisite
- 35:03functions over here. So in order to do
- 35:06that again we can just require the state
- 35:09service local state service or local
- 35:12[Music]
- 35:14modules and then we can get our state
- 35:19service dot state service and we'll just
- 35:22do that. And we also want to get our
- 35:24character.
- 35:27So let's do that.
- 35:36And there we go. That should be good.
- 35:38And we also want to get our
- 35:43remotes. And now our mobile thing should
- 35:49work. All right. Now that that's done,
- 35:51let's go ahead and play the game and
- 35:53equipped a weapon. So, let's go equip
- 35:56our dagger, for example.
- 36:02And you see that once we hold down M1,
- 36:05it'll work.
- 36:11But if we let go, it will stop working.
- 36:14And you'll notice that our jump button
- 36:15disappears because that's how we
- 36:17scripted it. We want the jump to be
- 36:19disabled while they're winning.
- 36:27Now, let's stop playing the game and
- 36:28let's go back to this
- 36:31And now we want to work on our mobile
- 36:34blocking.
- 36:37So we can say mobile frame mobile block
- 36:42dot mouse button one or button mouse
- 36:46button one down connect function. So
- 36:49this is when we're holding it down. We
- 36:50want them to block. So let's go over
- 36:53here and we'll look at how we did the
- 36:56blocking.block
- 36:59block fire
- 37:01server. And let's
- 37:05see. All
- 37:09right. Uh right
- 37:15here. Uh let's see how it wants to do
- 37:21this. All right. So we can go over here
- 37:23and we can say if not status folder find
- 37:26child blocking. Let's get our status
- 37:29folder. So we can say status folder
- 37:30equals character with child
- 37:32status, not
- 37:35huge. Then we'll just start let them
- 37:38block otherwise we'll just unblock. So
- 37:41we can say mobile block button mouse
- 37:44button went up. So it's when you release
- 37:46it, we can make them stop blocking. Stop
- 37:49blocking. So there we go. That should
- 37:53work. Oops. Need to switch it over to
- 37:56our mobile device.
- 37:58Then if you play the game and we will
- 38:00equip fists in this case
- 38:04and let's hold block. Oops.
- 38:18Wait. It's because I am on PC. I'm
- 38:22trying to attack because you notice that
- 38:23if I'm clicking on the screen, it'll
- 38:24attack because it because I'm on PC and
- 38:27the button works. But if you're on
- 38:30mobile, this will definitely work.
- 38:36Uh let's see what else you want. Okay,
- 38:39in order to fix that, we can do one
- 38:40thing. We can go over here and we can
- 38:44change this and we can
- 38:47say if if press one and we can say
- 38:52if if not user input service uh touch
- 38:57enabled or we can say if user input
- 38:59service touch enabled or user input
- 39:01service.gamepad enabled then we just
- 39:03want to not do anything because we don't
- 39:06want them to be accessing mobile and
- 39:08controller functions at the same time.
- 39:10Similarly, we will do the same with
- 39:12attacking or blocking.
- 39:15So over here, we can say that else we
- 39:18will allow them to block.
- 39:24Uh let's see what else we want to do
- 39:26right here as well. We can say
- 39:29if user service then else we will do it
- 39:33because we want to override
- 39:35functionality if they're on either um
- 39:37mobile or controller. And as for
- 39:40sprinting, let's see where we add in
- 39:42sprinting. It was this at the same spot
- 39:44right here.
- 39:47So, if um if they hold left shift or
- 39:51they're on
- 39:53mobile dot touch enabled, then we want
- 39:57them to sprint regardless cuz mobile
- 40:00players have a hard time like holding
- 40:02down both um both fingers at once. So,
- 40:06we just want to say, okay, if they're on
- 40:08mobile, we just give them automatic
- 40:10sprinting. So, now if we play the game,
- 40:13you notice that our M1 functionality
- 40:15isn't working anymore. If you click on
- 40:16the
- 40:17screen, and then if we go over here,
- 40:19you'll notice that we sprint immediately
- 40:21on mobile. And if we equipped M, our
- 40:24fist, M1 isn't working, but the M1 on
- 40:26the screen is working.
- 40:30If you hold block, you know this set
- 40:35works.
- 40:40So, all right. And if we go back to our
- 40:45screen and let's go ahead and add in
- 40:48dashing.
- 40:50So
- 40:53let's see how we worked on dashing
- 40:58over
- 41:01here. There we go. All right. So in
- 41:06[Music]
- 41:10our in our input script, we can make a
- 41:13function called dash like so, which
- 41:16would just handle all of our dashing
- 41:19things. I'm going just do dash.
- 41:22All right.
- 41:25So, rather than having to just add in a
- 41:27ton of new lines of code for just a
- 41:30single mobile dashing thing, we can just
- 41:32get the um the dash button and the
- 41:35mobile frame. So, in here we can say
- 41:38local player
- 41:39GUI equals Oh, wait. Yeah. Equals
- 41:45our local players G um local players
- 41:48GUI.
- 41:52We can say player width of child player
- 41:55GUI comma m.h
- 41:58and we'll get our
- 42:00controller mobile
- 42:02frame
- 42:07controller/mo.h and then now we can go
- 42:09ahead and get the mobile dash
- 42:11button. So down here we can say
- 42:14controller mobile frame mobile frame
- 42:17mobile dash
- 42:19that button, the mouse button, one
- 42:20click, connect function.
- 42:24And then we can just
- 42:26dash like so.
- 42:28And that should
- 42:32work. Now, if we play the
- 42:34game, you'll notice
- 42:38that we're dashing like
- 42:43so. And obviously you're on mobile, you
- 42:46can pre you can move your mouse while
- 42:48pressing dash at the same time.
- 42:51But if let's say if you're sitting
- 42:53still, we just want you to automatically
- 42:55be able to dash forward. So in the get
- 42:57dash direction function, we
- 43:00can see where I put it right
- 43:03here. We can just say return forward
- 43:07like so. So now regardless if you're
- 43:10moving or not, if you press dash, you
- 43:12just dash forward like so.
- 43:15And that's going to be the mobile
- 43:17compatibility thing. So once again,
- 43:21sword, you have
- 43:23betrayal, and then if you're blocking,
- 43:25you notice that okay,
- 43:30works. And once again, you see that,
- 43:33okay, your sprinting is constantly
- 43:36enabled. Do
- 43:37that. All right, now let's stop playing
- 43:39the game.
- 43:41Then now since we're done with our
- 43:44mobile compatibility, we can work on the
- 43:47controller.
- 43:52So we can
- 43:55say if user input service is uh key down
- 44:00enam.o
- 44:03um button A I believe is what the attack
- 44:07is. Let's
- 44:09see. or no button X.
- 44:13So if that button is held down, we will
- 44:16allow the player to
- 44:17attack. So we'll just say over here and
- 44:21allow them to attack.
- 44:23So now if you play the game
- 44:26and let's go ahead and enable our
- 44:29controller and let's move up a little
- 44:32bit and get a sword.
- 44:36Let's flip our sword.
- 44:37Let's hold uh let's hold X. Oops. All
- 44:41right. So now a fix for this is what we
- 44:44can do. We can just say
- 44:45is gamepad button
- 44:48down enum.gamepad one. And then we can
- 44:51say
- 44:53enam.keycode.button X I believe. Uh yes,
- 44:57button X. And now if we play the game,
- 45:00it should work. So let's go ahead and
- 45:02give us a sword. Let's hold down X. And
- 45:07now you notice that the slash finally
- 45:09works. And now we can do the same thing
- 45:13with blocking. So in here you'll notice
- 45:16that we have
- 45:17blocking. And now we just copy and paste
- 45:20this code up here.
- 45:23And then we can remove
- 45:25this. So we just comment controller or
- 45:28mobile.
- 45:31And then right here we'll just say
- 45:34remotes or
- 45:37if
- 45:39not go
- 45:41over here
- 45:47and let's do that.
- 45:52And we can say if not is typing
- 45:57then we
- 46:01say if controller then if user service
- 46:06if not user service is key down my key
- 46:11code.f then we want them to stop
- 46:14blocking. Otherwise, we'll go over here
- 46:17and copy and paste uh this right here.
- 46:22And for controller, we can say if not is
- 46:26button down button B, I believe, then we
- 46:29just want them to stop
- 46:31walking. And mobile remember is
- 46:33something different for that. And now
- 46:35over here, we can say
- 46:39if not status folder and if they're
- 46:42holding F then we want them to block.
- 46:44And same thing if set 45 have a shell
- 46:47blocking or not a shell blocking then we
- 46:50want to
- 46:51block. So if we play the game and we
- 46:54equip the
- 46:56tool you'll notice that if we equipped
- 47:00our tool right here X and if we hold B,
- 47:04you'll notice that we're blocking
- 47:05now. And obviously our well it seems
- 47:09like our unblocking thing is working. So
- 47:12the only part that could be is right
- 47:14around here.
- 47:17So let's see.
- 47:19All right. So one thing we can do is
- 47:21just go over here, remove the not is
- 47:23typing part and format our
- 47:28script. So right here, we'll just go
- 47:30ahead and remove all of this right
- 47:33here and remove this end and format the
- 47:36script.
- 47:38So we can go over here and
- 47:42say and not is typing. And we can go
- 47:45over here and say and not is
- 47:48typing. All right. And we can say else
- 47:51and we can copy and paste this. If
- 47:53status folder shell is blocking then
- 47:55false. And same thing over here. We can
- 47:58just say
- 48:00else. And that should be good.
- 48:04If we play the game and give ourself a
- 48:07sword and hold X, it'll work. If we
- 48:11block and unblock, it also works, too.
- 48:13Which is exactly what we want.
- 48:18All right. And the next thing we want to
- 48:20do is we also want to enable sprinting
- 48:22for uh controller as well. And this is a
- 48:26pretty simple oneliner. We go over here
- 48:28to our
- 48:30sprinting. Let's go ahead and find
- 48:32sprinting.
- 48:35uh right here or user input
- 48:38service.gamepad enabled
- 48:40then we want to constantly sprint. So
- 48:43you see that we constantly sprint now.
- 48:49All right. Now let's
- 48:53see the next thing we want to do is we
- 48:56want to add dashing for the
- 49:01for the
- 49:03controller. All right. Now, so if we
- 49:05want to add dashing, we can say
- 49:06input.keycode
- 49:08equals
- 49:10enum.keycode.button L3. Then we just
- 49:13want to dash like
- 49:14so. Now, if we play the game and we
- 49:17start
- 49:21dashing, oops, you notice that dashing
- 49:25works. And button 03 is basically just
- 49:29this button right here, the middle
- 49:30button. If we pressed on that, you see
- 49:33that it
- 49:34works. So, yeah, that's good. And once
- 49:37again, if we go over here
- 49:39and get us a
- 49:41weapon, in this case, we'll get pissed.
- 49:46And then we will equip our fist.
- 49:50Notice how the punching works. And if we
- 49:52dash
- 49:53or block, it works as well.
- 49:56And then if we punch the
- 50:01dummy and blocking also works.
- 50:06All
- 50:07right.
- 50:09Now, the next thing we want to do is
- 50:11just do a slight little uh bug fix,
- 50:14which is where making it to where you
- 50:16can't do any action at all when you die.
- 50:20So, if we go over here to our input, we
- 50:23can just say if we died like so, it says
- 50:27for find died, then we want to just
- 50:29disable the script. So, script.enabled
- 50:32equals false.
- 50:34And that should be good.
- 50:38So, that's pretty much going to wrap up
- 50:41this video. What we did today is that we
- 50:44just added in weapon trails and things
- 50:46like that. Just a few extra details and
- 50:50cosmetics to the game to make it look
- 50:52more more full. And we also add dashing
- 50:55sounds, which you see like that, and
- 50:57dashing
- 50:59effects. Um, so yeah, thank you for
- 51:01watching. Tomorrow's video is going to
- 51:04be the series finale or the ending of
- 51:07the whole combat series tutorial.
- 51:10Um, it'll just show everything that we
- 51:12added and go through every every single
- 51:15one of the scripts and explain a bit
- 51:17more in depth of what the thought
- 51:19process was behind it. And yeah, please
- 51:22leave a like uh and subscribe and thank
- 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.