QuickHitbox : A simple, and OOP based hitbox module

--[[
  ___        _      _    _   _ _ _   _               
 / _ \ _   _(_) ___| | _| | | (_) |_| |__   _____  __
| | | | | | | |/ __| |/ / |_| | | __| '_ \ / _ \ \/ /
| |_| | |_| | | (__|   <|  _  | | |_| |_) | (_) >  < 
 \__\_\\__,_|_|\___|_|\_\_| |_|_|\__|_.__/ \___/_/\_\
 
 -- Made by @gianfragolo
 
]]

QuickHitbox is an open-sourced and beginner-friendly resource with the objective to bring you a quick, and easy to use hitbox system

Here’s an overview of the settings of the hitbox :

-- [[ CREATE THE HITBOX CLASS; REQUIRE THE MODULE FIRST ]] --

local hitbox = require(game.ReplicatedStorage.mod.HitboxModule).new(workspace.SpawnLocation)

-- [[ OVERLAP PARAMS TO EXCLUDE / INCLUDE CERTAIN OBJECTS ]] --

hitbox.Params = OverlapParams.new()

-- [[ TOGGLES HITBOXS VISUALS ]] --

hitbox.Visible = true

-- [[ VECTOR3 FACTORS THAT ITS + TO THE HITBOX SIZE ]] --

hitbox.Offset = Vector3.new(.01,.01,.01)

-- [[ THIS SETTINGS DETERMINATE THE TIME DELAY OF EVERY UPDATE OF THE HITBOX  ]] --
-- * Smaller, more accurate lags more. Biggger, less accurate less lag

hitbox.Accuracy = 0

Take also a look on the methods and events of the hitbox class :

-- [[ STARTING THE HITBOX ]] --

hitbox:Start()

-- [[ THIS EVENT IS FIRED WHEN THE HITBOX STOP RUNNING ]] --

hitbox.Ended:Connect(function()
	print("HITBOX FINISHED RUNNING")
end)

-- [[ THIS EVENT IS FIRED WHEN THE HITBOX STARTS RUNNING ]] --

hitbox.Started:Connect(function()
	print("HITBOX STARTED RUNNING")
end)

-- [[ THIS EVENT IS FIRED WHEN THE HITBOX FINDS ANY OBJECTS]] --

hitbox.Touched:Connect(function(hits)
	print("HITBOX FOUND THOSE OBJECTS : ".. tostring(table.unpack(hits)))
end)

-- [[ STOPPING THE HITBOX ]] --

hitbox:Stop()

Here is the link of the module.

Let me know if you have any feedback to improve this module!
Thanks for reading, @gianfragolo

1 Like