I am creating a game which naturally has a lot of assets. Because of this lower end computers might lag and consequently when they play an animation I have binded to a key with ContextActionService, it may be quite delayed.
In order to fix this I was thinking of preloading all of the animations at the start just by loading them all into the humanoid right off the bat instead of loading the specific animation into their humanoid after they press the designated key. But I was worried that loading a lot of animations into the humanoid like that may just make the lag worse?
I'm not quite sure what stress animation loading puts on the client and if loading a lot of animations will have any serious negative effects. The only help I could find about this was the ContentProvider/Preload function which has evidently depreciated.
Could I get some tips on how to handle this? Thanks!
-- REMEMBER THAT ANIMATIONS DON'T NEED REMOTES IF FE IS ON (when you play the animation, it will play for ALL clients automatically without a remote) local ContentProvider = game:GetService('ContentProvider') local Humanoid = game.Players.LocalPlayer.Humanoid local Animation = Instance.new('Animation') local AnimationTrack = nil function PreloadAsync(asset) ContentProvider:PreloadAsync(asset) end -- after setting the Animation id preload it before playing the track: PreloadAsync({Animation}) Animation.AnimationId = 9999 PreloadAsync:({Animation}) -- always have to be in arrays {} AnimationTrack = Humanoid:LoadAnimation(Animation) AnimationTrack:Play() -- You can remove animation tracks like this: AnimationTrack.Name = "CUSTOM" function STOP_TRACKS() local Tracks = Humanoid:GetPlayingAnimationTracks() for _, v in pairs(Tracks) do if v.Name == 'CUSTOM' then v:Stop() v:Destroy() end end end