Animation is not played but is marked as playing in the animator

My animation has been uploaded by my account and is in my library. I tried in a local script but also on the server but same error. I set the priority of the track to action.
Here is the local script it is in StarterPlayerScripts:

local Players = game:GetService("Players")

local player = Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()

local humanoid = character:WaitForChild("Humanoid")
local animator = humanoid:WaitForChild("Animator")

local Animation = Instance.new("Animation")
Animation.Name = "TestAnimation"
Animation.AnimationId = "rbxassetid://117281120933394"

-- Stop any currently playing animations
for _, track in pairs(animator:GetPlayingAnimationTracks()) do
	track:Stop()
end

print("Loading animation...")
local AnimationTrack = animator:LoadAnimation(Animation)
if AnimationTrack then
	print("Animation loaded successfully.")
	AnimationTrack.Priority = Enum.AnimationPriority.Action
	AnimationTrack:Play()
	print("Animation is playing: ", AnimationTrack.IsPlaying)
else
	warn("Failed to load animation.")
end

print(animator:GetPlayingAnimationTracks())

And this is the output but the character isn’t playing it.

Try loading the animation directly on the Humanoid. Even thought it’s deprecated, I still do it and it works 100% of the time.

Yes I thought about it but it doesn’t work either.

Have you tried not creating an animation instance but already have it created under the script? I have never seen anyone create animation instances before.

Same thing, it loads and it shows that it is in the animator but it does not play.

I found the problem, I don’t know why but the humanoid or animator needs time to load before loading an animation. I just added a task.wait(5) before the whole script and it worked. Thx for the help.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.