Hello. I’ve recently come across an issue where my animations aren’t playing when played. There are no errors in the console. They are being played from a modulescript.
My code:
(Module):
local AnimationModule = {}
--//Rig Animations
local PlrRig=script.Parent
local PlrRigAnims=PlrRig.Anims
--Intro Animations
local IntroAnims={
["Wave1"]=PlrRig:FindFirstChild("Humanoid").Animator:LoadAnimation(PlrRigAnims.InteractWave1),
}
--Idle Animations
local IdleAnims={
["Idle1"]=PlrRig:FindFirstChild("Humanoid").Animator:LoadAnimation(PlrRigAnims.Idle1),
}
--//Actual functions
function AnimationModule.GetAnim(AnimTable)
local keys={}
for k,_ in pairs(AnimTable) do
table.insert(keys,k)
end
local randomKey=keys[math.random(#keys)]
table.clear(keys)
print(AnimTable[randomKey])
return AnimTable[randomKey]
end
function AnimationModule.ActionAnim(Action)
if Action=="Intro" then
print("intro")
local Anim=AnimationModule.GetAnim(IntroAnims)
print(Anim.Name)
Anim:Play()
end
end
return AnimationModule
(LocalScript that calls the module function)
IntEvents.DialogueToggleBindable.Event:Connect(function(NPC)
DialogueUi.Enabled=true
CellFrame.Position=UDim2.new(-1,0,0.608,0)
tween(CellFrame,{Position=UDim2.new(0.261,0,0.608,0)},0.8,Enum.EasingStyle.Cubic,Enum.EasingDirection.InOut)
AnimationMod.ActionAnim("Intro")
end)
The rig is inside a WorldModel inside of a Viewport Frame. The animation works if played directly in the LocalScript. I’ve tried to see if it’s an issue with animations and modules but I can’t find any good answers that fit my exact problem. Additionally, it prints the animation correctly. It’s just not playing at all.
If any other information is needed, please let me know and I’ll be happy to answer your questions!