How To Continue A Loaded Animation

I am trying to save a loaded animation to reuse, in order to stop it.

For context, I am making a stand.

The issue is I use a remote event to play animations on the server side, however doing this I cannot load the same animation as before again.

So my question is, how do I reuse the same loaded animation? Where can I find the loaded version itself?

2 Likes

You should try loading the animation from the client, since with having the variable you can do a :Pause() on it. But from the server, you’ll just be wasting memory

I tried loading the animation from the client, the issue is, it doesn’t ended up showing for other players. I believe because I am loading an animation not for my own character.

1 Like

you can get the loaded animation track if you load the animation on an Animator and used the function GetPlayingAnimationTracks ( )

1 Like

NPC animations should be loaded on the server.
https://developer.roblox.com/en-us/api-reference/function/Animator/LoadAnimation

local AnimationTrack = nil

RemoteEvent.OnServerEvent:Connect(function(Player)
	if not AnimationTrack then AnimationTrack = Instance:LoadAnimation(AnimationObject) end
	
	AnimationTrack:Play()
	task.wait(0.5)
	AnimationTrack:Stop()
end)

With this approach the animation would only be loaded once (regardless of how frequently the ‘RemoteEvent’ object is fired).

you did it kinda wrong then uhhh