Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
2

Why sometimes animations do not play/work properly?

Asked by
valchip 789 Moderation Voter
6 years ago
Edited 6 years ago

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 pcalls 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

0
Both thinks are the same. Knineteen19 307 — 6y

1 answer

Log in to vote
1
Answered by 6 years ago

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!

0
Oh! It all makes sense now. I totally forgot about animations' priorities. I was really confused before but it now all makes sense. Thanks for helping! valchip 789 — 6y
0
No problem! Knineteen19 307 — 6y
0
Wait a second, sorry for unaccepting answer but I am still facing the same problem. This is so strange valchip 789 — 6y
0
Hrm? Knineteen19 307 — 6y
View all comments (13 more)
0
Except that the priorities are making my animations look strange. valchip 789 — 6y
0
I am having the same problem as before. valchip 789 — 6y
0
Do you have other animations playing at action priority? Did you set the priority before playing the animation? Knineteen19 307 — 6y
0
^ no for the first question and yes for the 2nd one, I also tried setting it straight at the animation valchip 789 — 6y
0
animation editor* valchip 789 — 6y
0
Can you edit your question and put the other gif of it not working? Knineteen19 307 — 6y
0
Of course one second. valchip 789 — 6y
0
Done, sorry for the delay but ROBLOX is not working that well rn. valchip 789 — 6y
0
Ok so I came up with a fix, I made the animation stop upon allowing the player to move. But the arms sometimes are still buggy. valchip 789 — 6y
0
I am pretty sure that the arm bug won't happen frequently and I am pretty sure that is not our fault. At least what I asked got answered. Thanks once again for helping. valchip 789 — 6y
0
No problem, so I went developing in my game for a bit. Knineteen19 307 — 6y
0
sorry* Knineteen19 307 — 6y
0
With the weird arm glitch, I half feel like that's a problem with the animation. There is this glitch I've found when making animations. If you don't put a position and orientation to a body part at the beginning of the animation, and then make it move after the begging, it messes up the animating. So try going into the animation and slightly moving the arms at the beginning. Knineteen19 307 — 6y
Ad

Answer this question