Multiple sword animations!

Hey everyone!
I wanted to make multiple animations for sword swinging… So it isn’t just the exact same anim over and over again…

I have 5 different slice animations, and I’d like to play them all randomly when someone clicks…
image

Here is the sword that I use
image

Here is the animate script:

local tool = script.Parent
local anim = script.Parent.Swing
local plr = game:GetService("Players").LocalPlayer
local char = plr.Character

local animTrack = char:WaitForChild("Humanoid"):LoadAnimation(anim)

tool.Activated:Connect(function()
	animTrack:Play()
end)
´´´


If you know how to do this please help me out!

Try using a for loop for every animation you have.
When it does an animation, it loops to the next one so the next time you swing it will be another animation.

if you want it to be random, use math.random() or Random.new() and index the animation from a table for randomness
however, in case you don’t want the animation to be repeated, you can have a separated table and remove the used animation to prevent it from being repeated

1 Like

And what would the script look like?

1 Like

local selectedAnim = animations:GetChildren()[math.random(1, #animations:GetChildren())]

1 Like

I don’t really know how to script that idea, I think the idea @SubtotalAnt8185 gave is better, you should go with it.