How would I make an idle animation?

How would I make an idle animation play when standing still and holding a tool?
I tried finding a script or making one myself and nothing has worked

(Like how if you hold a sword in SwordBurst 2 there’s an animation)

4 Likes

You can connect a function to the Humanoid.Running event, which will be called every time the player’s speed changes. Then, if the player’s speed is 0 then you can play the idle animation, and if its above 0 then you stop playing it.

That’s a hacky solution, and one that I would not suggest.
First, we know that there are 4 animation priorities (https://developer.roblox.com/api-reference/enum/AnimationPriority) – Idle, Movement, Action, and Core.
For this (aka idle animation), we’d be using the movement priority. I know it seems a little weird; you’re probably asking why we wouldn’t use the idle priority. Reason being that idle is the lowest of the low, and since we have a sword equipped, we only want ACTIONS to override it (e.g. swinging, jumping, etc). We don’t want walking to screw the animation over.
So via the animation editor, have your equipped animation ready, and toggle the looping to true and then make sure the animation priority is set to movement.

After that, you can load the animation and play it when the tool is Equipped, and :stop() when the tool is de-equipped.

9 Likes

Well it works great for me personally. Wouldn’t your method have overriding issues with the default idle animations?

Good question, but not if you set it up properly.
If you hit the lock icon, it should pretty much “cancel” it out, and allow the previous animation to overlay.
E.g. a sword idle animation might look like this:
https://gyazo.com/17fb45e22ea00edabdb056ccc2f08c13
We only need to change/animate what we’re going to be using, and as you can see from the image I posted we’re only going to be animating the right arm, so there’s no need to animate the other limbs

1 Like

Your thread is fairly ambiguous in the way that its title and contents do not match. Are you asking for how to create an animation, or how to get it to play?

To create an animation, use an animation plugin. There are several tutorials available so I won’t delve into how to create animations. To run it, it’s as simple as loading the animation on the Humanoid and playing it as in when you need it. Be mindful of your animation priorities.


@Spynaz

Why do that when you can create an animation with lower priority than your action animations (swinging, movement pose, etc)? They’ll overlap and the one with greater priority will play.

If you’re going for an equal animation priority approach, then you’d probably need it, yeah, if you mean to stop the animation or play it depending on if the player is actively moving or not.


@Capt_George

No. Core is the lowest.

Core - 1
Idle - 2
Movement - 3
Action - 4

All Roblox animations use the Core priority, with the jump animation using the Idle priority. Using the idle priority for an idle animation is fine. You could also adjust the weighting or use movement if you’re worried about the jump animation overwriting your idle.

3 Likes

My bad, forgot to list core :slight_smile:

Thanks for the correction

Yea you’re right about that. I just never really knew what priority the default animations were, so I just used the method that I stated. But from now on I’ll probably use the priority approach.

But there’s supposed to be a script to play the animation when he’s idle?

Something like this could work in a script inside the tool:

local tool = script.Parent
local anim = Instance.new(“Animation”)
anim.AnimationId = “http://www.roblox.com/Asset?ID=144884906” --replace with id
local track
tool.Equipped:Connect(function()
track = script.Parent.Parent.Humanoid:LoadAnimation(anim)
track.Priority = Enum.AnimationPriority.Action
track.Looped = true
track:Play()
end)
tool.Unequipped:Connect(function()
if track then
track:Stop()
end
end)

2 Likes

Just a notice for people who are reading this, Humanoid:LoadAnimation() is now depreciated. Use Humanoid:WaitForChild('Animator'):LoadAnimation() instead!