Animation Caching System

I made an animation caching system, but I’m not sure if it actually does anything. I feel like Roblox would probably already have implemented a caching system in the functions provided by them. Is my system useless?

Example of my system:

local LocalPlayer = game.Players.LocalPlayer
local Animations = {}

local function PlayAnim(Animation)
	if Animations[Animation] then
		Animations[Animation]:Play()
	else
		local LoadedAnimation = LocalPlayer.Character.Humanoid:FindFirstChild("Animator"):LoadAnimation(Animation)
		Animations[Animation] = LoadedAnimation
        LoadedAnimation:Play()
	end
end

LocalPlayer.CharacterAdded:Connect(function()
	Animations = {}
end)

Roblox already caches animations, so your caching system would probably not be that helpful.

1 Like