MuchachoHitbox: An easy to use SpatialQuery-Based Hitbox System

Introduction

Hey everyone. This is my first community post here on the DevForum.

I’m excited to showcase my hitbox module called Muchacho Hitbox – a lightweight, easy-to-use hitbox system built using SpatialQuery and OverlapParams.

Originally, I showcased this on my YouTube channel Sushimaster, but I didn’t have a DevForum account at the time. Now I do, and I’d love to share it with you all.

What is MuchachoHitbox?

Muchacho Hitbox is a hitbox module that supports both box-shaped and sphere-shaped hitboxes using Roblox’s SpatialQuery system.

It’s perfect for:

  • Melee attacks
  • AoE abilities
  • Skill shots
  • Any gameplay that doesn’t need per-frame accuracy

How to use

To use the MuchachoHitbox module, you first need to require it in your script.

-- To use the MuchachoHitbox module, you first need to require it in your script.
local module = require(game.ServerStorage.MuchachoHitbox)

-- You can create a hitbox using the CreateHitbox function.
local hitbox = module.CreateHitbox()
hitbox.Size = Vector3.new(10, 10, 10)

-- Set the CFrame to wherever you want.
hitbox.CFrame = CFrame.new(0,0,0)


-- You can use .Touched as an event listener for hitbox hits.
hitbox.Touched:Connect(function(hit, humanoid)
 print(hit)
 humanoid:TakeDamage(10)
end)

-- You can start the hitbox using :Start and stop the hitbox using :Stop.
hitbox:Start()
task.wait(1)
hitbox:Stop()

And yes you can make the hitbox follow an instance by setting the CFrame property to an instance.

hitbox.CFrame = workspace.Part

Documentation

Youtube Video

Here’s a quick showcase of the current version of MuchachoHitbox:

I’d love any feedback or suggestions you might have! Let me know if you run into any bugs or have ideas for improvements.

34 Likes

bump ^ this is an amazing resource, personally use a modified version for my projects

3 Likes

This cool, very much likely​:+1::+1::+1::sunglasses:

2 Likes

finally, have been using it for a year

2 Likes

this hitbox is good, ive been using it since its release

2 Likes

Very easy to use, and modify, great for beginner, can be use for multiple purpose. Imo 9/10

2 Likes

I love this! It actually works out of all the other ones i found! (Is it me or I may have been setting up stuff wrong with the other ones)

2 Likes

hey i didn’t even notice this
i might check this out for testing purposes to see if it’s good for my purposes
thank you, SushiMaster :heart:

1 Like

Hi! I used to use this for my combat game before the velocity prediction update which gave me a huge drawback because it was a fast paced combat game, so I switched over to HitboxClass. But with this new velocity prediction update I ended up switching back to MuchachoHitbox because I realized it detected hits faster than HitboxClass and now it has velocity prediction which is pretty neat.

I am currently making a Horror Asymmetrical Roblox game where there is 1 killer and 4 survivors, and I’m using your module to replicate the Dead By Daylight killer lunge hit detection. As of right now, it works almost perfect as it feels fair for both the killer and survivor(s) who get hit. Although there is an exception where the killer is lunging at double the walk speed and turns their character around quickly, the hitbox’s velocity prediction is still delayed, but this time only when turning your camera in quick succession. I did try circumventing the issue by increasing the VelocityPredictionTime, but now it just feels unfair to hit a survivor as a killer when they’re pretty far away. Is there a way to predict how fast the player is turning their camera/character and have the hitbox be predicted turning sideways?

1 Like

I don’t think it’s possible to make the hitboxes feel accurate to the characters using velocity prediction alone. If you want the hitbox too feel like it’s moving smoothly with the character I suggest you use client sided combat with safety checks.

But here’s something really interesting that I only just found out recently, the fast paced anime combat game ABA doesn’t make the hitbox follow the character. It creates the hitbox and it stays in the same position. It might seem counter intuitive but making the hitbox stay in place could be a good idea as well.

1 Like

It’s ok. I figured if I put a small delay before the hitbox window starts, the hitbox wouldn’t feel as bad. :+1:

1 Like

in the types module you have CFrame of hitbox set to be only a CFrame and not a part which your module does support, this seems kind of like a niptick and it is but for us strict users it gets on the nerves so you should probably add | BasePart