I have a tool that I’m trying to animate, and I’m using this block of code to preload the animations before the player equips it.
local function preloadAnims()
for i, v in pairs(animations) do
local track = animator:LoadAnimation(v)
repeat
task.wait(1/30)
until track.Length > 0
loadedAnims[i] = track
end
end
This works perfectly fine about 90% of the time. Otherwise, the animation track completely fails to load and the script gets stuck in an infinite yield. The only thing I can think of doing is to just call LoadAnimation() inside of a loop until it finally decides to work, but that sounds wildly stupid.
Are there any more reliable ways to load animations that I don’t know of? I have also tried preloading these animations via ContentProvider and that seems to have absolutely no effect.