Whats wrong with my sword's Idle animation?

So all the other animations such as “Attack” work perfect except the idle animation where the player holds the sword while slowly breathing doesn’t work. This is the default link sword with a custom mesh by the way I don’t know if that makes a difference.

Is the Idle animation priority set to Idle?

1 Like

You should set all animations to animation priority action

I set priority to idle, still this.

Set all of the animations animation priority to action.
You can stop the idle animation when mouse button 1 clicked then play the swing animation.

Nope, Could It be that its not standing still in the animation and its shoulders are going up and down?

Could you post the code youre using to play animations?

Well I am using a pre-existing default sword edit and i’ve just been putting the animation ID’s here and that’s been working. image

Right, but could you post the code in the script that’s playing the animations?

I’d assume it’s this as this is the parent of the animations.

Based off of the screenshot you’re not playing the idle animation at all.

The animation should be played when tool is equipped, something along the lines of:

    Tool.Equipped:Connect(function(mouse)
        local Idle = script.Parent.Parent.Humanoid:LoadAnimation(script.Idle)
        Idle:Play()
    end)

And to play the idle animation again after the attack animation has stopped, just use attack.Stopped:wait() to wait until attack animation has finished and play the idle animation again.

Actually, could you try this?

local CanAttack = true
local Tool = script.Parent
local AttackAnim = Tool.Parent.Humanoid:LoadAnimation(script.Attack)
local IdleAnim = Tool.Parent.Humanoid:LoadAnimation(script.Idle)

Tool.Activated:Connect(function()
    if CanAttack == true then
        AttackAnim:Play()
        CanAttack = false

        wait(1)

        CanAttack = true
        AttackAnim:Stop()
        IdleAnim:Play()
        Tool.CanDamage.Value = true
    end
end)

I inserted that but it didn’t do anything, i’m really new to scripting so if you don’t mind me asking where exactly in the script do I put that?

You have to define the tool.

local Tool = script.Parent  -- The script is parented to the tool

    Tool.Equipped:Connect(function(mouse)
        local Idle = script.Parent.Parent.Humanoid:LoadAnimation(script.Idle)  -- define and load animation onto the player humanoid
        Idle:Play()  -- Play the animation
    end)

The tool variable should be placed near the top of the script (do this with all variables).
Tool equipped function can be placed anywhere.

Your doing the lords work, thank you.

I should also say, the idle animation will stop playing once the player click mouse 1.
To return back to the idle animation:

Tool.Activated:connect(function()
    if CanAttack == true then
        Idle:Stop()  -- Stop the animation when tool is activated
        attack:Play()
        CanAttack = false

        attack.Stopped:wait()  -- Wait until the animation finishes
        CanAttack = true
        Tool.CanDamage.Value = true
        Idle:Play()  -- Play the animation once attack animation is over
    end
end)

Is that supposed to make the animation stop after you unequip? Because it’s doing that.

No it plays the animation once the attack animation is over.
What do you mean? Do you not want the idle animation to stop after unequipping?

I mean it does this:

Just, stop the animations whenever you un-equip/equip the tool

local CanAttack = true
local Tool = script.Parent
local AttackAnim = Tool.Parent.Humanoid:LoadAnimation(script.Attack)
local IdleAnim = Tool.Parent.Humanoid:LoadAnimation(script.Idle)

Tool.Activated:Connect(function()
    if CanAttack == true then
        AttackAnim:Play()
        CanAttack = false

       AttackAnim.Stopped:Wait()

        CanAttack = true
        AttackAnim:Stop()
        IdleAnim:Play()
        Tool.CanDamage.Value = true
    end
end)

Tool.Unequipped:Connect(function()
    IdleAnim:Stop()
end)

Tool.Equipped:Connect(function()
     IdleAnim:Play()
end)