I am currently creating viewmodel animations for my game. For optimization, I am changing it so the animations load onto a clone of the viewmodel (deleted once animations are loaded) once when the player loads the game, as opposed to everytime the weapon is equipped. However, I am receiving the error mentioned in the title when attempting to do this. I have all the animation objects in a foldier and am loading them when the game is ran. I tried fixing this with PreloadAsync to no avail.
local ContentProvider = game:GetService("ContentProvider")
local tempVM = game:GetService("ReplicatedStorage").Viewmodels.RocketJumper:Clone()
local TempAnimator = tempVM.Humanoid:WaitForChild("Animator", .1) or Instance.new("Animator", ViewModel.Humanoid)
local PreLoadedTracks = {}
local animationINST = game:GetService("ReplicatedStorage").AnimationOBJ.RocketJumper:GetChildren()
for i, Anim in animationINST do -- i have switched to preloading the animations when player joins for optimization
ContentProvider:PreloadAsync({Anim})
local animationTrack = TempAnimator:LoadAnimation(Anim)
PreLoadedTracks[Anim.Name] = animationTrack
print(Anim.Name)
end
tempVM:Destroy()