I’m making a sword but don’t know how to have the player deal damage.
I want the sword to only deal damage if the player activates the tool, but I don’t know how.
Tool.Activated:Connect(function()
script.Parent:WaitForChild("Hitbox").Touched:Connect(function(objectThatTouchesTheHitbox)
if objectThatTouchesTheHitbox.Parent then
if objectThatTouchesTheHitbox.Parent:FindFirstChild("Humanoid") then
if DebounceTable[objectThatTouchesTheHitbox.Parent] == true then return end
DebounceTable[objectThatTouchesTheHitbox.Parent] = true
objectThatTouchesTheHitbox.Parent.Humanoid:TakeDamage(30)
wait(2)
DebounceTable[objectThatTouchesTheHitbox.Parent] = nil
end
end
end)
end)