PcoWSkbVqDnWTu_dm2ix
We use cookies on this site to enhance your user experience
Collapse Sidebar

Animation

AnimationTrack

Animation

The Animation object that was used to create this AnimationTrack. To create an AnimationTrack the developer must load an Animation object onto a Humanoid or AnimationController using the Humanoid/LoadAnimation method.

The Animation property is used to identify the underlying Animation of an AnimationTrack.


Code Samples


Listen For New Animations

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)
	humanoid.AnimationPlayed:Connect(function(animationTrack)
		local animationName = animationTrack.Animation.Name
		print("Animation playing "..animationName)
	end)
end