Hitbox Service, easily create Accurate Hitboxes using minimal scripting!

I trust your word for it.

I’m not sure if I’m using this in the right way but this code running on the server. Kills my Frames Per Second.

local ServerSideHandler = coroutine.wrap(function()
	
	RunService.Heartbeat:Connect(function()
		
		task.wait(0.01)
		
		for i,v in pairs(AllRunningHitBoxes) do
			
			local HitBoxParams = OverlapParams.new(v.hitboxparams)
			local HitBox = HitBoxService:CreateWithPart(v.hitboxpart, HitBoxParams)
			
			HitBox:Start()
			
			local HitRegisters = HitBox:GetItems()
			
			for i,v in pairs(HitRegisters) do
				
				if v:IsA("BasePart") then
					
					print(v)
					
				end
				
			end
			
		end
	
	end)
	
end)

ServerSideHandler()
1 Like

It’s seem like the module is updated you shoud use this instead

local RegionStats = REVsSqDrN2snr28pSsfDiS4aYpay7dbC5a - script.Parent.Size/2, script.Parent.Position + script.Parent.Size /2) -- gets the part's dimensions
local HitboxModule = require(game.ReplicatedStorage.HitboxModuleMain) -- requires the module.
local Hitbox = HitboxModule:CreateWithBox(script.Parent,RegionStats.CFrame, RegionStats.Size, OverlapParams.new()) -- makes hitbox
Hitbox.Touched:Connect(function(Object) -- this object that the hitbox touched.
print(Object)
end)
3 Likes

the module usually has lag issues when you put a .Hearbeat inside the same thread. Since the module uses .Heartbeat for inner code. I recommend you either A use @thebrickplanetboy’s method OR task.spawn a new thread in your pairs loop.

1 Like

First time using this, I used this hitbox for a projectile script and I have to say, it is very laggy, It’s my first time using this and I would like a solution of some sort. I did this:

local overlapParams = OverlapParams.new()
overlapParams.FilterDescendantsInstances = {char}
overlapParams.FilterType = Enum.RaycastFilterType.Blacklist

local newHitbox = PartHitbox:CreateWithPart(newSpin, overlapParams)
newHitbox:Start()
					
local c
c = newHitbox.Touched:Connect(function(Hit)
	if Hit.Parent:FindFirstChild("Humanoid") then
	    if Hit.Parent.Name ~= char.Name then
			local enemyHumanoid = Hit.Parent.Humanoid
			fxDMG:FireServer(input,Hit,enemyHumanoid,1)
		end
	end
	c:Disconnect()
end)

if I do Hitbox:Stop() then Hitbox.Entered:Connect(function() should stop giving error right?

are you putting the .Touched inside of a heartbeat? That usually makes it lags.

If not you can manually check the items using the :GetItems function.

I have some questions I hope you can answer

Is this faster than the new worldroot detection functions? I’m talking about :GetPartsInBoundingBox() and :GetPartsInRadious().

→ If not:
[This question is a little more specific for my game, because I’m used skinned meshes and the setup I have.]
Currently, I’m using :GetPartsInBoundingBox() and checking using a whitelist for Collection service:GetTagged(“Hitbox”). Is this still slower than your fastest method? (Maybe doing the same whitelist check)

→ question:
[I’m sorry if this is answered in the post already]
I’ve seen you have various methods. Can you tell me which is the fastest? Or, how could I make this faster?

→ question:
[I’m not well informed about Zone+ so idk how useful it is]
There’s a .Touched and .Entered which seem really useful. But if we get into Zones (which is what these seem like), would you recommend using yours over zone+'s ? Of course, it’s better the have all in one module, but if I only want to use Zones and not hitboxes, is it still better?

Anyway, seems pretty reliable so I’m counting on this module! After all I’ve been having some delay problems with my hitboxes lately but I thought I couldn’t do anything. So I’m glad I found this post!

PD: I’d like answers from the OP and people who have tested it if possible :slightly_smiling_face:

Edit: I just found out the Dev is banned from the forums lol. Sorry to hear that, I couldn’t live without devforum tbh. Those who want to make a v2 I’d really appreciate it!

The module itself uses the worldroot detections.

honestly idk

idk this either tbh

i’d say they’re both good. But for different purposes. If you want to use zones, i’d recommend u use zone +. For hitboxes this module.

1 Like

I will do some benchmarking now some day I guess.

sorry for the bump/self promo but I think it’s important.

I’ve recently created a v2 version of the module with the owner himself. It fixes a LOT of the bugs hitboxservice v1 had and adds a lot of features to it. I’d recommend you check it out since this module seems to no longer be maintained.

https://devforum.roblox.com/t/hitbox-service-v2-easily-create-accurate-hitboxes-using-minimal-scripting/1761565

cc: @ElVaranCubico_YT

2 Likes

Uh… Where’s the page? it throws an error when i clicked.

I deleted it, the module is absolutely useless. There’s better alternatives.

1 Like

i see… Which is more reliable?

How do I make it not hit the player that cast the hitbox and how do I damage multiple players at once plus not damage the player that already got hit?

This crashes Roblox Studio whenever a hitbox using this module touches it.

Sad to see this hitbox module go out like this. Was reading for a good 30 minutes, sad. :frowning:

1 Like

Is this mandatary to create a new hitbox each time for a new check. It feels like it could cause a memory leak. I tried using the same hitbox more than one time and it resulted in no items being returned at all.

The Stop function doesn’t seem to work properly.

I used the template code you wrote and it’s spamming this error in the output.

local RunService = game:GetService("RunService")
RunService.Heartbeat:Connect(function()

	local HitboxModule = require(game.ReplicatedStorage.HitboxModuleMain)
	local HitBox = HitboxModule:CreateWithRange(script.Parent, script.Parent.Position, 10, OverlapParams.new())
	HitBox:Start() -- starts the hitbox
	if HitBox:GetState() == true then -- checks state
		local Items = HitBox:GetItems()

		wait(1)
		HitBox:Stop() -- stops state
	end
end)


1 Like

What Did You Use To Make The Hitbox?