Im trying to make a sword tool with an animation cycle so on the first hit it will play an animation, then on the second hit a different, so on, and so forth. But for some reason whenever you click just once it keeps looping the first animation over and over and doesnt stop. The script is a local script inside of the tool
local Anim1 = script.Parent.Animations.Swing2
local Anim2 = script.Parent.Animations.Swing1
local Anim3 = script.Parent.Animations.Swing3
local Player = game.Players.LocalPlayer
local Char = Player.Character or Player.CharacterAdded:Wait()
local Hum = Char:WaitForChild("Humanoid")
local Swing1 = Hum.Animator:LoadAnimation(Anim1)
local Swing2 = Hum.Animator:LoadAnimation(Anim2)
local Swing3 = Hum.Animator:LoadAnimation(Anim3)
local AnimationTable = {
Swing1,
Swing2,
Swing3
}
local CurrentSwing = AnimationTable[1]
local function Swing ()
for i, v in pairs(AnimationTable) do
if v == CurrentSwing then
v:Play()
v.Ended:Connect(function()
CurrentSwing = AnimationTable[i + 1]
end)
end
end
end
script.Parent.Activated:Connect(function()
Swing()
end)

1 comment
Check if the looping is on in the animation edit thing