Animation final keyframes renaming on export + new KeyframeReached bug (page 2)

Still can’t export animations without this happening. It just won’t quit overwriting the last keyframe. :frowning:

[quote] Still can’t export animations without this happening. It just won’t quit overwriting the last keyframe. :frowning:

[/quote]

[strike]Can confirm this. I’m trying to make a custom character animation and I get a delay like OP has at the end of each animation loop with newly uploaded animation now-a-days.[/strike]

EDIT: Nvm just noticed I did something incorrectly when exporting.

Assuming I’m understanding this correctly: Only the last keyframe gets it’s name changed? Until this does get fixed, here’s a possible, albeit hacky, fix:

AnimationTrack.KeyframeReached:connect(function(keyframeName)
	if string.match(keyframeName, "KF%d%.%d+") then
		print("Final KeyFrame Reached!")
	end
end)

The examples you gave were just KF0…, but you said they were KF___ so this matches “KF#.######…” instead.

Thanks Osyris, I’ll tuck that in for now. You’re a pal!

God, I seriously can’t catch a break right now. Osyris’s code works great but I’ve come upon a NEW problem: the roll animation only detects a certain keyframe ONCE, then doesn’t every other time you use it. This did NOT happen a couple months ago.

Press E while running to roll. Notice that it prints “ENDROLL” in the local output the first time you roll, but only prints “END” every other time. I’m a little upset that updates are still breaking my game, even with workarounds.

The “rolldone” keyframe is what causes the “ENDROLL” to print, by the way. For some reason, KeyframeReached only detects the “rolldone” keyframe once, despite it not being the final keyframe. Not only are keyframe names bugged on publish, now KeyframeReached is suddenly not doing its job. :\

I’ve read on the wiki that KeyframeReached only fires once for each Keyframe.
Reoccuring Keyframes won’t fire, it said.

Not sure why it’s that way, neither if it’s true, but I feel like that’s a problem.

[quote] I’ve read on the wiki that KeyframeReached only fires once for each Keyframe.
Reoccuring Keyframes won’t fire, it said. [/quote]

That’s right; API says, “Fires every time the animation reaches a new keyframe. Will not fire if the keyframe has already been used.

HOWEVER, on the Animations Tutorial page on the Wiki, it says, “For instance, in a walking animation you could name the frames where the character’s feet touch the ground and play a sound when those frames are reached.

I highly doubt that I want my character to make a footstep sound only the first time I take a step. That just doesn’t make any sense.

I can think of many uses for having it fire every time a Keyframe is reached, first or not; I, however, cannot think of one good reason why I’d only want it to fire once. And even if I did, I could disconnect the event or ignore certain calls. This definitely needs to be changed.

I have a walking animation that plays a footstep sound each time it reaches the “step” frame and it works fine. What the heck.

I seriously doubt only firing for a certain keyframe once, especially BETWEEN ANIMATIONS, is the intended behavior. Right now I’m simply incredibly annoyed that KeyframeReached & animation keyframes have suddenly become entirely unreliable for no reason at all.

For more proof of the new bug (KeyframeReached not firing properly after an animation has played once), go to my game and use the sword attacks (click 3 times in succession on the ground). Watch how it acts the first time on each swing, then see how it works once the animations have played a second time.

I probably can’t expect this to be fixed before the code freeze, but it’d be nice to know the issues have been taken note of for later.

Pertaining to this previous issue, I think it’s worth looking at the Animation plugin you’re using. Roblox’s Animation Editor plugin has the following code around line 2920:

-- check for end animation keyframe local keyframe = keyframeList[animationLength] if (keyframe == nil) then local kfd = Make('Keyframe', { Name = "KF" .. animationLength, Time = animationLength, Parent = kfs, }) ... end
which is most likely the cause of renaming the last Keyframe. I recommend modifying the plugin, inserting this line of code just above the aforementioned code:

local animationLength = keyframeTimeClamp(animationLength)

and if that doesn’t fix it then it’s most likely due to loss of float-precision such that it doesn’t recognize the last Keyframe as the last Keyframe due to its time not being precisely the animation length. If that’s the case, I would just write a loop that checks the contents of keyframeList for an index that is significantly close (perhaps within less than half of timeScale) to animationLength.

[quote] I have a walking animation that plays a footstep sound each time it reaches the “step” frame and it works fine. What the heck.

I seriously doubt only firing for a certain keyframe once, especially BETWEEN ANIMATIONS, is the intended behavior. Right now I’m simply incredibly annoyed that KeyframeReached & animation keyframes have suddenly become entirely unreliable for no reason at all. [/quote]

[quote] I have a walking animation that plays a footstep sound each time it reaches the “step” frame and it works fine. What the heck.

I seriously doubt only firing for a certain keyframe once, especially BETWEEN ANIMATIONS, is the intended behavior. Right now I’m simply incredibly annoyed that KeyframeReached & animation keyframes have suddenly become entirely unreliable for no reason at all. [/quote]

[/quote]

Why not just time it?
After playing the animation, wait the amount of time it would take to get to that keyframe then play the sound.
You may run into a small issue the first time the animation is played since it hasn’t loaded completely. I recommend preloading all of your animations.

Doesn’t having wait()s and whatnot pause the rest of the script? The whole point of using AnimationReached was that it could be threaded through a function easily without using the hassle (and unreliability w/ animations) that waits have.

It’s super easy to create threads yourself. Events do it internally anyways.

Spawn(function()
	WalkAnimation:Play()
	wait(duration)
	-- Code
end)

You could also use coroutines.

Just a quick reminder that this bug is still present. Compare the first set of sword swings to the second, in which KeyframeReached fails to activate at all. I REALLY don’t want to have to use workarounds for this just because a feature broke somewhere in the last couple months.

[quote] Just a quick reminder that this bug is still present. Compare the first set of sword swings to the second, in which KeyframeReached fails to activate at all. I REALLY don’t want to have to use workarounds for this just because a feature broke somewhere in the last couple months.

[/quote]

I’ve been working with animations recently and had the same issue. CodeWriter and I worked on it together.

You need to update your Animation plugin, close Studio, restart it, and edit your animation. At the end, you should have two keyframes - one named whatever you named it, and another that will be KF#.##. Delete the KF#.## one, re-export.

Does that solve the KeyframeReached breaking on other named frames bug, though? I got an easy workaround for the KF#.### bug but this new one is a doozy.

My game, which uses animations for almost everything, seems to work almost perfectly after I did this, yes.

I say almost perfectly, though, because on the first use of any animation that is shorter than, it looks like, .25 seconds, it breaks the first time. I’m considering posting a thread here about it, but no one ever seems to read my threads and I’d rather not waste the time, lol.

No dice. KeyframeReached still only works for the non-end keyframes for the first time an animation plays.

Is this still broken?

EDIT: yup