The first time an animation is loaded and played by a humanoid (of my own character), the animation seems to stop half way. I don’t know if this is directly relevant, but I have a script that sets the animation speed of the animation track to be 0 when it reaches a certain keyframe event.
I’ve tried to use the PreloadAsync function, but I don’t think that worked. I’m thinking that perhaps the keyframe event is triggered a little earlier before it reaches that point when the animation is played for the first time. If so… I’m still not sure what to do to prevent this weird hiccup when a player blocks or does some other animation for the first time.
Here’s a link to a gif of this happening:
https://imgur.com/a/qA3w29h
I prompt the animation to play 2 times. The first time, it triggers the keyframe event for pausing the animation but physically it looks like the keyframe event was triggered halfway. The second time, the keyframe event is triggered the right way.
You should make sure multiple animations aren’t overlapping each other causing the animation to stop earlier than it should. If that isn’t the problem, have you tried using animation markers instead of the keyframe reached? Roblox has animation markers for the purpose of doing an event in the middle of the animation. It’s essentially the same thing, but maybe it’ll work better and it’s more customizable than keyframes.
Thanks for the response! Yes, I actually use that event… I just forget it’s worded that way haha.
local function PauseAtMarker(Track)
local Con
local function Trigger()
Con:Disconnect()
Track:AdjustSpeed(0)
end
Con = Track:GetMarkerReachedSignal("Pause"):Connect(Trigger)
end
Also, here is some of the code used to play animations. Tracks are only played when they are not already playing, so I don’t think overlapping animations is the issue. But I’ll look further into this!
local function PlayTrack(Track)
if Track.IsPlaying == false then
if CurrentTrack then
CurrentTrack:Stop()
end
Track:Play()
Track:AdjustSpeed(1)
CurrentTrack = Track
local Funcs = ExtraFunctions[Track.Animation.Name]
if Funcs then
Funcs(Track)
end
end
end