We use cookies on this site to enhance your user experience

Listen For New Animations

Listen For New Animations

Oct 01 2018, 2:20 AM PST

The following code sample includes a function that prints the name of an animation whenever an AnimationTrack plays on a humanoid.

A connection is made listening to the Humanoid.AnimationPlayed and the name of the underlying animation is printed.

Please note that AnimationPlayed is a member of both Humanoid and AnimationController which this example would also work on.

function listenForNewAnimations(humanoid)
		local animationName = animationTrack.Animation.Name
		print("Animation playing "..animationName)