[Part5] Roblox Combat System for Beginners | VFX — Transcript
Full transcript
- 0:00All right, welcome back. Um, today's
- 0:03video is going to be how to do visual
- 0:06effects or V effects for the combat. So,
- 0:10you'll notice that so far all we just
- 0:13have is a sort of a just a raw
- 0:17combat, which if you just play the game
- 0:19right now, you'll see that it's just
- 0:21really bare bones right now. There's
- 0:22nothing there's nothing impactful in the
- 0:25combat.
- 0:27So, in this video, I'm going to focus on
- 0:29how to make visual effects for when you
- 0:31hit things and for blocking and things
- 0:34like
- 0:36that. So, the first thing we want to do
- 0:39is make a local script in here called
- 0:42client effects, which the reason we want
- 0:45to make this in starter player is
- 0:48because we don't want this local script
- 0:50to refresh every single time the player
- 0:52dies. Because if we were to put this in
- 0:54starter character scripts, this client
- 0:57effect script would re
- 0:59um would refresh or reset every time the
- 1:02player responds. So, we'll keep this in
- 1:04starter play
- 1:06scripts. Let's just call this client
- 1:08effects. The comment and we're going to
- 1:10make a remote event in here
- 1:13called client effects. Like so.
- 1:17Now, I know a lot of other videos they
- 1:21they show you how to do effects on the
- 1:23server, which what I mean by that is
- 1:26let's open up our default hit effect.
- 1:30They tell you, okay, if we want like a
- 1:32particle, we just clone a particle like
- 1:36particle clone like so, and we emit or
- 1:40like clone emit like so. But this is
- 1:43actually really bad practice because the
- 1:45server doesn't like having a lot of
- 1:47strain put on it. So anything that's
- 1:52not going to be necessary on the server,
- 1:55we should always do it on the client.
- 1:58For example, particles or visual
- 2:01effects. So let's say for our default,
- 2:06which this is just a raw, you just hit
- 2:08the character or you hit the target and
- 2:10they get pushed back. So we can say
- 2:12replicated storage remotes the client
- 2:14effects fire all clients like
- 2:18so and then after that can go over here
- 2:21and we can actually listen for the fire
- 2:24client
- 2:25event. So let's go over here we get
- 2:29the client
- 2:32effects and then we can say
- 2:34remotesclient effects unclan event
- 2:36connect
- 2:37function. So you'll see any argument
- 2:41that you put in here will correspond to
- 2:44the arguments in
- 2:46here. Now there's two different fire
- 2:49clients, right? You have fire all
- 2:52clients and you have replicate
- 2:55storage.client fire client which is just
- 2:57a single specific client. So you see
- 3:00that there's automatically an argument
- 3:02here called
- 3:04player. So in this case you want to
- 3:07reference to the client you want to fire
- 3:09to. Let's just say uh attacker and then
- 3:14after that any variable following this
- 3:17would correspond to this. So let's say
- 3:19action, argument
- 3:22data. It's going to be table and we can
- 3:24call a
- 3:25string. Let's press
- 3:27enter. So this argument, the attacker
- 3:32argument doesn't correspond to any of
- 3:33these. it's already
- 3:35implied. But if we say blah blah blah
- 3:38and whatever table we want, these two
- 3:41arguments are going to correspond to the
- 3:43action and argument data. So I just want
- 3:46to note make that a note for you. But in
- 3:48this case, we need to fire all clients,
- 3:50which doesn't need the player argument
- 3:53inside of it because you're firing every
- 3:55single client for the player in the
- 3:57game. So we can
- 3:59say for the action we want it to be
- 4:03default hit effect. So default hit
- 4:08and then we want to add some arguments
- 4:09in
- 4:11here. So we want the client to know who
- 4:14exactly we're hitting. So we can say uh
- 4:17target is equal to target hit. So oops
- 4:22target hit. And then if we want a sort
- 4:24of like unique default hit effect, we
- 4:26can also use the weapon use string like
- 4:32so. Now in here we have to actually
- 4:37acknowledge these arguments. So we can
- 4:38say if action equals default hit, which
- 4:42is
- 4:43this, then we can get the argument data,
- 4:46which is the target, weapon used, and
- 4:47anything else we put in here.
- 4:51But for Yep. So let's keep it like
- 4:56that and
- 4:58then we'll just do it accordingly.
- 5:01However, I want to note
- 5:04that let's say you have a lot of client
- 5:06effects. You don't want to keep on
- 5:07duplicating it like this and just fill
- 5:09up your script with thousands of lines.
- 5:12So this is where modules comes into
- 5:13play. So like we've been doing
- 5:16previously like caching the modules,
- 5:18we're going to do the same for here.
- 5:20So let's go over here to modules and
- 5:22let's make a folder called
- 5:25client and then we can also because this
- 5:27is only be accessed by the
- 5:29client. This is going to be sort of like
- 5:31an organization type of um
- 5:34purpose and we can say effects or we can
- 5:38just remove this and say client effects
- 5:40like so. I'm going to do it this way so
- 5:43we don't have a lot of nested folders.
- 5:45And then we're going to make a module
- 5:46script called default hit.
- 5:51Okay. And then we want to say return
- 5:53function and our arguments. So let's say
- 5:56argument data
- 5:58any we go.
- 6:01Now we can go to our client effects and
- 6:03we can cache these.
- 6:06Now, I also want to note once again that
- 6:10the reason we're doing it for starter
- 6:11player scripts um in relation to to the
- 6:14modules, if we do it in starter
- 6:16character, it's going to refresh and
- 6:18it's going to reach all these effects
- 6:20and we don't want that. So, we only want
- 6:23it to cache it once and then do the
- 6:24effects
- 6:25accordingly. So, we can say local
- 6:28cacheed effects like
- 6:31so. And then we can require all these
- 6:34modules. So we can say local
- 6:40modules. And then after that we can go
- 6:42underscore, module and modules.client
- 6:45effects children
- 6:47do. If it's a module
- 6:49script then cast effects module.name is
- 6:53require
- 6:55module. Now we can say if cast effects
- 7:00or local found effect
- 7:03cast effects action. And if we found the
- 7:06effect, then we want to just run the
- 7:08function like
- 7:10so. So we can say found effect open
- 7:13parenthesis. And it just auto fills it
- 7:15in for you because it's a function.
- 7:17We're returning a
- 7:19function. Let's just call this default
- 7:22hit. And we can say argument data
- 7:24because that's the type of data that
- 7:26we're looking for.
- 7:28Now, I have in I have linked in the
- 7:30description all the resources you need,
- 7:32including sounds, things like that. So,
- 7:35I already put sounds into my replicated
- 7:37storage, the assets that sounds like
- 7:39that. But y'all can organize it however
- 7:41you want. But now you have the effects
- 7:45right here.
- 7:48Now we can go over here
- 7:51to this paste
- 7:53inside and then or no let's just go over
- 7:56here and go to assets and
- 7:59say effects like
- 8:01so let's name this the core effects
- 8:04because the core effects is going to
- 8:06contain like all of
- 8:08the all the effects that we should have
- 8:11like hit effect block and things like
- 8:13that.
- 8:15So remember that we have the arguments
- 8:17for target and weapon used. So we can
- 8:20say local target equals argument
- 8:22data target local weapon used
- 8:27equals argument data weapon
- 8:32used. So we say if target and weapon
- 8:34used
- 8:36then so we want to parent these
- 8:39attachments to the humanoid report. So
- 8:44we can say local root part equals target
- 8:47find for child humanoid root part. If
- 8:50root part then we'll clone this. So
- 8:54let's get the variables in here. Uh
- 8:57initiate the
- 9:00variables local
- 9:03assets and then we can say local
- 9:09um effects equals assets.x
- 9:14And now we can clone these
- 9:19attachments. So local clone
- 9:23equals effects docore effects do hit
- 9:26effect clone clone.parent equals root
- 9:29part. Now let's say if we want to add
- 9:32like a different type of hit effect, we
- 9:36can say if weapon used equals equals
- 9:37katana also weapon used equals fist.
- 9:41Then we can clone a head effect
- 9:43accordingly. For now, we're just going
- 9:45to use the normal head
- 9:46effect. Then once you parent it, we can
- 9:49emit the effects inside.
- 9:53for underscore comma effect or let's
- 9:56just do V and clone get descendants to V
- 10:00is a particle emitter then V
- 10:02emits and you see that V emit is a
- 10:06method of particle emitter so it just
- 10:08emits all of the
- 10:10um particles inside based on a certain
- 10:13count. So in here I have an attribute
- 10:15called emit count which we can say v get
- 10:18attributes
- 10:20oops v get attribute emit count like so
- 10:24and it's going to emit based on the
- 10:26number in
- 10:27each and there's also also something
- 10:30called emit delay. So we can say if v
- 10:33get
- 10:34attribute emit delay is greater than
- 10:38zero then test
- 10:40delay get attribute delay and then after
- 10:44that we can say emit
- 10:47otherwise we can just omit it normally.
- 10:52Now for debris service
- 10:55because we want to actually remove the
- 10:56effects after a certain amount of time.
- 10:58So, we say debris.
- 11:00Make sure you're outside of the loop.
- 11:03And we can say debris, add item, clone,
- 11:05comma, let's say one and a half seconds.
- 11:08Give a little bit time for it
- 11:11to be good for our default hit.
- 11:16So, if we play the game
- 11:23and we punch, we have nothing yet. But
- 11:25if we punch, hit on me. You see that the
- 11:29effects are emitting like so. And
- 11:31because we haven't added any effects for
- 11:33the block yet, doesn't work. But you see
- 11:36that this is the normal hit effect. But
- 11:38if he's walking, there's no
- 11:41effect. But now we also want to
- 11:44[Music]
- 11:46add we want to add
- 11:50sounds. So let's make another module
- 11:52called
- 11:54sound. Like
- 11:56so. Now in here we can get rid of
- 11:59these and we can go back to here and
- 12:03fire all clients again. But in this case
- 12:05we want to call the sound as it
- 12:07corresponds to this client effect here.
- 12:10And then we can say sound
- 12:14name is equal to the hit sound. So, if
- 12:17you go to
- 12:18sounds like that, we can open this right
- 12:23here and we can say
- 12:25uh let's say
- 12:27fist do hit dot and whatever the combo
- 12:32string is. So, we need to actually go
- 12:33over here to
- 12:35fist and we need to pass in the combo
- 12:39string.
- 12:41So we want to say true screen
- 12:45number like so and if we get a default
- 12:48we can add in the combo string number.
- 12:52So combo string number let's just call
- 12:54that
- 12:55number. Now we can say dot dot dot two
- 13:00string combo string number and we want
- 13:02to parent it to the target hit humanoid
- 13:07part like so.
- 13:10So now that will play sounds,
- 13:13but we need to actually reference the
- 13:15sounds in the mouse rule.
- 13:18So
- 13:20the fist hit is we're going to use the
- 13:22same type of thing we did for the
- 13:25animations when we loaded them, which is
- 13:27this. So we can just go over here and
- 13:30then we can just copy that type line of
- 13:32code
- 13:34and then we can go to sound
- 13:38and we want sound
- 13:39name equal parent equals argument data.
- 13:45No,
- 13:46if sound name and parent, then
- 13:51let's make that should be a string and
- 13:53this should
- 13:54be a base part or it's fine. We'll just
- 13:59keep that empty because we don't know
- 14:00what it's going to be. But we'll just do
- 14:03base part question mark because we don't
- 14:04know if it's actually going to be bass
- 14:06part. And then we can say local found
- 14:10sound equals no.
- 14:15Or we don't even need to do that. Let's
- 14:17cash all these sounds in first. So local
- 14:21cached sounds like
- 14:24so. And then for underscore,
- 14:27sound in assets sounds get descendants
- 14:32too. And we can do this. If sound is a
- 14:35sound
- 14:37then full name sound get full name and
- 14:40then cash
- 14:43sounds.name equal sound like
- 14:47so
- 14:49equals cash sound name if found sound
- 14:53then local clone found sound clone
- 14:56clone.p parent equals the parent we say
- 14:59clone
- 15:01play and then we can say task.lay delay
- 15:04found time length because we want it to
- 15:06remove after a certain amount or we can
- 15:09just say yeah this this will be fine. We
- 15:12can do test delay or we can do debris
- 15:14add item but I'm just going to do test
- 15:17for now.
- 15:19So clone
- 15:21destroy like
- 15:25so. Now we can get out of this
- 15:28script. Close out of this. Go back to
- 15:32default. So now we should have a fist
- 15:36sound. So play the
- 15:39game. Walk up and we hit him.
- 15:43It's weird. There's no sound.
- 15:46Okay, let's see. Let's go over here
- 15:50to our
- 15:54sound. Let's say let's do print sound
- 15:58name,
- 16:00parent. Um, let's see. Uh, oops. I need
- 16:05to change this to full name instead of
- 16:07sound
- 16:08name. And now if we
- 16:15play sounds as you can
- 16:19see like
- 16:23so. And then now we want to add a swing
- 16:27sound. So I have a bunch of swing sounds
- 16:29that I have for y'all.
- 16:31And similarly, we can go to default and
- 16:33just clone this line of code and say
- 16:36fist. Like that.
- 16:40Or let's not do this because this is in
- 16:41the default um the default function
- 16:44which means you already hit the target.
- 16:47So we want to go to fist and we want to
- 16:49go to when the hit box starts
- 16:53like so. So
- 16:56fist. Two string swing number two screen
- 16:59number.
- 17:00You want to parent it to the character
- 17:03humanity report.
- 17:06Now if we play the game, you see
- 17:10that your swing sounds
- 17:18like so. Let's remove the prints now
- 17:21since we debug
- 17:23that. Remove
- 17:26it. And that's going to be it for the
- 17:29default effect or the visual effects at
- 17:32least. Now we want to actually do the
- 17:35knockback.
- 17:37So we're going to use something called
- 17:38body
- 17:39velocity. So local knockback
- 17:44velocity body
- 17:46velocity knockback velocity to max force
- 17:50equals 44 comma 0a 44. So, the reason we
- 17:55do this and we set everything else 44
- 17:59but the Y zero is because we don't want
- 18:02the knock back to be affecting how the
- 18:03character moves in the air. We just
- 18:06wanted to knock them back, not up or
- 18:08not, anything like that. And now we'll
- 18:10set the velocity velocity
- 18:13equals character oops dot attacker human
- 18:19part C frame. vector
- 18:22times uh let's say 10 or let's do five
- 18:27or six and we want to pair
- 18:30it character equals target hits humanoid
- 18:35report like so we want to add debris so
- 18:41it removes the knock back after a
- 18:43certain amount of
- 18:45time knockback comma.3 like So,
- 18:50and we want to make sure that all these
- 18:52dummies are unanchored as well.
- 18:56So, we want the humanoid report to be
- 18:58unanchored.
- 19:02Like so.
- 19:04Now, if you play the game, you'll see
- 19:06that they get knocked
- 19:18back. Okay, let's make this knock back a
- 19:21little bit more intense. So, let's say
- 19:23times 10 and we'll say two like so. Or
- 19:27we can say
- 19:2813. And then we can also since we
- 19:31knocked the car the target back, we want
- 19:32to push the player forward a little bit
- 19:34too to make it smoother. So we'll go
- 19:36over here and we'll say pull
- 19:41velocity like so. And we want to make
- 19:44this around
- 19:4510. We want to parent it to the actual
- 19:48character or the attacker's human
- 19:51part. Like
- 19:57so. Now if we put
- 20:06again, see he gets pushed back. Uh I'm
- 20:10going to give him infinite health for
- 20:11now. So we don't need to worry about him
- 20:13dying on us. So we just say max health
- 20:16999 all the way. And then we can say
- 20:19health all the way to 99 as
- 20:22well.
- 20:24So all right. And
- 20:27then let's go ahead and make this
- 20:29duration a bit shorter. And we'll that
- 20:31should be good. Let's make this around
- 20:3411 or 12 and 8
- 20:41n. Let's say that this is going to be
- 20:45our last
- 20:47hit, which is our block break in this
- 20:50case. So we can
- 20:51say add another variable here called
- 20:54last hit boolean.
- 20:56There's going to be a boolean
- 20:57value. We can go to fist
- 21:02and we can
- 21:05say or
- 21:07constant where is it? Our true swing
- 21:10number. True screen
- 21:12number= 5 and true or false. So if it's
- 21:16the last hit then we do true otherwise
- 21:19it's going to be
- 21:20false. Now we go to default.
- 21:24We can say if last
- 21:28hit then else. So if it's the last hit
- 21:31then we want to do a really far knock
- 21:33back. Otherwise we'll do the normal
- 21:35velocity. So let's go over here and
- 21:38we'll say make this like
- 21:4040. Like so.
- 21:45And then now if you play the game
- 21:52so that he gets knocked back far on
- 21:54last.
- 21:57Let's make him knock back a little bit
- 21:58further so we can go to default and make
- 22:00it like 60
- 22:01instead. And if you play the game,
- 22:07you will see that he gets knocked back
- 22:08even
- 22:11further like
- 22:13so. Now we've officially finished with
- 22:16the defaults hit type finally so we can
- 22:20get out of that script and then we can
- 22:22go to our block.
- 22:26Now let's just copy and paste all of the
- 22:28things that we want here. So we want
- 22:31these things right here the sound and
- 22:33yeah. So we can say
- 22:37that and we also want the combo string
- 22:40number in here too. Let's go ahead and
- 22:43copy
- 22:49this. Let's add these all back into here
- 22:54like
- 22:55so. And then now we can go right here
- 22:59and we can say
- 23:00fist.blocked like
- 23:03so.blocked
- 23:04dot comma string number. So that's fine.
- 23:07And we can say block
- 23:08effect like so.
- 23:14So we can duplicate the default hit and
- 23:15change this to
- 23:17blocked. Then over here we can just
- 23:19clone the blocked like so. And that's
- 23:22going to be it for the
- 23:25block. Hit start. So the a common thing
- 23:28you'll notice when you're scripting
- 23:29these sort of client effect things is
- 23:32that it's really sort of just value
- 23:34changing to an extent because you see
- 23:37here we just only need to change one
- 23:39thing and that constitutes the whole
- 23:42visual portion of the block
- 23:44effect. Same with default hit. So yeah,
- 23:48I just wanted yall to note
- 23:50that. And then we want to also change
- 23:53this to block effect so we can match it
- 23:56up with the actual action.
- 24:00And if we play the game, we should have
- 24:03a
- 24:07block. Oh, let's see what happened here.
- 24:11A ve attribute emit delay.
- 24:15Ah, I see. Okay. A ve attribute emit
- 24:18delay and
- 24:22greater than zero then so if the if the
- 24:25mid delay is there then we check if it's
- 24:27greater than zero otherwise we do
- 24:29nothing so let's do the same thing for
- 24:32the default hit so it doesn't error as
- 24:34well
- 24:37we go
- 24:45now you see we have the hit effects or
- 24:49the block effects
- 24:52Now, we also want to do the block
- 24:54sounds.
- 24:57So, we'll see that blocked. And we have
- 25:01these sounds right here,
- 25:04like so.
- 25:07So, we want fist.block dot combo string
- 25:11number.
- 25:15Okay, I see. So we want to randomize
- 25:17these instead of just doing the comma
- 25:19string number. So we can say local
- 25:22random
- 25:23number
- 25:26random one comma 4 because that's the
- 25:29amount
- 25:30here. And then we can just say two
- 25:32string random number.
- 25:36So that should be good. Two string
- 25:38random number. I'm going to target it so
- 25:41that
- 25:51There we go. That works. So, we have the
- 25:54sound. One, two, three,
- 25:57four. And now, now that's done, we want
- 26:00to do the actual block break effect.
- 26:03So, let's go ahead and clone this again.
- 26:08And we can call this block
- 26:12break. And let's go into our hit
- 26:15effects and we can say we can duplicate
- 26:19or copy and paste these effects
- 26:22here and then go over here to block
- 26:25break. So we want to have a sound in
- 26:27here and it should be called just block
- 26:30break and then parent it to target hit
- 26:33and block break like so.
- 26:37Now we can go to our visual effect
- 26:40and I have an effect in here for the B
- 26:44break called dizzy effect. So let's
- 26:47clone this in here. Now in this case
- 26:49it's not a value changing. We're
- 26:50actually scripting something new. So
- 26:52we'll local clone effects dizzy effect
- 26:57clone clone parent equals
- 27:01the
- 27:02target. And then we can we want to weld
- 27:05this So we can say local
- 27:10weld weld part O. We want to weld the
- 27:14target's
- 27:15head to this
- 27:18part. Parent equals clone.
- 27:23Like so.
- 27:25Let's make this all work before we
- 27:27actually clone the dizzy effect.
- 27:30Now that the world works, we can
- 27:35have a duration on it. So here we can
- 27:37say local duration
- 27:40number argument data
- 27:44duration. We need to go over here and
- 27:46also add duration in here too.
- 27:50Oh wait, we just changed this. Okay,
- 27:54we'll just rename this to block break
- 27:55and we'll name this to block effect.
- 27:56It's
- 27:57fine. There we go.
- 28:02Now we have we want to add a duration
- 28:04value in here. So duration is equal to
- 28:071.5
- 28:11like so cuz we want it to match with
- 28:13this duration that we already listed.
- 28:17Now we can say test set duration comma
- 28:20function and we want to make it smoothly
- 28:23transition out. So instead of destroying
- 28:25it, we want to actually disable the
- 28:28effects.
- 28:30So in clone get children do or get
- 28:34descendants
- 28:38if effect is a particle emitter then
- 28:41effect enable equals false like so and
- 28:44then we want to destroy it after maybe
- 28:46like one and a half
- 28:47seconds. Give it a little bit time for
- 28:49it to fade out.
- 28:53So now if we play the
- 28:55game, you'll see that we have our block
- 28:58effect or a block break
- 29:02effect like so.
- 29:10And it fades away smoothly too. And then
- 29:14also we want to clone after we finish
- 29:16the dizzy effect, we want to clone the
- 29:17actual block effect now. So, we can go
- 29:20over here and we can go to default
- 29:25hit and just clone this or copy and
- 29:28paste this
- 29:30part. So, we can go in here and we can
- 29:33make this a different thread. And there
- 29:35we go. And we can change this to block
- 29:40break. Now, if we play the game, we
- 29:43should als we have should have a
- 29:45combination of the dizzy effect and the
- 29:47block break effect.
- 29:52like so.
- 30:00And now you see him auto blocking after
- 30:02we finish the combo.
- 30:05And yeah, that's it for that. And if we
- 30:08go over here to just a normal hit dummy,
- 30:13we'll see just a normal hit effect.
- 30:18So yeah, that's going to be pretty much
- 30:22it for this episode. So just a brief
- 30:26wrap-up, what we did today was we
- 30:30created a client effects
- 30:33um local script that calls off of a
- 30:35remote event, which is client event
- 30:37client effects. And then we cached all
- 30:40the modules called client effects in
- 30:42here and we called them whenever the
- 30:45remote event was fired.
- 30:48So once again noting the usefulness for
- 30:50this, we don't need
- 30:51to have over a thousand line scripts in
- 30:54here by just duplicating this and this
- 30:56over again. We just have a single
- 30:59function or a single line calling the
- 31:02function and which corresponds to these.
- 31:06So yeah, that's pretty much going to be
- 31:08the end of the episode. The next episode
- 31:10is going to
- 31:11be on, I believe, movements. It's either
- 31:15going to be on a movement system, which
- 31:17is sprinting and dashing,
- 31:20or adding different weapons like the
- 31:22katana, a sword, a dagger, and things
- 31:25like that. So yeah, hope you enjoyed it.
About this transcript
This page contains the full transcript of [Part5] Roblox Combat System for Beginners | VFX by Senko, generated from the public captions YouTube serves with the video. The transcript has 3,968 words across 648 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.