WHY is this returning nil

	print(TracksAttack)
	local Animation:AnimationTrack = TracksAttack[math.random(1, DictionaryLength(TracksAttack))]
	print(Animation)

the first line prints out a table and that table does have contents in it. DictionaryLength has been proven to return the correct number.

The third line is printing nil, but it should instead be printing out something like Attack0 as that is the only attack in the table TracksAttack

image

There is indeed Attack0 inside of the table, but whenever I try and get a random attack from the table, it returns nil.

Because TracksAttack is a dictionary, not an array. There is no index 1 in TracksAttack. The only index is “Attack0”.

1 Like

I changed it to a table and it works now

1 Like

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