Learn how to make a Roblox Game - Roblox combat system BLOCKING (episode 6)

Transcript: Learn how to make a Roblox Game - Roblox combat system BLOCKING (episode 6)

Hello guys, welcome back to the combat trees. This is the first video of 2022 which is pretty cool. Yes. And today we're gonna be making blocking. I've already made the animation see this? Yeah, I didn't see my I didn't say my animation. So I think I got to redo my animation, it's pretty simple. It's just one frame of animation. It's not gonna be that hard spoken to take one minute

okay. They should be fine to be honest, they should, they should be fine this is fine. We're gonna see my animation walking copy. Okay, and then we're gonna make a script and then at the end of walking, walking, walk animation. Just name this to animations. name this whatever you want. It doesn't really matter. Okay, I'm gonna rename this whole trip to blocking script. Talking, just naming this blocking local URL equals scheme, get service user input service. And then we're going to, we're going to be making the remote function. What I'm going to rename, I'm going to bring this to block function, okay. Local remote, local remote equals gamebird replica storage with the child block function. And then we're gonna make the character variables global equals for the pen. Because sketcher oops, not this character. Wait for child humanoid. Local animator. Animator is the animation variable. Animation equals animator, load animation script with a child which is called Gambia, just Anam. The EU is drawn in again, connected to the function. These are the parameters we've done this before typing, let me close the module script real quick. If typing them if the player is typing or interacting with the UI, then the script was stopped immediately. SQL code equals no code of F. I mean, the code is up to you but I'm going to use and for the clicking in users input type but for keys it's going to use key dude. This uses input type because for M ones for clicking and this is users this uses key code for syncing keys down we're gonna follow them up and we'll invoke server and then we're gonna stop the animation unleash should not stop playing and you asked on input and and connect Function key if the key that ended is F then invoke server admission stop Okay then let's meet the server script okay. So, in this blocking backhand, or whatever you want, local or remote equal schema dot replica storage with the child blocking function from a.on server invoke server invoke equals function. This is the parameter that is going to print the player if the function gets invoked We're not going to do anything too crazy right now we're gonna do this step by step so it's gonna be a simple video We're five minutes right now you there's going to be no errors oh my god what is this on weakens the odds it's a miss typo close to it Oh my God. Where is this animation? Notice okay. It's gonna work now and then we're gonna make it so

it adds the blocking attribute okay it works let's see the comment looks okay it doesn't break anything oh my god okay fine. Okay, now we're going to add an attribute.

And then we're gonna do something like this look server. Then we're gonna add in a parameter, lock release, when we unblock, we just need to unblock

and then lock the parameter should be called action. And this cannot pin the player on the action block on block block and block okay, it works it works it works

that's nice nice. Okay, then we're gonna check the action. If I can equals equals block then we're gonna change the attribute to change and add an attribute called blocking for some we meet these variables Okay, character set attribute King through hoops are able to unblock unblock them through character such as locking No, it can remove the blocking as we then go and check if the character is done or not

done blocking equals character good attribute locking local attacking character Katherine if attacking or stand or blocking then it's okay

see if this works I hope there's gonna be no errors because I don't know like hold on let me check that real quick. So she master blocking blocking okay now Okay Does it break anything okay doesn't make anything okay now for the combat system in order to combat whether they're just on the comment back and we're going to check if the character is blocking if humanoid we make the character variable for local character equals humanoid fine first ancestor. Athletes do here it a parent. Local blocking equals humanoid character garage blocking. Get attribute blocking. Blocking working capital B if walking down a character anime character okay let's see if this works or not. We're gonna add a attribute to this dummy. Let me switch this server could

not add an attribute blocking and then true make it into Boolean locking Boolean true let's see if this works nope yep works if the character is walking then

it will do nothing but if it if it's not blocking they don't damage yeah it works it works

yeah, it works. Okay, now I think I'm gonna make lock breaking and then block buffering Oh yeah, it's not it's gonna it's gonna be pretty easy yes walking then if combo equals equals five, then the standard character for let's see um, two seconds it's up to you if you want to change the duration or not then we're gonna remove the attribute it character oil changes to EU a a so so we can be free and share it from actually we don't have a humanoid variable so but but still though if you make a humanoid variable it's gonna be confused with this human variable so we're gonna rename this to em instead of humanoid character

attribute blocking No

I think this will work and then with no at a print to see if it works or not character print each character is blocked broken can we find out? Only find out if this boots not okay, was this Oh yeah. I can't concatenate ances with a string so I'm going to change this dot name

okay, we'll make the W long block blocking Boolean you get the true okay it works works it works but not as nice then the comment back and we're gonna check if the kicker is blocking blocking was actually blocking three names he e blocking e blocking Okay. E stands for enemy Medway and we blocking so young get confused okay monsters are blocking now we shouldn't be able to click while we're blocking. See before we were able to to punch while walking I think let me check Let me check.

Chu of this explain. Yeah

so that's why you got to add this so you don't punch while you're blocking okay now we're gonna add block buffering well I mean make it easier to change to stand on stand characters hold on

touched Oh co curricular parents God if the character is a humanoid witness done it's done true. Okay. Then we're gonna do the same thing except we remove the stun

you know, okay, let's see if this works okay if done right understand, and I can block I can Oh yeah. Oh yeah, I can adjust the animation playing feel playing under deliver the same thing with this that if

we're going to meet the blocking backend return of value return true

local R R doesn't stand for anything. It's just a random letter if R then immediately it's the same thing as this Yeah, so if if you watch my my previous video you get what I mean it's pretty simple. Okay, hold on Okay, than I understand myself and lock okay, it works now. It works. And then we're gonna add block buffering. So actually, I'm going to make a block breaking animation. Now I'm going to make a block breaking animation. So you guys can ask me on how to do that in the comment section. Let's just make it the animation real quick Okay, looks pretty decent. Okay, we'll be okay too good. Okay, okay.

publish this Robox change this whoops blog broken submit and then copy the Id put in the animation in the script. Looking back at animation I thought I called it the idea. I don't know why. It doesn't look

look broken. Clear. Let me copy it. Hope it works. There I don't need to renew this I'm here. Okay. And this comment count here. Let me open the up and we're gonna make we're gonna add in the animation

local e animator equals anime topic equals e animator. Load animation script up animation now we're gonna play the animation and we're gonna make the duration a bit longer yeah copy let's make this for like I don't know. By me cheesy FPS to 62 I don't know. It's up to you to be honest. What's mine duration? Three seconds. I should make this one second. Copy Paste. How do I copy and paste? Copy? Paste. Okay. So what is happening? Okay, make this one second. Publish robux blog broken Hello, I hope this works actually. Let's see if this will ever there's a delay though. I don't know why. There's this delay. Lot of nausea fixes but yeah, there's going to be delay

Yeah. Okay, let's see if this works. Actually, there isn't the latest one. Yeah, there's there's a delay because last time because the animation haven't loaded, loaded in yet. Like, the character haven't haven't loaded in loaded the animation, but after it loaded snugly anymore. So yeah, it's gonna be it's gonna be fine. And then you can click off this video right now if you answer but I'm gonna add block buffering. So what block buffering does is I'm explaining on on this blocking system to be like, when you're done writing, you can't block. But I want it to be like when you block when you're holding F, and then you get unstuck and you know, block immediately shouldn't have to read block because free blocking is really annoying. Like, you don't when you understand then you just got to keep rushing after and I don't like that in fighting games. You know, I wanted to keep holding F and then once I understand I wanted to block immediately. So I'm gonna do the runner. It's not that hard iPhones pretty easy. It's gonna be hard to explain to you. So let's make the block table

buffering table blocking them I'm gonna change to Okay, we're gonna add the character to the Buffington

character equals true in the table because it's going to store every single character that holds block. Let's see, I'm holding off, I'm holding blockchain, it's going to be sushi man's monster in this table. Again, let's say another player whose work there are going to be in this table as well. Player two equals true. So it's going to be like this. It's gonna, this is what the table will look like if players are walking. So yeah, if you're confused on a wide table, it's because there's only one script in this game, right? It's not, it's not inside of the character. If it's inside of the character, I can just use a normal variable instead of a table. But this song is one single strip inside a game. If, if it's inside the local script, FinTech, FinTech, local script, there's going to be a lot of copies of the script, and I can use to something like this local action. It's if it's buffering, it is camera making this key is to buffering start buffering block, I'm just gonna make this are not holding. But this time is one singular group, there's not any copies of the script, it's in several scripts service. So that's why I'm making it a table. Since there's not any copies of the script, the script will always be one. So I'm going to go into table drafting table. So to store the action of the player, the actions if whether or not the character is holding at or the character is letting go of F if you don't understand them, a notch veneziana good at explaining man. Okay, repeat. Wait until docking, or blocking the call because it was attacking. Until I didn't use the attacking variable because the variable saves the attribute. So it doesn't update some good news get attribute house or get attribute. Let me just if attacking or stand, then is going to keep waiting until the character is instant. Can attribute equals false? Or the character stops buffering the character or not actually does something like this. If not character get us where we stand. It's basically the same as character get attributes done equals equals false. So if you're going to do equals equals false, just to just do not do something like this. It's the same thing as equals equals false. Have you understand that? If you don't, then I don't know how to explain to you not buffering table locking, not blocking character. Okay, then we're going to do something like this. Since if the character stops holding f is going to stop repeating what we don't want. We don't want it so the character let's go F and then it says the attribute to blocking to true. So check if the character stops buffering not buffering table character, not loving table camera sensor the same thing as buffering table character equals equals false, then

and then something like this. Often table character equals no it's going to remove the character. Let's say I am blocking. I'm blocking. But when I let go of F, it's going to remove this index over We're just going to change this to Neil. Specifically same things for moving. So let's see if this works. I hope it does.