This is the script: local tool = script.Parent local canDamage = false
local function onTouch(otherPart)
local humanoid = otherPart.Parent:FindFirstChild("Humanoid")
if not humanoid then
return
end
if humanoid.Parent ~= tool.Parent and canDamage then
humanoid:TakeDamage(25)
else
return
end
canDamage = false
end
local function slash() local str = Instance.new("StringValue") str.Name = "toolanim"--tool animation str.Value = "Slash" str.Parent = tool canDamage = true end
tool.Activated:Connect(slash) tool.Handle.Touched:Connect(onTouch)
it has a local script too but that's for the animation. I want it to have the cooldown because if it doesn't people will be spam clicking and instakilling other players.

13 comments
thanks
i just didnt want people to spam click
Uh, that's how you can solve it.
You want explanation?
sure and in studio it isnt working
wait maybe i could let you into the game in studio and you do the code for the cooldown?
Sure, I guess..
Wait, try the script again. I think it should work now.
i enabled collaborative editing but when i go to the permissions page it says i need to turn it on...
I edited my answer, I think the script should be able to work now.
ok i have to go for a little bit
its not damaging
it didnt work btw