Confused on making a dash slash

Hello, so my goal right now is to make a dash slash attack, right now I use bodyvelocity to push the player forward, and I have a hitbox on the character so if that hits an enemy, the player teleports behind the enemy, my issue is that the hitbox can be inconsistent when i dash right into the enemy, does anyone know how any other ways to do this? Ive heard about raycasting but I have no idea how to use it

1 Like

What do you mean by the hitbox can be inconsistent? You could just use the weaponry and check when hit, if the parent of what it hit contains a humanoid so you will be able to deduce whether it is a character part from there.

Hope this helps you. If you need any further help do contact me here on the DevForum or on Discord, solo.#0001

My problem is the hitbox surrounds the entire player and if the player bumps into a enemy it will activate, but the enemy will sometimes bounce away from player due to the bodyvelocity

You could try what I suggested, also make sure the hitbox is not collidable.

The hitbox isnt collidable, i think it would be easier if I show you what I mean
https://gyazo.com/bb5faba7140a85aa530b767c38d17ef0

If you’re trying to disable collisions only for hit characters, you could add NoCollisionConstraints between all the can collide parts in hit characters and the attacking character (not the most efficient solution, though it would work). You might also want to consider just adding all the characters to their own collision group so they can’t hit each other.

Even a solution that uses raycasting would have this problem unless collisions were disabled. What many of these dash systems do is make the character can’t collide, move the character with a BodyVelocity (possibly a BodyForce to cancel gravity, you can use the BV for that too), then use raycasting to make sure the character isn’t trying to dash through walls.