When the player clicks, it enables a variable bool called "toggle" to true. Then that is supposed to damage the NPC once, but it doesn't. It also doesn't apply the "click to activate toggle". Here's the script.
local weapon = script.Parent.Parent.Handle.HitPart
local dmg = script.Parent.Parent.Interval.Value * 20
local toggle = true
weapon.Touched:Connect(function(part)
if part.Parent:FindFirstChild("Humanoid") then
if toggle == true then
local humanoid = part.Parent:FindFirstChild("Humanoid")
humanoid:TakeDamage(dmg)
toggle = false
wait(1)
toggle = true
end
end
end)
It's a server script inside of another server script inside a tool called "Wooden katana".

4 comments
Maybe you should put the line 10 at line 8, line 8 at line 9 and line 9 at line 10?
that an interesting way to make a cooldown, I use debounce = false instead of toggle = true so maybe try that instead.
@mantorok4866, There is literally no difference.
I tried each option, none works.