I am making a sword and wonder why does this script not work ?
local CanAttack = true
local i = script:WaitForChild("Idle")
local a = script:WaitForChild("Attack")
local hum = script.Parent.Parent:WaitForChild("Humanoid")
i.Parent = hum
a.Parent = hum
local idle = hum:LoadAnimation(i)
local attack = hum:LoadAnimation(a)
script.Parent.Equipped:connect(function()
idle:Play()
end)
script.Parent.Activated:connect(function()
if CanAttack == true then
attack:Play()
idle:Stop()
wait(1)
attack:Stop()
idle:Play()
CanAttack = true
script.Parent.CanDamage.Value = true
end
end)