Play random animation with Animation Player is not working

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Idleman

The idea is simple, I want the animation player to play random animation. The animation name prints out ok, but the animation is not playing. Any thing wrong in my code below? Thank you.

func play_random_animation():
	var list = [“Name01", “Name02"]
	list.shuffle()
	var animationName = list[0]
	$animationPlayer.play(animationName)

have you created the animations

magicalogic | 2021-05-08 05:52

Yes, both animation plays fine individually. However, it just won’t play with the function after shuffle, not sure why.

Idleman | 2021-05-08 05:59

when are you calling this function? Also I am going to do this live on stream in 10 minutes here: https://www.youtube.com/watch?v=fFQLwxayunI

scrubswithnosleeves | 2021-05-08 14:21

:bust_in_silhouette: Reply From: scrubswithnosleeves

Answering your Question LIVE on YouTube: https://www.youtube.com/watch?v=fFQLwxayunI