I know that with animation track there’s an event stopped()
but this event doesn’t appear to be here for the new animations, How would I make a script that waits for an animation to finish, with the current animation (Instance.new("Animation")
)
Maybe something on here can help you
You don’t play an Animation. You play an AnimationTrack.
AnimationTrack.Stopped:Wait()
is what you want
animation.Stopped:Wait()
Hmm… that’s what I would do
local animation = Instance.new("Animation")
animation.AnimationId = "rbxassetid://0000"
local animationTrack = humanoid.Animator:LoadAnimation(animation)
animationTrack:Play()
animationTrack.Stopped:Connect(function()
print("animation ended")
end)
Animation and AnimationTrack are 2 different things. Stopped
is an event for AnimationTrack
, not Animation
.
but load animation is becoming deprecated, so I’m avoiding it.
LoadAnimation is deprecated for the Humanoid
Instance. They recommend using the Animator
Instance for animations
sothen how do i wait for stopped with animator
It’s essentially the same thing you would do with LoadAnimation
for Humanoids
, just with a different Instance. But if you’re talking about yielding the thread then:
local animation = Instance.new("Animation")
animation.AnimationId = "rbxassetid://0000"
local animationTrack = humanoid.Animator:LoadAnimation(animation)
animationTrack:Play()
animationTrack.Stopped:Wait() -- will pause the thread until the animation ends
-- continue code here
wait load animation is being deprecated? what other method is there gonna be for me to use.
humanoid.animator can be used from now on
i dont understand it can you write an example of how you would play one? and can you still do it on the client.