This is something I worked on a very long time ago, The tool plays animations randomly. I want to change it to play the animations in order. How do I change the random math to i guess it would be sequential.
local animations = {"11682667243"; "11683206581"} -- Animations
local tool = script.Parent
local enabled = true
local char
local coolDown = .8 -- cooldown for sword activation in seconds
local swing = script.Parent.Handle.swing
tool.Activated:connect(function()
if enabled then
enabled = false
local char = tool.Parent
local random = animations[math.random(1,#animations)]
local anim = Instance.new("Animation")
anim.AnimationId = "http://www.roblox.com/asset/?id="..random
local track = char.Humanoid:LoadAnimation(anim)
track:Play()
swing:Play()
local dmg = script.Damage:Clone()
dmg.Parent = tool.Handle
dmg.Disabled = false
wait(coolDown)
enabled = true
if dmg then
dmg:Destroy()
end
end
end)