Idle Animations are not working well in this situation

I was animating a bit and I’ve realized a small problem I can’t solve. I’ve been trying to find a good solution to this ( YouTube, Developer Forum, Roblox Developer Hub), but nothing helped.
Here is the problem:
I want to make 2 Custom Idle Animations for my character. I am using a popular “Animate” local script which controls over the animations for players. Making 1 Custom Idle Animation is easy, but making 2 gives me some errors. I made 1st Idle Animation that would play all the time when player is standing and 2nd Idle Animation where is my character rising his head and placing it on his head and kinda scratching a bit. So, this 2nd Idle Animation is playing in a random time while main 1st Idle Animation is still playing. Now the problem is, while I am standing, 1st Idle Animation is playing which is good and then comes this 2nd Idle Animation.
After 2nd Idle Animation is played, my character stops playing any of these animations, he just turns to T-Pose and won’t play any animation at all until I start moving again.

I am telling again that I am using a basic “Animate” local script.
I’ve also tried to make these Animations into “Movement” instead of “Action” priority and that didn’t work too.

It would be great if someone could leave a great solution to this. Thanks!

4 Likes

You should try stopping the first animation so the second one can play, and when the second one is finished, play the first one again.

1 Like

Seems easy, but I’ve tried all methods to actually change the ID of the animation in the script. None of these worked. :confused:

Can you provide some code?

This 30 character thing is annoying :frowning:


As I said, I am using the main “Animate” script.

I believe you’re gonna have to change the script to randomly chose one of the idle animations, and then have that animation be played on the character.

Look through the script and see if you can find where animations are played. If you don’t know how to change it, then post that part of the script and I’ll tell you how.

This script can work good on a player, idle animations are working well, but if I change ID to my own, then I get confused and I can’t make it as it is supposed to be. There must be the easiest way.
Anyways this is the code.

function onRunning(speed)
  if speed > 0.5 then
      local scale = 8.0
      playAnimation("walk", 0.2, Humanoid)
      setAnimationSpeed(speed / scale)
      pose = "Running"
      else
      if emoteNames[currentAnim] == nil then
         playAnimation("idle", 0.2, Humanoid)
         pose = "Standing"
      end
   end
end

When you play the idle animation, you’re not identifying which idle animation you want to play.

I would make a local variable that will store a random idle animation and then have that animation play rather than referencing the global idle animation table.

local animNames = {
	idle = 	{
				{ id = "http://www.roblox.com/asset/?id=3058142006", weight = 1 },
				{ id = "http://www.roblox.com/asset/?id=3058136682", weight = 1 },
				{ id = "http://www.roblox.com/asset/?id=3058136682", weight = 9 }
			},

What am I going to do with this table then? I still don’t know which animation should be placed and where.

EDIT: I am just wondering how does the “Animate” script works well when it’s default in the player and it doesn’t work when I made my custom animations. There has to be some sort of difference or explanation to this, which can be a solution too. That’s what am I actually looking for.

Idle AnimationTrack 2 has a keyframe named “End” to signal when it stops, and when IdleAnimationTrack1 takes over. However keyframes have been deprecated, and are instead replaced by the “GetMarkerReachedSignal” function - don’t worry, it’s almost the same thing as before.

To get your custom idle animation 2 to work, just replace the current default animation code with the one I wrote https://pastebin.com/psvPSf4P to be compatible with ‘AnimationTrack:GetMarkerReachedSignal’ as well as the deprecated ‘AnimationTrack.KeyFrameReached’. Your animation also has to have a marker named ‘End’ to distinguish where you want idle animation 1 to take over.

The good news is this fix is easy. The bad news is that, based on the animationTrack API change and the not updated character animation script, future animationTrack API changes will likely not come with default character animation script changes - you’ll have to update them on your own.

Edit: My script is the same as the default character animation script, the only changes are to enable “getMarkerReachedSignal” to work

1 Like

I do believe your using the R15 Animate script since it contains a table with 3 idle animations and I also know that your using a custom Character am I correct based on the Explorer? If so, you would need to change the animate script to r6 since your only deciding to use two Idle animations. You also want to check if both animations loop. Make sure it also fits with your startercharacter.

1 Like