Animation Should Play But Doesn't

Recently I’ve been working on some animations for my game but noticed that none of them work. I use a rig very similar to an R6 rig, the only difference is I moved the leg joints slightly.

Here is the script:

local player = game.Players.LocalPlayer
repeat wait() until player.Character
local character = player.Character
local humanoid = character.Humanoid
local animator = humanoid.Animator

local idleAnim = animator:LoadAnimation(script.IdleAnim)

idleAnim:Play()

When I test this, the player’s character just doesn’t do anything. This is a local script and I’ve named it Animate so it replaces the default animation script. The animation id is correct, so I’m not sure why this animation isn’t playing.

Probably this would fit better in #help-and-feedback:scripting-support.


Are there any errors? Try this script:

local player = game.Players.LocalPlayer
local character = player.Character or player.Character:Wait()
local humanoid = character.Humanoid
local animator = humanoid.Animator

local idleAnim = animator:LoadAnimation(script.IdleAnim)

idleAnim:Play()

Also, don’t name this “Animate”.

Have you set the animation priority to “action”?
image

I tried your solutions and unfortunately, they did not work. The script is intended to replace the default animation script, so I need to name it Animate in order to do that. This means priority doesn’t matter in this circumstance.

Here is the script more developed:

local player = game.Players.LocalPlayer
repeat wait() until player.Character
local character = player.Character
local humanoid = character.Humanoid
local animator = humanoid.Animator

local idleAnim = animator:LoadAnimation(script.IdleAnim)
local runAnim = animator:LoadAnimation(script.RunAnim)
local jumpAnim = animator:LoadAnimation(script.JumpAnim)

humanoid.Running:Connect(function(speed)
	if speed < 5 and not idleAnim.IsPlaying then
		for i, v in pairs(animator:GetPlayingAnimationTracks()) do
			v:Stop()
		end
		idleAnim:Play()
	elseif speed > 5 and not runAnim.IsPlaying then
		for i, v in pairs(animator:GetPlayingAnimationTracks()) do
			v:Stop()
		end
		runAnim:Play()
	end
end)

As you can see, I also included a running animation for when the player is moving. I am not sure where the problems are because I have used this script in the past and it has worked just fine. All of the values appear to be correct and no errors or warnings appear in the output, so I am completely puzzled.

After some more troubleshooting, I found a solution! I previously uploaded the animations to animation ids that were at least a year old, which seems to have been the problem. After uploaded the animations to their own animation ids, they worked.

1 Like