Animation playing but the player remains idle

I created an animation to be played on the LocalPlayer, but when I tried it, the animation would play (TimePostion changing, markers reached) but the player doesn’t do anything, it just plays the default idle animation. I tried the animation on a rig and it worked properly first time, so is there something about the player that makes the animation not play?

Here is the animation part of my script:

local char = game:GetService("Players").LocalPlayer.Character
local hrp:BasePart = char:WaitForChild("HumanoidRootPart")
local hmnd = char:FindFirstChildWhichIsA("Humanoid")
local animator = hmnd:FindFirstChildWhichIsA("Animator")
	
cam.CameraType = Enum.CameraType.Scriptable
cam.CFrame = cf
	
hmnd.AutoRotate = false
hmnd.WalkSpeed = 0
hmnd.JumpHeight = 0

hrp.CFrame = hrpcf
hrp.Anchored = true
	
local anim = animator:LoadAnimation(script.Animation) -- script.Animation is just the animation i want to play
anim.Priority = Enum.AnimationPriority.Action4
anim.Looped = false
anim:Play()

-- below this are the marker events which run normally, the only problem is the actual player char doesn't play the animation
2 Likes

Are there any errors? If yes, can you screenshot it?

No, there are no errors shown. The animation starts but nothing happens to the actual player (TimePosition changes and I can use :AdjustSpeed normally, but the player just idles).

Can you add an anim.Stopped:Wait() after the anim:Play() then add a print like “Finished” or smthg like that?

I tried that, and it only printed when the animation was supposed to end (20 secs after start, which is the length of the anim). I’m pretty sure the issue is not the animation isn’t starting, it’s probably something with the player, considering it worked perfectly with a rig and since the markers’ function are called and the TimePosition changes. I’m not really good with animations, so it could be something else.

Maybe just make the priority to Action instead of Action4

try to play it on Humanoid instead of Animator

Tried it, but sadly it did not work. Action4 also has more priority over Action, but the animation doesn’t play on the character either way.

I have tried that and it still didn’t work. :LoadAnimationon theHumanoid` is deprecated, so it woudn’t be a good idea to rely on it.

try to reupload the animation with the priority set to action4 instead of changing it in the script

Still didn’t work for me.
(char limit)

What I’m trying to say is that the problem is most likely due to something in the player, the animation worked fine when testing it with a rig and the exact same script.

Are you using a custom character?

No, as I said I’m using the player’s own character for this. This could affect the animations, but I manually load them in as my game doesn’t need a player at the start. I was just using a rig for testing, and the animation worked normally for the rig but not for the player’s own character.

did you use that rig to make the animation?

No, I used a different rig for the animation, I just used the animation object in the script to animate the rig I used for testing.