Hitbox Service, easily create Accurate Hitboxes using minimal scripting!

Seems you aren’t printing anything with the script you provided.

I have a full-on script inside for a tree chopping system.

> local HitboxModule = require(game.ReplicatedStorage.HitboxModuleMain)
> local Params = OverlapParams.new()
> local Hitbox = HitboxModule:CreateWithPart(script.Parent, Params)
> Hitbox:Start()
> local health = 15
> local bool = true
> local ongoing = true
> local respawn = math.random(15,20)
> Hitbox.Touched:Connect(function(Object)
> 	if Object.Name == "Handle" and Object.Parent:FindFirstChild("IsAAxe") and Object.Parent:FindFirstChild("Hit Sound") then
> 		local status = Object.Parent:WaitForChild("Type")
> 		local HitSound = Object.Parent:WaitForChild("HitSound")
> 		
> 		if health > 0 then
> 			if status.Value == 'Wood' then
> 				health = health - 1
> 				HitSound:Play()
> 			elseif status.Value == 'Stone' then
> 				health = health - 1.5
> 				HitSound:Play()
> 			elseif status.Value == 'Iron' then
> 				health = health - 3.5
> 				HitSound:Play()
> 			elseif status.Value == 'Diamond' then
> 				health = health - 5
> 				HitSound:Play()
> 			end
> 		elseif health <= 0 and bool == true then
> 			bool = false
> 			for i, x in pairs(script.Parent.Parent:GetChildren()) do
> 				x.Anchored = false
> 			end
> 			wait(respawn)
> 			
> 		end
> 	end
> end)

Well, i can’t help if you have the .touched function cut off

What do you mean cut off?
(30 limit)

Maybe its one of the if statements. Add a print(object) before the .touched and see what happens. Also for scripts click the <>
image

I wrote the post before u added the full script

It detects it being touched but doesn’t run the rest of the script. Im so stupid im so sorry. There was a value missing as it didn’t save when I quit.

Thens its at fault with the if statements.

1 Like

Also, this system is very neat! .Touched sometimes doesn’t work and it gets pretty annoying as its exploitable too.

1 Like

I’d recommend to custom make it. I plan on revamping the module soon, since its not the best

I’m not talking about your module if you think I am

1 Like

I’m not sure what you mean by raycast hitboxes not registering hits if the part is inside of another part? I’ve never heard of an issue like that happening with raycasting unless you’re incorrectly using the RaycastParams.

I like this, but how could i use this for a combat system

When I made a hammer, I used this module and I simply used :CreateWithPart on the handle.

1 Like

RayCast may be good, But it really adds alot of lines of codes in scripts. Not only that, with Client based Raycast hitbox modules you can’t check nor verify if the damage dealt by the player is what you expect via the server. Meaning there are chances that exploiters can change how much they can damage players. However this can be fixed by making a number value… but it can still be accessed and changed. Region3 however fixes those for me… It reduces the lines of code and allows the server to check if the damage is supposed to deal isnt changed.

I don’t see how this module uses raycasting, I might be wrong

No, there are other modules that use raycasting. This one uses Region3.

Glad that this module had some type of use for you!

Actually it’s overlapparams, region3 is deprecated

They’re pretty much the same thing tbh.