I’m trying to load animations tracks into a module script so I can require the animations instead of loading them individually every time.
This is the code I have in a local script, not module script.
local player = game.Players.LocalPlayer
local character = player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
local animationIds = {
["swordIdle"] = "rbxassetid://", --insert ID here, filled in already in studio
["swordM1"] = "rbxassetid://" --insert ID here, filled in already in studio
}
local animationTrack = {}
for i,v in animationIds do
local animation = Instance.new("Animation")
animation.Name = i
animation.AnimationId = v
animationTrack[animation.Name] = humanoid.Animator:LoadAnimation(animation)
end
What I don’t understand is how I am going to load an animation track if it requires the humanoid.
There’s this forum post, but it never fully answers it.