Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Is it possible to make a hitbox on a tool?

I've been trying to make a sword that will deal damage to a player if it is touched, without an animation, but there are multiple parts and the damage overlaps, is there a way to make a hitbox on a tool so the damage doesn't overlap? If not, how can i make the damage not overlap?

Example: https://imgur.com/a/B3N4d9F

There are three parts on the sword

1 comment

0

edit:- change to hyperlink

1 answer

What you want to do is get a part, surround your whole blade in it like this, then make the transparency to 1. Make sure you weld the part to your sword blade. What you want to do after that is set CanCollide on all the blade parts and the hitbox part to false. Then, you want to insert this script under the hitbox part:

local debounce = false 
local HealthLoss = 101 -- Change this to the damage you need. 

function OnTouched(Part) 
	if Part.Parent ~= nil then --Keep Parentless blocks from breaking it. 
		if debounce == false and Part.Parent:FindFirstChild("Humanoid") ~= nil then 
			debounce = true 
			Part.Parent:FindFirstChild("Humanoid"):TakeDamage(HealthLoss) 
			wait(2) --Wait time before the brick can hurt someone. (can be 0)
			debounce = false 
		end 
	end 
end 

script.Parent.Touched:Connect(OnTouched)

This discussion is preserved as it was. New answers, comments, and votes are closed.