The following script is for a weapon that plays animations randomly out of the animations I enter. I worked on this script some time ago, and I want to play the animations in order, rather than randomly. How would I change this script to play these animations in order.
local tool = script.Parent
local animation = script.Parent.Animation
local drawsound = script.Parent.Handle.draw
tool.Equipped:Connect(function()
local hum = script.Parent.Parent.Humanoid
local track = hum:LoadAnimation(animation)
track:Play()
drawsound:Play()
end)
local animations = {"8639042808"; "7962845607"}
local tool = script.Parent
local enabled = true
local char
local coolDown = .8
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)
Thanks