Buzzy

Loading...

Buzzy

Register

Roblox Studio Tutorials - March 1, 2022

How to Make a Combat System

1

buzzygamesbri

@buzzygamesbri

Download – Combat System Script

How To – Make Group Only Areas in Roblox Studio

What’s up everyone welcome to buzzygames, my name is BuzzyGamesBeth and today I’ll be teaching you how to make a combat system in Roblox studio!

  • I’m going to teach you guys how to make a fairly simple combat system, more of a right punch. We’re going to spawn in a dummy rig. Click on build rig, I’m gonna do r15. We’re gonna click on animation editor. You can name your animation editor folder to whatever you want, I’m just gonna do right because it’s the right punch for me. The animation name doesn’t really have any kind of effect to the script or anything, it’s just for you to take note of.
  • Once you have that open, and you can move the limbs to however you want to animate it, make sure to set the animation priority to action. Then we’re going to export our animation, submit it, and then take note of the animation asset id. Go ahead and open the link up and then you only want to copy those numbers so that we can paste it inside of our script. Feel free to delete the dummy, we really don’t need it anymore.
  • Inside of Replicated Storage, we’re going to add a remote event, and I’m going to be renaming that to punch. Our remote event is anytime a player presses a key to do the animation or the punch, everybody in the server will be able to see it. They’ll be able to see the punch (that’s what a remote event is).
  • Now inside of server script service, we’re going to go ahead and add a script. Inside of our script, we have our variable which references our remote event punch inside of replicated storage. Anytime this remote event is going to be triggered, the damage that the punch does is going to be an x amount. For me it’ll be 15. If you want to change it, if you want anything lower or higher just change that number right there.
  • Inside of starter player and starter character scripts, go ahead and add a local script. Inside of that local script, we’re going to add an animation object. Paste your animation ID that you just saved into there that you just exported. I’m going to be renaming that to R punch because it’s right punch. Inside our local script, we have our variable which references the right punch animation and then we have the script.parent, humanoid and then the user input service which is going to be the key code we press to fire or trigger that animation. We have our d-bounds as always because we don’t want people to spam it, and then we have our remote event.
  • Now for our first function, it’s going to be that anytime a player presses the assigned key code, which is going to be R for me, then the animation is going to play, then stop.
  • So for our second function, this is going to be the touch event that fires when we’re in contact with another body part. Anytime a player or you wants to hit another humanoid, you’re gonna make sure that they’re only hitting it once at a time and they’re not spamming it. Now if it’s true then the body part that’s the remote event will be triggered. It’s going to get damaged.