Table simply not updating

Hello,
This issue is really stupid. I don’t know what I’m missing but I’ve looked at these 5 or so lines for a couple of hours now.

local Eanims = {}
	
for _, anim in enemyModel.animations:GetChildren() do
	Eanims[anim.Name] = enemyModel.AnimationController:LoadAnimation(anim)
end
print(#Eanims)

The last line prints 0 no matter what. The for loop can correctly print anim.Name and it sees all animations I want to add. The loop runs the correct number of times too, printing each animation’s name. If I just try to play the loaded animation in the loop it works too. The only issue is this stupid Eanims table.

I even tried table.insert just to see what would happen and it told me I couldn’t change a readonly table, so something I did might have made it think that it’s read only. This is in a localscript.

When you do #Eanims it searches the array part of the list, but you’re indexing the keys in the hash so it won’t loop through and detect 0 items.

1 Like

Weird. Later in the script playing it didn’t work until I changed:

loadedNPCs[c].animationName:Play()
to
loadedNPCs[c][animationName]:Play()

I thought I was better than this.

Thank you!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.