So i have this script that is sposed to play 2 different animations. It plays the first animation just fine but it wont play the second and the tool stops working after the first animation. I've spent quite a long time trying to figure this out but i don't know whats wrong.
local Tool = script.Parent
local Cooldown = script.Cooldown.Value
local animation1 = script.Swing
local animation2 = script.NewSwing
local animvalue = 1
Tool.Activated:Connect(function()
if animvalue == 1 then
animvalue = 2
local Humanoid = Tool.Parent:FindFirstChildWhichIsA("Humanoid")
if Humanoid and Cooldown == false then
Cooldown = true
local playanimation = Humanoid:LoadAnimation(animation1)
playanimation:Play()
Tool.SwordBlade.Damage.Disabled = false
wait(0.3)
playanimation:Stop()
Tool.SwordBlade.Damage.Disabled = true
wait(0.5)
Cooldown = false
else
animvalue = 1
local Humanoid = Tool.Parent:FindFirstChildWhichIsA("Humanoid")
if Humanoid and Cooldown == false then
Cooldown = true
local playanimation = Humanoid:LoadAnimation(animation2)
playanimation:Play()
Tool.SwordBlade.Damage.Disabled = false
wait(0.3)
playanimation:Stop()
Tool.SwordBlade.Damage.Disabled = true
wait(0.5)
Cooldown = false
end
end
end
end)

1 comment
i think i might have figured it out