Hello, my name is vamik64 and I have recently faced some issues meanwhile developing on ROBLOX.
So sometimes animations do not play even tho the script does work. The way the animations are loaded and played is correct. This is the method which even wiki suggests:
local animation = Instance.new("Animation") animation.AnimationId = "rbxassetid://123456789" local animTrack = Humanoid:LoadAnimation(animation) animTrack:Play()
I am pretty sure there is also no other way of doing this. It is not my first time facing this problem. I have been facing this problem many times and it is so annoying. This error occurs randomly. It always occurs at the start of the game tho. Here is a GIF which shows an animation playing properly: https://gyazo.com/bf174a17049beec09ff69f94abd7bbf4
And here is a GIF which shows that the animation that I am playing doesn't play at all: https://gyazo.com/bf174a17049beec09ff69f94abd7bbf4
I ran some test and used some pcall
s to determine where the problem stands, the character loading, animation loading or animation playing but all of them seem to work fine when the animation is not playing.
~~~~~
So Blue_Deku19 suggested changing the priority of my animation. This is what happens: https://gyazo.com/ed081b68b387f98e8200fd7704ccd9dc It is quite strange and also the arms sometimes are strange too.
-vamik64
I think I might know the problem you're experiencing here. I've done a bit with animating stuff in my time, so I've experienced this too. As you said, your script isn't wrong, you just need to set priorities for the animation. If you want the wiki for animation priorities, here it is (https://developer.roblox.com/api-reference/enum/AnimationPriority) but what you need to do is:
local animation = Instance.new("Animation") animation.AnimationId = "rbxassetid://123456789" -- Is this animation id legit? If so, then GG. local animTrack = humanoid:LoadAnimation(animation) animTrack.Priority = Enum.AnimationPriority.Action -- This sets the priority to the highest priority, so that other animations won't play over it, unless they have the same priority. animTrack:Play()
Hope this helps!