Hello, I’m playing an animation and I’m attempting to freeze it at the last frame or after it concludes. Though after the animation concludes, the player just goes back to the default animation.
One way would be to copy the default animation and change the arm Position in that one so the arm stays up.
Then have that animation loaded into the game already until you need to use it, and play it after the arm is raised. After the arm is dropped again go back to the default animation.
To answer your main question though, your code waits until the animation has already stopped, so that probably won’t work. Something like this might work instead:
track:Play()
-- Stop the track once it finishes
track.Stopped:Once(function()
-- Make sure the track is playing
if not track.IsPlaying then track:Play() end
-- Stop the track and make sure the time position is correct
track:AdjustSpeed(0)
track.TimePosition = track.Length
end)
I would recommend not trying to pause animations at the very end with any method though, since AnimationTracks don’t replicate when directly modified in some cases.
If your animation is just the arm raising, you can use animation fade to do that. Animation fade is where the playing animation fades from the current one to the new one. You can choose how long the fade takes by doing AnimationTrack:Play(fadeTimeInSeconds).
So to you fade to a similar result:
Create an animation with only your final arm position, set it to looped (so it keeps running)
When you play it, use :Play(fadeTime), with fadeTime as the amount of time you want it to take for the arm to raise
You can also edit the default toolhold animation which is what some basic tools like this do. If your code goes into the humanoid’s Animate LocalScript, it can replace the animation under “toolhold” or “toolidle” (forgot the name) inside the Animate script of the character with your animation when the tool is inside the character then revert the change when the tool leaves the character. This causes the tool holding animation to be your tool’s holding animation instead of the default one. This doesn’t have a fade option though I don’t think.