I want to use an animation in my sword script. It is unfinished, but I have this much so far:

coolTime = 1 -- time before player may attack again
readytoattack = false -- ignore this variable
tool = script.Parent.Parent

tool.Equipped:connect(function(Mouse)
	readytoattack = true
	Mouse.Button1Down:connect(function()
	damage = math.random(10,15)	
		if readytoattack == true then
			readytoattack = false
		print("text")
		wait(coolTime)
		readytoattack = true
		end
	end)
end)

tool.Unequipped:connect(function()
	readytoattack = false
end)