Hello! i am trying to make a Animation Controller where i can control all the animations from a single module.
The issue is, the animation is not playing when i try play it from a certain function.
I have tried searching it up but have not found any solutions.
This is the Code i am using the load the animation to the player whilst adding it to an array:
function AnimationController:KnitStart()
for i,v in next, AnimationStorage:GetDescendants() do
if v:IsA('Animation') then
local suc, anim = pcall(function()
return Animator:LoadAnimation(v)
end)
if suc then
LoadedAnimations[v.Name] = anim
end
end
end
end;
And this is the code i am using to play the animation found in the array
function AnimationController.Play(Animation)
local Name = Animation:lower()
local Animation;
for i,v in next, LoadedAnimations do
if i:lower() == Name then
Animation = v;
end;
end;
repeat Animation:Play();
until Animation.IsPlaying == true;
print(Animation.IsPlaying)
end;
Bizarre enough, when i put Anim:Play() under LoadedAnimations[v.Name] = anim (On the first code block of this post) the animation does play, but when i play it from the Play() function (The second block of code of this post) it does not play at all.
Thank you for all of your feedback, and have a lovely day!