EZ Hitbox - Hitbox made easy

EZ Hitbox

A flexible, high-performance hitbox system for Roblox games that supports both server and client-side hit detection with advanced features like hit point detection, velocity prediction, and comprehensive debugging tools.

Github | Wally | Roblox

Core Functionality

  • Server and client-side hit detection - Choose the best approach for your game
  • Precise hit point detection - Get exact collision positions, normals, and materials
  • Multiple hitbox shapes - Support for box, sphere, and custom part shapes
  • Flexible target detection - Detect humanoids, objects, or both
  • Velocity prediction - Compensate for fast-moving hitboxes
  • Visual debugging - See your hitboxes in real-time

Advanced Features

  • High performance - Optimized spatial queries and caching
  • Configurable parameters - Debounce time, lifetime, and more
  • Blacklist support - Exclude specific instances from detection
  • Signal-based events - Clean, reactive hit detection system
  • Proper cleanup - Automatic memory management and resource cleanup
  • Easy integration - Simple API that works with any Roblox game

Usage Examples

Factory methods for common use cases:

-- Sphere hitbox
local hit = Hitbox.sphere(10, CFrame.new(0, 5, 0))

-- Box hitbox
local hit = Hitbox.box(Vector3.new(10, 5, 10), CFrame.new(0, 5, 0))

-- From existing part
local hit = Hitbox.fromPart(workspace.MyHitboxPart)

Full constructor with sensible defaults:

local hit = Hitbox.new({
    Size = Vector3.new(10, 10, 10),  -- Only required field
    CFrame = CFrame.new(0, 5, 0),    -- Optional, defaults to origin
    DebounceTime = 0.5,              -- Optional
    Lifetime = 5,                     -- Auto-destroy after 5 seconds
    Debug = true,                     -- Show visualization
    AutoStart = true,                 -- Start immediately
    Tag = "Enemy",                    -- Optional CollectionService tag filter
})

Simple Example

https://streamable.com/j4j1le

UPDATES

v5.0.0
v4.1.0
v4.0.1
v3.0.0
v2.0.0

47 Likes

Nice looking, Could you add it to the marketplace/rbxm file?

1 Like

added the link to the installation header

2 Likes

Very cool, will be using in future projects :slight_smile:

2 Likes

Thank you king, this is super useful.

2 Likes

Ironic to see this was made the same day that I learned how to validate hitbox from Roblox’s FPS system properly lol

2 Likes

Appreciate it. Let me know if anything breaks or could be better

2 Likes

Amazing resource! Thanks for sharing it with the community :two_hearts:

1 Like

Update v2.0.0

:warning: BREAKING CHANGE: The following method names have been modernized. Update your code accordingly:

| Old Name | New Name | Change Type |

| ClearTaggedChars() | ClearTaggedCharacters() | :arrows_counterclockwise: Renamed |

| SetVelocityPrediction() | EnableVelocityPrediction() | :arrows_counterclockwise: Renamed |

| SetDebug() | EnableDebug() | :arrows_counterclockwise: Renamed |

| ChangeWeldOffset() | SetWeldOffset() | :arrows_counterclockwise: Renamed |

| ClearHitboxesWithID() | ClearHitboxesByID() | :arrows_counterclockwise: Renamed |

| ClearClientHitboxes() | ClearHitboxesForClient() | :arrows_counterclockwise: Renamed |

| SetPosition() | SetCFrame() | :arrows_counterclockwise: Renamed |

| HitSomeone() | OnHit() | :arrows_counterclockwise: Renamed |

| InitialPosition | InitialCframe | :arrows_counterclockwise: Renamed |

Migration Example


-- Old code (v1.x)

hitbox:ClearTaggedChars()

hitbox:SetDebug(true)

hitbox:ChangeWeldOffset(CFrame.new(0, 1, 0))

Hitbox.ClearHitboxesWithID("combat")

-- New code (v2.0+)

hitbox:ClearTaggedCharacters()

hitbox:EnableDebug(true)

hitbox:SetWeldOffset(CFrame.new(0, 1, 0))

Hitbox.ClearHitboxesByID("combat")

2 Likes

Update v2.0.1

Refactor HitboxParams to replace Debris with LifeTime and fixed automatic destruction not working

1 Like

Wow, this feels like this is just EXACTLY like HitboxClass…

1 Like

v3.0.0

:dart: Advanced Hit Point Detection

Get precise hit locations for visual effects, bullet holes, or damage zones:

local Hitbox = require(path.to.Hitbox)

local hitbox = Hitbox.new({
    SizeOrPart = Vector3.new(5, 5, 5),
    VelocityPrediction = true,
    DetectHitPoints = true, -- Enable precise hit detection
    LookingFor = "Object",
    LifeTime = 2.0,
    Debug = true
})

-- Handle hits with precise location data
hitbox.HitObjectWithPoint:Connect(function(hitData)
    for _, data in pairs(hitData) do
        print("Hit:", data.Object.Name)
        print("Position:", data.Position)
        print("Surface Normal:", data.Normal)
        print("Material:", data.Material)
        
        -- Create bullet hole decal
        createBulletHole(data.Object, data.Position, data.Normal)
        
        -- Spawn impact particles
        spawnImpactEffect(data.Position, data.Normal, data.Material)
    end
end)

hitbox:Start()

Hitbox.OnHitWithPoint: Signal<{HitPointData}>

Fires when the hitbox detects characters with precise hit data (requires DetectHitPoints = true).

Hitbox.HitObjectWithPoint: Signal<{HitPointData}>

Fires when the hitbox detects objects with precise hit data (requires DetectHitPoints = true).

3 Likes

How performant is this module?

I am looking to use the hitbox on the client-side for a VR game.

Is this HitboxClass rewrite or something?

Yes, with more features, updated dependencies, and optimized. You can check the GitHub and compare the changes

it is performant as long as you are following best pratices. e.g destroying when not being used. I do plan on simplifying the client hitbox creation as it can be a bit confusing rn

1 Like

I don’t know if I’m uninformed because I’m not looking at the code, but couldn’t UseClient be exploited?

UseClient (Player) — Default: nil
Enable client-side detection.

Aslong you are not using it to do important checks it could save some memory usage on the server

1 Like

Like @worricd said, depends on what you use it for

This EZ hitbox module saved my studio from shutting down. It cured my depression, shaved my cat, and made me more money than grow a garden on a saturday morning. I can’t recommend this modular EZ hitbox enough. I think every developer needs this as it will change the trajectory of their roblox careers