Animations not updating when id has been changed

I’m currently trying to replace some animations inside the Animate localscript in game. I’m experienced annoying issues with Idle animations.

Basically for some reasons, when setting the new animation while not moving nothing changes. Tried to change it both on server and client, didn’t work.

Following that, I tried to stop the tracks of the previous idle animations. The tracks were indeed stopped but my character would just remain frozen and no new animations were playing unless I’d move.

I solved this issue by making my character jump in order for the animation to update and I shouldn’t have to rely on methods like that, this is a big joke. At least it works, but I’d like to know if there’s a more efficient way.

https://gyazo.com/e7e309bd328b4e5229d383c25f4174ae
What I currently have

I’m also obviously using the default Animate localscript and I don’t plan on making my own for a little issue like that.

2 Likes

Just Play the idle animation yourself if

Humanoid#GetState() == Enum.HumanoidStateType.Idle
1 Like

There is no HumanoidStateType named “Idle”, also it’s Humanoid:GetState().

Your best way to detect if the humanoid isn’t moving is by getting the magnitude of the velocity of the HumanoidRootPart, or you can use the Humanoid.MoveDirection.

Unfortunately I’ve always had this issue too (Changing idle animation in-game doesn't work and note that this is from July), and there’s no easy way of fixing it except changing the animate script by ourselves.

2 Likes
-- Change Idle animation ID
if Humanoid.MoveDirection == Vector3.new(0,0,0) then
   LoadedIdleAnimation:Play();
end

Why wouldn’t this work @DEVLocalPlayer?

1 Like

I didn’t say it wouldn’t? I even mentioned it in my post

1 Like

If you use mine, it’s an easy way and there’s no need to change anything in the animate script is what I meant.

You did not understand what I meant. There’s no “Idle” HumanoidStateType, so you can’t use Humanoid:GetState() == Enum.HumanoidStateType.Idle.

1 Like

Okay, so I found a solution.
How to works, is it checks if an ID was changed for any Animation Instances in Roblox’s default animate script then changes its humanoidStateType to update the animations, so I grabbed the animate script and added the code under the “connect events” as seen in the image. I don’t know if this is the most efficient way, so please if someone has something else that works just as smoothly and similar to this then please, let us know.

I hope this helped you guys.

spawn(function()
	for i,v in pairs(script:GetChildren()) do
		for i2, anim in pairs(v:GetChildren()) do
			if anim:IsA("Animation") then
				spawn(function()
					anim:GetPropertyChangedSignal("AnimationId"):Connect(function()
						Humanoid:ChangeState(Enum.HumanoidStateType.Landed)
					end)
				end)
			end
		end
	end
end)

8 Likes

Not to bump this but if anyone knows a more efficient way please post it here for other people as well as myself because there may be cases in the future where the client needs to know if you’re landed or any other state etc… but this is a working solution if you need your animate animations updated. I Believe maybe you could make a way to call the function that updates the animate script in other scripts but it’s still annoying like sheeesh.

2 Likes

Hi,
I tested your method and it seemed to work, but since the Humanoid’s State changed on Client, others will not be able to see it.

2 Likes

Thank you for letting me know, I guess you’d have to find the script in the character from a server script and run the code from there. That should solve that issue. If you need any help, let me know. :+1:

1 Like