Hi!
So I've been scripting an animation thing, and a for loop picks up all the animations in a folder and inserts it into a table. It works, until when I try to read the table, and it just returns nil.
local animInstances = { idleInstance = nil, mouseSlashInstance1 = nil, mouseSlashInstance2 = nil, mouseSlashInstance3 = nil, mouseSlashInstance4 = nil, mouseSlashInstance5 = nil, } local count = 0 for i, instance in ipairs(animations:GetChildren()) do count = count + 1 local gsub = animations[string.gsub(instance.Name, "Instance", "")] animInstances[count] = animations[gsub.Name] end for i,v in pairs(animInstances) do print(v) -- this doesn't return nil, and prints correctly end local idleAnim = animator:LoadAnimation(animInstances.idleInstance) -- this errors
any ideas?
fixed it, turns out that when i was using "count" it was creating a new variable in the table