So I’ve picked up on scripting recently, and i want to make a little combat system, nothing out of ordinary.
During my search i came across various ways to implement a combat system.
I was aiming for something like ABA, Grand Piece, Project slayers, Demonfall etc, in other words, the usual 4 M1’s combo with a little stunlock between the M1’s, that ends with a throw.
My doubt is should i use raycastng, touched, region3, magnitude? I would like to know the difference between these hitboxes “types” too.
Raycasting sends out an invisible ray in a specific direction with a specific length, commonly used for ranged weapons and fps games Touched fires when it is collided with something, good for a combat system region3 is a data type describing a volume in a 3d space, used to replace hitboxes Magnitude is the distance between the origin and the result, commonly used for npcs
@dutycall11 explained very well how the systems you mentioned work, I’ll give you my insight based on my experience.
Raycast, unless you’re doing ranged weapons I wouldn’t use it since it’s a thin line, not ideal for melee systems. Or you can use RaycastHitbox module if you need very accurate hitboxes, ideal for weapons.
Touched, it’s good client-sided but pretty bad server-sided so if you don’t wanna take risks by making your detection client-sided, I don’t recommend it.
Region3, old and deprecated, please don’t use them. There’s a way better replacement I will mention later in the reply.
Magnitude, probably the fastest method, better than any of the ones I mentioned before, however it’s not very customisable as it’s a sphere with all the three axis equal in size. I’m 90% sure ABA uses magnitude as its hitbox system.
If none of the above interest you, use OverlapParams. My game uses it and it’s wonderful. This system is similar to Region3 but newer, faster and of course not deprecated. I always use this as it’s the best for the type of hitboxes I want (square so not too accurate). You can customise the CFrame the square will be and the size too, as well as use OverlapParams (similar to RaycastParams) to decide which parts to whitelist/blacklist (very good if you make your own hitbox parts and attach them to players’ characters). Also, a method of OverlapParams is very similar to magnitude, but better as it’s more customisable (as it also has the whitelist/blacklist system).
More likely than not, most if not all the games you mentioned use OverlapParams for spatial querying.
It all depends on what you’re going for - OverlapParams work great for good hitboxes, especially for the type of game which you seem to be going for, but don’t offer precise enough information - e.g, where exactly was something hit? Raycasts provide this information, but are generally a bit trickier to work with and setup.