Freezing an animation once it's finished

I saw a Roblox topic on this and I still can’t figure it out. Once this animation is finished, I want it to freeze. In my mind I think I have to play the animation, wait for it to stop. Then play it again but adjust the time position to be at the end of the animation and the set the speed to 0 for it to stop completely. This code isn’t working for me. Help?

	local track = humanoid:LoadAnimation(anims:WaitForChild("Swinging"):FindFirstChild(anim))
	track.Name = "Spider"
	track.Priority = Enum.AnimationPriority.Action
		
	if not track.IsPlaying then
		track:Play()
	end
	
	track.Stopped:Wait()
	
	track:AdjustSpeed(0)
	
	if not track.IsPlaying then
		track:Play()
	end
	
	track.TimePosition = track.Length

Try to do

track.TimePosition = track.Length - 0.1

The times of AnimationTracks are recorded to three decimal places.
So you can subtract 0.001 (in case there’s a slight difference between 0.1 seconds from the end and 0.001 seconds from the end).

1 Like

Oh, I thought it was 0.1, I guess my animation rate was lower which mean’t I couldn’t do that.