HitboxClass | v2.0 | A Powerful OOP-based Hitbox Module

:bullseye: Enhanced HitboxClass v2.0 - Next-Gen Spatial Detection System

A modern, feature-rich hitbox system that outperforms existing solutions with cleaner code and advanced capabilities.


Get the module here: Hitbox Module

Test Pace: Hitbox Module - Roblox


:sparkles: Key Features

:rocket: Multiple Hitbox Types

  • Box/Ball: Instant single-frame detection
  • TimedBox/TimedBall: Repeated detection over duration
  • WeldedBox/WeldedBall: Continuously follows moving parts
  • Magnitude: Pure distance-based detection
  • InPart: Precise part-based collision
  • Cylinder: Cylindrical detection areas

:video_game: Advanced Hit Modes

  • Weak: One hit per character (default)
  • Strong: Multiple hits per character
  • Cooldown: Hit once, then cooldown period

:brain: Smart Features

  • Velocity Prediction: Compensates for fast-moving targets
  • Directional Filtering: Hit only targets in specific directions
  • Proportional Sizing: Auto-scale hitboxes based on part size
  • Granular Blacklisting: Exclude specific characters AND parts
  • Performance Monitoring: Built-in cleanup utilities

:clipboard: Usage Example

local HitboxClass = require(path.to.HitboxClass)

-- Create a sword hitbox that follows the weapon
local hitbox = HitboxClass.new("WeldedBox", {
    root = sword,
    size = Vector3.new(4, 1, 6),
    duration = 0.3,
    velocityPrediction = true,
    dotProductFilter = {
        dotProduct = 0.3,
        referenceVector = sword.CFrame.LookVector,
        sourcePosition = sword.Position
    },
    hitboxId = "sword_" .. player.UserId,
    HitMode = "Weak",
    debug = true
})

hitbox.OnHit:Connect(function(character, hitPart)
    print("Hit:", character.Name)
end)

hitbox:Start()

:building_construction: Clean Architecture

  • Modular Design: Separated spatial queries into dedicated module
  • Type Safety: Full Luau type annotations
  • Memory Efficient: Lightweight registry system vs heavy caching
  • Self-Contained: No external dependencies or complex setup

:bullseye: Why Choose This Over Alternatives?

  • Simpler API: Intuitive hitbox type system vs confusing parameter combinations
  • Better Performance: Server-side focused, no unnecessary client-server complexity
  • More Features: Velocity prediction, directional filtering, proportional sizing
  • Cleaner Code: 603 well-organized lines vs 893+ tangled lines in alternatives
  • Better Error Handling: Graceful warnings vs game-crashing asserts

:package: What’s Included

  • HitboxClass.lua - Main hitbox system
  • SpatialHitbox.lua - Spatial query utilities
  • GoodSignal.lua - Optimized signal implementation

:wrench: Easy Integration

Just require the module and start creating hitboxes. No complex setup, no external configurations needed.

:chart_increasing: Perfect For

  • Combat systems
  • Projectile detection
  • Area-of-effect abilities
  • Interaction zones
  • Trigger volumes

Download now and experience the difference clean, modern code makes!


Get the module here: Hitbox Module

Test Pace: Hitbox Module - Roblox


Tested extensively in production environments. Open source and free to use.

28 Likes

You forgot to make the game public

2 Likes

Looks promising, will try it out!

Click the 3 dots and download a copy, or just edit the place

Hi i just have a suggestion you should add these type so it would be easier to create a hitbox

export type HitboxType = "Box" | "InPart" | "Magnitude" | "Cylinder" | "TimedBox" | "TimedBall" | "WeldedBox" | "WeldedBall"

export type Opts = {
	root: BasePart | CFrame | Vector3,
	size: Vector3,
	duration: number,
	interval: number,
	OverlapParams: OverlapParams,
	debug: boolean,
	HitMode: HitMode,
	HitCooldown: number,
	IgnoreCharacters: {Model?},
	proportional : {
		scaleMultiplier: Vector3,
		offsetMultiplier: number
	}?,
	velocityPrediction: boolean,
	velocityMultiplier: number,
	dotProductFilter: {
		dotProduct: number,
		referenceVector: Vector3,
		sourcePosition: Vector3 | BasePart
	},
	blacklistParts: {BasePart}?,
	hitboxId : string | number ?,
}
function HitboxClass.new(HitboxType: HitboxType, opts: Opts)
--rest of the code 
end
1 Like

Thank you bro, you’re right!!!

2 Likes

any advice on how to increase the accuracy of the velo prediction? I’m using odm gear from attack on titan which moves extremely quickly and i need accurate attacks.

@The_NetDev I’d reccomend changing your velocity prediction code to this. It fixes an issue with the hitbox being offfset for some strange reason.

local function applyVelocityPrediction(cframe, root, velocityMultiplier)
	if not root or not root:IsA("BasePart") then
		return cframe
	end

	local velocity = root.AssemblyLinearVelocity
	if velocity.Magnitude < 1 then
		return cframe
	end

	local prediction = velocity / (velocityMultiplier or 6)

	-- convert world space velocity prediction → local space
	local localPrediction = cframe:VectorToObjectSpace(prediction)

	return cframe * CFrame.new(localPrediction)
end

@Yarik_superpro bloat-check this

2 Likes
  • It uses ipairs for some odd reason
  • It uses runtime checks :fearful:
  • It uses oop :skull:
  • It uses “signals” (man, I’m dead).
  • It does not use typecheck (harder to use).
  • bro is afraid of own code :skull_and_crossbones:
    image

2 Likes

so is this good or nah

comment comment comment

@Yarik_superpro when there’s a slight whiff of bloat and oop in the air
whiplash

1 Like

wow so its 5.99 now sonnnnn what kind of resource is this