I store my animations in an animation database which is a module, this makes ot easy for me to preload animations and call on animations in any context i need thrm.
I recommend using a ModuleScript that loads all the AnimationTracks onto the current humanoid, and reloads them when the character respawns, so that you can use them on the client to play the animations
local loadedAnimationTracks: {[string]: {[string]: AnimationTrack}} = {}
do
local animationsToLoad: {[string]: {[string]: Animation}} = {}
do
local animationIdsToLoad = {
Bat = {
M1 = "rbxassetid://136802863065287",
M2 = "rbxassetid://89876719415286",
Finisher = "rbxassetid://111012784297932",
Equip = "rbxassetid://110749480818182",
Idle = "rbxassetid://88373637089906"
}
}
for groupName, animations in animationIdsToLoad do
local group = {}
animationsToLoad[groupName] = group
for animationName, animationId in animations do
local animation = Instance.new('Animation')
animation.AnimationId = animationId
animationsToLoad[animationName] = animation
end
end
end
local Players = game:GetService('Players')
Players.LocalPlayer.CharacterAdded:Connect(function(character)
local humanoid = character:FindFirstChildWhichIsA('Humanoid')
if humanoid == nil then return end
for groupName, animations in animationsToLoad do
local group = {}
loadedAnimationTracks[groupName] = group
for animationName, animation in animations do
group[animationName] = humanoid:LoadAnimation(animation)
end
end
end)
end
return loadedAnimationTracks
That way, it just automatically loads all animations when the character spawns and also doesn’t leak memory by creating multiple animations for the same thing