How To Make A Combat System In Roblox Studio [TUTORIAL]

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey what's up guys welcome to a brand new video today I'll be showing you how to make a combat punching skill in Roblox Studio how to create the animations the scripts and everything so let's get right into it make sure you guys join the academy down below I just opened the academy for scripting in Roblox studio for creating games developing and all that stuff how to get paid with commissions and all that so make sure to join is the first link in the description vuk Studios Academy and I'll be waiting for you there so to go ahead and get started you're going to go to stter pack you're going to create a new local script and we're going to basically call it we can say uh I don't know we can do combat skill we can even put it in starter character scripts but I think the starter pack is the best way uh for the script to be utilized and we're going to go ahead and reference the player first of all so we're going to do local player game. players. local player and then we're going to reference the user input service so game get service user input service to detect when we hit a key bind so for example let's say we want the skill to be on E we're going to basically utilize that so we're going to do uis input begin connect function boom so we're going to create two variables inside this function right here it's going to be uh input and is so if is equals to true then return end so this basically means if we go ahead and uh type something in the chat uh and we try to use a skill it's not going to work because we're typing in the chat that's just a safety barrier uh and we need to use that and then we're going to go ahead and see when the key is pressed or detected so we're going to do if input. key code equals to enum key code. let's say e then then we can say print e key is pressed boom so now we have that and then if we go ahead and get into the game we go to Output press e so e ke is pressed see right there so that's working now we're going to create a quick debounce so local debounce equals to false we're going to do debounce equals true let's say wait 2 seconds No 3 seconds the bounce equals to false so now we can go ahead and test it in game and we basically press the E key we can't press it oh yeah we didn't put one more line that's my bad so we have to do if debounce equals to true then return end and that will basically end the code if the if the code is on cool down so let's say we're spamming e and after 3 seconds it should just press again see there we go now the next step is to create a remote event inside of replicated storage so we're going to create a new remote event we're going to call it combat hit boom so we're going to create a new script inside of server script service so we're going to basically just name it combat server and then what we're going to do here is we're going to say game do server storage server script service or game. replicated storage first of all uh. combat hit fire server so this will basically fire the server from the client and then when we go right here we're going to do game. replicated storage. combat hit uh on server event connect function player just to reference the player and we can do print print player so right now when we press the E key it should print the E key is pressed and then it should print the player that pressed it so it took data from the client and then moved it back to the server script service and then it detected what the player is uh and the next thing we have to do is we have to make an animation and we're going to have to play it so to do that we're going to go ahead and go to uh I think it's in uh view or model so we're going to go to Avatar we're going to go to rig Builder and we're going to create a new rig you can choose whatever animation type you want I'll be doing R six for this video you're going to basically go to animation editor that's located in Avatar and we're going to create a quick punching animation which is going to be pretty simple like this we're going to just do a quick drawback him looking back at the Fist and this will basically just be a time lapse of me making the animation for the character we can maybe make it a little bit more Dynamic and then we can have a snap boom right here that basically just snaps the fist right there we can have him look over and then we can make this a lot more Smoother by basically copying this extending this and then doing a drawback like this for example so it has boom see now we can maybe edit it up a little bit to make it like this then we can do that copy this paste this and then we can just basically rotate him even more so now we have a cool punching animation and you guys can save this and then go ahead and click publish to Roblox submit it right here and then you just copy the ID and we're going to create a new instance right here named animation and then we're going to go ahead and paste this into the animation ID and then right there we have a skill already which we can use right here so we're going to do local animation equals to player. character. humanoid load animation script. animation and then we're going to basically do animation play Boom so right now when we go ahead and press the E key that animation of punching should play see again we have 3 second cool down now we can maybe make the animation better I know the problem so if you have stiff animations like this what you're going to do is you're going to set animation priority set it to action 4 and then publish and then do the same thing over again just copy the ID and then go ahead and paste it right here and then now the animation should a lot smoother and a lot better so let's say boom see there we go now we have a punch but it's still not doing any damage it's still not doing anything and I'm going to show you guys how you can make this much better and how you can utilize it so the thing we have to do is we have to go into the server script right here and we have to create a new hit box so we're going to call and by the way guys if you do want to learn everything I know about scripting and how to get commissions and how to get clients make sure to join the Discord down below I have a full Academy and a full course Main for you guys or you can check all the material get live calls and one-on-one coaching with me and that is pretty important uh Kickstart this business if you want to go ahead and uh get better at ROBLOX developing and all that stuff so again make sure to join the Discord down below I'm waiting for you and let's get back into the video uh what we have to do right here is we have to basically make a new part and we're going to basically name this part so we're going to do hitbox parent equals to workspace hitbox do anchored equals to true hitbox that can't Collide equals to false so this is basically just a hitbox we can put the transparency to one and then what we can do is we can go hitbox cframe equals to player. character. humanoid root part. cframe and then we can do game. debris at item uh hitbox to so this will basically destroy the hitbox after 2 seconds and we can maybe put a 0.5 so you guys can see when we do this that a hitbox does appear boom so it appears right there but it's not big enough so probably won't hit or detect so what we have to do is we can basically go ahead and move this further so we can do new 0 0 - 5 and then what we can do hitbox that size equals to Vector 3. new we can do 10 10 10 we go back boom now it has a hitbox and it just disappears after a few seconds so now we can go ahead and detect what when a player is hit by this hit box so the next step will be to create the detection for this hitbox what we're going to do is we're going to do hitbox do touched connect function hit I'm going to show you guys how to create uh the VFX and everything how to get that set up and running so what we're going to do right here we going to do if hit. parent uh name so first of all we're going to create a value list named hits local hits equals to boom and then we're going to do this line of code right here then I'm going to paste just give me a moment so what I pasted right here is basically it just checks uh so this function only PS if it detects a humanoid inside of the hit and then it doesn't detect the player's name so you can't hit yourself and then right here it just has a hit debound so it doesn't hit multiple times it basically only just hit once and then the hit box is destroyed and then that will basically so now if we do e so now if we do hit. parent find for child humanoid and we do take damage 10 so now if we go to the rig that I showcase right now if we go ahead and punch him he should be taking damage let's see boom so see he took damage now the hitbox is bigger you can customize the size of this I'm going to make it a little bit smaller so it detects a little bit better so we can do five 5 55 and then if we go ahead and test it now the hitbox should be a little bit smaller so now it detects a little bit better and now it just like deals damage uh and and stuff like that you can maybe make it a little bit bigger if you want to you can make it closer to yourself we can probably do that we can do minus two so it detects it a little bit better and now what we can do is we can go ahead and put a VFX so it kind of like hits and punches we can make a sound too so let's add a sound we're going to go and do punch right here we're going to find a punch yeah that one's good so we're going to basically insert this and then we're going to do uh local sound equals to uh script. hit punch clone we can clone it like this and then we can do sound. parent equals to we can copy this equals to boom and we can do sound play and then sound game. debris add sound add add sound add add item sorry sound after 2 seconds and then now when we hit the dummy there should be a sound so we missed him we have to there we go again now we can delay this right so it kind of hits him on the punch so what we can do is we can head back here and then we can play the animation and then we can copy this put it down here and then put a weight of like let's say 1 point or 2 seconds 0.2 seconds and then we can hit and now there should be no delays we should just hit like see now it's a lot smoother boom boom and now I'm going to show you guys how to add a hit effect uh so you guys can join the this Discord to download our free hit V effects uh so you can just basically import all of those I have free combat system that I made you can use hit effects from there you can create your own you can get a VFX artist to make them or you guys can join the academy down below and you guys can get the assets uh and all the packs that we provide on the stores that will be much easier uh to follow along this tutorial so make sure to join the Discord server down below so basically what I did right here is did for IV in pairs BH which is going to be the attachment get children do so we're going to do if I no if V uh is a particle emitter then so basically this just detects if the particles right here are particle emitters which all of them are and the point line is not so we're going to do V emit V get attrib attribute and mid count and then we can do game. debris at item BH Z we can do two now if we go ahead and test it let's see let's see if it plays out the effect boom see boom pretty simple uh now there's another thing we can do we can add knockback uh and I'm going to go real quick and and just uh make this fully transparent and we can add a knockback and I'm going to show you guys how to do that uh so to get our ragd doll module script what you guys can do is you can go ahead and either join the Discord uh of the portfolio server you can join the academy down below and get all the files there uh so you guys going to get the module script which I'm going put right here in just a second so I've just imported the uh R6 ragd doll script and the modules folder and we can go BAS basically and head back into this and go local m equals to require game. replicated source. modules. MSC and then we can do uh right here so mk. ragd doll so we can do hit. parent and let's say 2 seconds so right now what we do hit him it should look something like this and he should just fall over boom let's see what's not working uh oh yeah we have to go ahead and import something else just give me a moment so I just had to import one more script uh you can got you guys can find the rag doll script in our uh saitama Battlegrounds pack you guys can get that pack and just get all of these module scripts or you can join the academy or the Discord so now he should fall over when we hit him boom and we can create a good knockback effect by utilizing the miscellaneous uh module right here what we can do is we can do miss so right now I just pasted in this code it just basically as the knockback from the module script we utilized uh and now if you go ahead and press play everything should be good and now the dummy actually get knockback and ragdoll but this part is just optional if you guys want to uh use it so boom there we go and you guys can just like create a cool punching system now you can create it so like you have counts for example I'm going to show you how to make combos real quick so what you guys can do to make combos I'm not going to do it right now because the video will be too long but you guys can do local count equals to zero and then you can do if count equals to zero then so now it's boom and now we can do uh count equals to count count equals to count + 1 so now will be one so count equals to we're going to do uh if so if count equals to 1 then count equals to zero so we're going to just basically delay this for a little boom so uh weight 0.1 count equal to count + 1 then we have count equals to zero and then we can add a whole another animation right here so we can just p P all this in and add a different animation so boom and then what we can do is we can just basically remove this debounce right here and then paste this over up here and then we can create a new animation so we can basically just do let's say from here we delete this and then we can do a quick flip like just boom and he punches with this hand we can just do that real quick now he draws this hand back and then we can do like this we can rotate the head so it does like that boom we can just maybe put this key frame right here so it looks a little bit smoother bom then we can go ahead and publish to Roblox publish it again copy the ID and then we can do animation two paste this in and now you guys have a combo system which you can use to like hit once hit twice so see boom it kind of hits at the same time let me just click yeah we have to create a delay and now when we go back and actually press the two keys they should be ready to go one by one so boom boom and the thing is I just haven't pasted the new animation right here so we have to utilize the new animation which is two and then we can go ahead and press play it should now just play two animations like one after another so it's like kind of like a combo see so boom boom and now you guys can basically just create all of these counts you can do if count equals to two then you can just up the count again uh so right here count equals to Z yeah you just put like for example count equals to count plus one again you just copy this paste it right here and then on till the end of the combo where the combo resets and now you can just basically have a kind of a combat system which you can use and this is just basically a simple combat system you guys can use now you can remove all this rag doll so it's just Bas and that's it guys you basically just have a simple combat system now again you can create all of these combos really easily by just putting all of these counts and just increasing the number of animations so again make sure you guys join the community group down below I just open the academy you guys can learn how to script there you guys can learn how to get commissions how to work for games how to get hired and all that stuff so make sure to check that out and join the Discord uh and I'll see you guys in the next one peace
Info
Channel: Vuuk Studios
Views: 259,936
Rating: undefined out of 5
Keywords: roblox studio combat, roblox studio how to make combat, roblox studio combat system, roblox studio how to create a combat, roblox studio fist combat, roblox studio sword combat, roblox studio advanced combat, roblox studio free fist combat, roblox studio tutorial combat, roblox studio fist combat tutorial advanced, roblox combat giveaway, roblox fist combat giveaway, roblox sword giveaway, roblox combat system advanced giveaway, roblox advanced air combat script, combat script
Id: AX3rWUj5gRo
Channel Id: undefined
Length: 19min 5sec (1145 seconds)
Published: Mon Nov 20 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.