I need guidance on making a combat system

I want combat system, i love combat system, i want to add combat system like sword slashing in my game. I don’t know how to make combat system, yet.

So i want to ask anybody that is experienced in making combat system on how do you create combat system in your game?

No im not asking somebody to create the script for me. I just need the right direction on implementing combat in a game. So…

Main question i have :

  • For weapon, should i use LocalScript powered by RemoteEvent to register damage and hitbox or ServerScript to handle the animation, player slash hitbox, and damage hitbox?
  • What’s the best way to create a damage hitbox created by weapon? Should i instance an invisible part during slash powered by Touched event (I think this is unreliable, Touched event sucked), or should i use Region3 or OverlapsParams (I don’t have any idea why Region3 is deprecated)
  • If i should use OverlapParams, how do i make the check linger for a bit. What i mean by this is like during a slash, a hitbox will appear on your sword for, lets say for example, half a second. Is it healthy to use while i < 0.5 do RunService.Stepped:Wait() end to constantly check?

I will add more when another question arose.

When talking melee, it’s best you use a raycast-based hit-box. This hit-box would be created on the client to remove all latency in SFX and/or VFX involved with collisions. The client would inform the server of its detected collision, and the server would perform sanity checks to validate the client’s claim. A couple basic checks would involve the attacker’s ping and the victim’s distance from the attacker. There are open-source raycast-based hit-boxes for you to integrate or learn from. I recommend starting with ClientCast or RaycastHitboxV4. As for hit-box lifetimes, they should be kept, at maximum, to the duration of the attack animation

1 Like

I have general idea of raycast, and did more research about Raycasting. Then i find surely raycast would be helpful detecting so player cant attack through wall.

But thing is, i want to make the combat based on 3D hitbox, where you can visualize area-of-attack with a square. For example in item asylum, Hollow knight, and other indie games, when you enable hitbox, they have this red outline/red square that appear for a short period of time during an attack, that damage anything toucing it. Raycast however, since its based on ray point laser-like to detect hit. I don’t think mainly using raycast will match my vision of combat.

However, i will take the open-source community script you recommended for study