GetKeyframeSequenceAsync not working correctly if called in fast succession in coroutine

(Note: I’d post this in the Bugs section but I can’t create a topic there.)

I have the following issue, which seems like a bug in the KeyframeSequenceProvider:GetKeyframeSequenceAsync function.

If you call KeyframeSequenceProvider:GetKeyframeSequenceAsync multiple times in quick succession inside a coroutine it won’t correctly download the animation.

Where it happens: when running the game from Studio.

When it happens: as soon as the code is ran at start (it seems that if the animation loads that this error does not happen, so the example script must be ran as soon as possible).

Reproduction steps:

  1. Create a part
  2. Attach the given script to it
  3. Run the game: the error should trigger.

What should happen:
The keyframes with 2 animation markers should load: “AttackStart” and “AttackEnd”.

What actually happens:
The keyframes are missing, so the markers are also not loaded.
Though if you continue from the 1st error sometimes the animation keys are then loaded correctly.

This is the script to execute, just attach it to any part.

local KeyframeSequenceProvider = game:GetService("KeyframeSequenceProvider")

for i=1,5 do
	
	coroutine.wrap(function()
		local KeyframeSeq = KeyframeSequenceProvider:GetKeyframeSequenceAsync("rbxassetid://6979253696") 

		print("!!!!! Printing: ")
		local bWereMarkersFound = false
		
		local Keyframes = KeyframeSeq:GetKeyframes()
		for _,Keyframe in pairs(Keyframes) do
			local MarkersInKeyframe = Keyframe:GetMarkers()
			for _,IterMarker in pairs(MarkersInKeyframe) do
				bWereMarkersFound = true
				print("!!!!! Marker: " .. tostring(IterMarker.Name))
			end
		end
		
		if bWereMarkersFound == false then
			error("markers not found")
		end

		
	end)()
	
end
1 Like

Thanks for the report! We’ve filed a ticket to our internal database and we’ll follow up when we have an update for you.

3 Likes

Is there any way we could get timing information on how to avoid this? I ran into this problem today.

This is very annoying. Something is caching the results incorrectly, so attempting to fetch the same assetid twice just gives you an empty keyframe sequence. Please resolve this ASAP!

1 Like

Still an issue, and is especially detrimental to our game. I rely on keyframe and pose data derived from KeyframeSequenceProvider for weapon hitboxes, and currently this makes it impossible to make my hitboxes work again.
I am preloading 30+ animations, so adding even a small yield would be detrimental.

2 Likes