Roblox how to make a Game - Roblox combat system STUNS (episode 5)

Transcript: Roblox how to make a Game - Roblox combat system STUNS (episode 5)

Hello guys, welcome back to the Combat series. Today, we'll have Oops. Okay. Today, we'll be making stance. But first, let me pick something

since my code is so fucking cluttered, look at how messy This is. Okay, so my code and so my combat crew have local script, and the server script is inside of the server script. So I thought to myself, Hey, is having the same copies of a local script and putting it inside of character is a good idea. I did it. I did this superfan exploiters firing remote, which they don't have. But I'm not making a tutorial on how to make an RPG or fighting game. I'm making a tutorial on how to make the combat system like making the hitbox and making it to damage and stuff. So like, I don't think putting the server script inside of the local script is good practice. I'm not saying that's a good idea. So I'm just gonna put this in server script service. You don't need to worry about exploiters pointing the remotes which don't have units. We don't need to worry about that right now. Since this isn't a tutorial on how to tutorial on how to make a game. Yeah, I may make a tutorial on how to make an RPG soon. It's tutorial on a fighting game. That might be cool. It's still just gonna move the stuff inside duplicate storage. Since I want to only have one remote and one server script copies of the combat script is fine. But I don't think having the same copies of the combat server script is a good idea I think it'll make it less clean or something I don't know man. I don't think that's good practice. So I'm just gonna make this game with arbitrary storage with reach out my function. Same for here oops. Gain. Oh my god. Ah, wait for childhood fashion. We're going to put this here why is there a variable with combo and I don't think this is needed. I think this was for my old tutorial, episode one something which I am going to put remote above everything. So I think this will work. I guess. I'm Chuck

Okay, animations is not about number of local script. Let's see. Okay, animations is here is inside the little trip. So I'm guessing that the animation folder hasn't loaded yet. So I'm just going to do with the child animates. Right? Then we're gonna do the same thing for here. Okay. Let's see if this works. Okay, okay. Okay. Boom, right yeah, this works now. Okay. A shot. Yeah, it works fine. Okay, now, now this combat script looks really fucking messy. So I think it's because of this combo combos. Let me just move this into a function and I can make it more clean. This, this fashion is really awesome. Practicing practical. The parameters on both and the Mexico this case Maximum 45. But I think I'll just yeah, let's just put in the parameter isn't too bad. Okay. Instead of F color equals equals one, we're going to do F. If Cabo is smaller, and Max combo, in this case, it's going to be five combo is like 123 or four, then character care. Actually combo combo plus one. If the combo is the characters combos, one is going to change it to one plus one, which is two. If the characters combo is three, it's gonna change the thrips one, which is four. So yeah, you got it. The deal. Elson else if you don't want you don't want it. You don't want this code to fire. If the combo is bigger than max combo, you know, else F combo is equals to the max gumbo. Okay, if the combo is like five or something we think we think okay, combo calm combo, character. Set Attribute. One can reset combo. Okay. Let's see if this works on Oh, yeah, let me let me call the function for combo one. Okay. And pull the function first. Change combo. Change color change the character, the combo. Okay. Zero variable for familiar series combo, and a max combo which can be five since I have five animations. You know? It's it's I'm going to make five hits on this comment because I hate that. It looks looks bit messy. But change metal combo five. Yeah, I think we should listen. Let me find out

okay, okay, floating. Yeah, this works fine. Yeah, this works. This works. The other thing is, the combo doesn't reset. Notice. The combo is not resetting. So, we're gonna read and we're gonna make the combo reset. After Let's see one second. Okay. Wait, one if character attribute combo combo minus one equals combo then combo combo one. Okay, so why I did a monster heater was because when you when you click right, the combo changes to two. But Europe Europe Euro the animation is playing the first combo, twin combo one. I'm trying to find I'm doing this. So find the combo that the character punched in like what combo the character punch in. Let's see the current combo is two but the character punched while he has one combo. Okay. Yeah. So yeah, that's why I did the minus sign to find the combo that the character punched in. Knocked me up punch your combos one. You're playing the first animation and then it changed to but I don't want to find the combo that kept me did not punch in that I did on minus one. Okay, I think this look let's see. Let's find out. We'll find out. Okay. Okay. Let's see if it resets. Yeah, yeah, it works. It works. Okay, you know, it cleans pretty clean. Now I'm going to do the stunning okay. For the stunning there's a module script called stun handler. can find it in the toolbox. Start handling

this module is really good. Okay, I'm going to put it put this inside modules and wire the module. Let's see you can

remove this modules just gonna mean sh require game storage modules to handle that then we're going to stun the player, okay? And stun the player. I'm going to remove the sprint. We're going to stand the player for let's say point 170. No, no, no country sevens. First, to get off in this first study to stand up here, you need to do Stan had ordered Stan humanoid, that unit not the character number. We're not going to use the character for selling. It's not Stan character. But it's actually Stan humanoid. It's pretty interesting, but it is what it is. It's kind of weird, but you know, I mean, not the one that we the module. It's gonna stun the humanoid for the Sunya the human parameter and the duration. Okay. We're gonna message Stan. Stan. Okay. Ach that's done with the humanoid. parameter. And then region. It's going to be one, three sevens. I mean, it's up to you, if you want to make it. If you want to stand back and wait for one seven days. It's in capital is each fit what now? 25.35. I think this will work. Okay, let's see, let's see. It's kind of weird that you need to use the human is of the character or the carpet, you know, it is what it is. Okay, boom, done. See, works perfectly fine. It's some really good margin, it also changes the Oh yeah, the speed to 00. This. It's really cool. And it doesn't automatically change the speed back to 16. But it changes to the previous speed, which is really cool. Usually, in some modules, it changes the speed to 16. But that's not gonna be good. If your default speed is like 30 or something. So this is the full speed with three. We look at three, we punch and boom, zero, better three. And here's a problem, okay. So when you click, your character gets done, okay? That's going to be a second attribute. But when you get stung by someone else, let's say for five seconds, but the duration won't matter because you'll get on stand in point 25 seconds. That's such a bad problem. So instead of changing the attribute to stand, we're gonna make a different attribute called attacking Okay, attacking something true or false. Okay, if we also move this off stun equals equals true, and that's another way to actually packing and we don't need to change meet. equals equals true sense. If done is the same as it's done equals equals true. So yeah, that seemed that's the same or, or attacking, then through if the character is done, or the head is attacking. Let's see if this works yeah, it works. And instead of changing this to false, I'm just change this to nil. I'm gonna straight up delete the attribute, multiple importantly, this since this Bheema useless.

Oops, that is something okay. I think there's a look Yeah. Yeah, this is fine. So the thing is, right, there is an animation problem. So when your character is done, then it's gonna return and it's gonna not gonna start the script is going to stop the script immediately. But the thing is, latency exists. And let's say you have a 1000 thing, and there's going to be a two second delay.

But the thing is, you may be understand right now, you may be not standard now, but in two seconds, you may be stunned. See, yeah, so that's gonna be a problem. So but the thing is, once you stand here, the hitbox one start, but the fucking animation will. So there's, there's, so we're going to remove this to simulate the problem. As you can see, my animations are overlapping. And you don't want to see that happening. So So there's so remote functions can return something that's really cool. That's why I use more. More functions can return a value like this. Although diversity, then you can just be okay. B, B is the remote function. And then we're gonna make good return. Let's see return. Hello. It will print print out. Hello. Since returns work on what nonconceptual who put this

hello, hello? Hello? Hello. Yeah

it returns meal, because the character was still attacking. So yeah. So I'm gonna return true. Like this, okay. As you can see, let me play again. I mean, again, as you can see, it prints out no, because at this point in time, I am still attacking or understand. Okay, that will be really useful for for the script, okay. So we can just do something like this. If d, then it's the same as if t equals equals true. Character, animation to play, okay. And it'll fix out the problem where the animations were overlapping. But this

that's, that's pretty cool. Yeah, that's cool. All right. That's pretty cool. And I'm pretty sure that's all arrays. Which would that's the end of the video. That's all I want to say. I think Hold on. Let me find it first. Let's see if I need something to change. No, I'm just gonna change is the same as pointing five. We let me explain something. You may be wondering why I did. Point 25. I will continue five and then start talking to Neil. It's because in my animation, it'll take point 25 seconds after the animation starts for the animation to stop. So it's basically point 09 seconds after the punch lands. So yeah, if you're not asking that's it for this video. See you guys next time next time. I'm Mike. I think I'm gonna make blocking next time. Yeah, I think I'm gonna make blocking. Okay, so that's it for this video. See you next time.