I’m trying to make a sword system, when clicking it plays an animation and when it stops if the player waits 2 seconds before clicking again, the animation count resets, if he doesnt wait, the second slash animation plays, and so on.
For some reason the animations aren’t playing, i’ve checked if the animations are correct, they are set to action, and it still doesnt work, and there arent any errors in the output. This is the normal script in the sword
local Turn = 1
local Cooldown = 2
script.Parent.Activated:Connect(function()
if script.Parent.Cooldown.Value == false then
script.Parent.Cooldown.Value = true
script.Parent.CanDamage.Value = true
wait(1)
local humanoid = script.Parent.Parent.Humanoid
local Animation1 = script.Animation1
local Animation2 = script.Animation2
local Animation3 = script.Animation3
local Animation4 = script.Animation4
local Animation5 = script.Animation5
if Turn == 1 then
local Anim1 = humanoid:LoadAnimation(Animation1)
Anim1:Play()
Turn = 2
Anim1.Stopped:wait(Cooldown)
script.Parent.CanDamage.Value = false
script.Parent.Cooldown.Value = false
elseif Turn == 2 then
local Anim2 = humanoid:LoadAnimation(Animation2)
Anim2:Play()
Turn = 3
Anim2.Stopped:Wait(Cooldown)
script.Parent.CanDamage.Value = false
script.Parent.Cooldown.Value = false
elseif Turn == 3 then
local Anim3 = humanoid:LoadAnimation(Animation3)
Anim3:Play()
Turn = 4
Anim3.Stopped:Wait(Cooldown)
script.Parent.CanDamage.Value = false
script.Parent.Cooldown.Value = false
elseif Turn == 4 then
local Anim4 = humanoid:LoadAnimation(Animation4)
Anim4:Play()
Turn = 5
Anim4.Stopped:Wait(Cooldown)
script.Parent.CanDamage.Value = false
script.Parent.Cooldown.Value = false
elseif Turn == 5 then
local Anim5 = humanoid:LoadAnimation(Animation5)
Anim5:Play()
Turn = 1
Anim5.Stopped:Wait(Cooldown)
script.Parent.CanDamage.Value = false
script.Parent.Cooldown.Value = false
end
end
end)
Additionally, i have 2 boolvalues in the tool, and the sword mesh. The animations are under the script
I have no idea why this isn’t working, and i’ve literally stayed up all night trying to figure it out watching different videos and looking at similar posts, but I still have nothing