Creating a "Headbutt Weapon" and where to start

What I need
I am trying to create a weapon using just the character where the player headbutts another player and damages them. I’m looking for scripting ideas on how and what I can use to achieve this.
Here is the animation

What I have done
In the game, the player’s head starts off very tiny so I can’t use the head to detect if it hits a player because it will never reach(I don’t think maybe it will? I tried and it didn’t work maybe there’s another way). I tried shooting rays out of the character root part and then detecting a player and their mag then damaging them but it was very inconsistent. At this point, I was just going to give up on the idea but I figure I ask others and see if anyone else has any ideas. Maybe rays are the way to go?

Any thoughts? Thank you in advance!

4 Likes

I am no expert on this so correct me if I’m wrong. You could try to add a custom hitbox where the head would be and detect when the hitbox hits another player. I don’t know a way to do this, however.

I’ve never really had any experience with this, but I’d suggest doing a region3 directly in front of the player and checking if there’s any players in it when you do the animation. Give it a try and see if it works?

I don’t know if it will work but try inserting an invisible block in front of the head and use magnitude to detect the player closest to the block

When the animation plays get the rotation of the head. Then get the position of the humanoidrootpart. Make a cframe using those 2 compenents multiply that cframe by (0,2,0) so the origin of the ray is now the same as a regular head with that animation. Then just cast the ray from that position forward.

Another way of getting the position of a regularly sized head would be to get the unit vector from the rootpart to the head and multiply that by 2. Then cast the ray from there forward.

Hope this helps!

Make an invisible explosion at the head and see who it hits

make the radius like 5 or something, then use explosion.Hit

1 Like