As you can see, the animate function will instantly play the next animation. How would I stop the second function from being called until the first animation function finishes.
function module:EquipAnim()
Animate("rbxassetid://8911061148", false)
Animate("rbxassetid://8900324101", true)
end
function Animate(animationID, looped)
local animation = Instance.new("Animation")
animation.AnimationId = animationID
local animator = self.ViewModel.Humanoid:FindFirstChildOfClass("Animator")
local AnimationTrack = animator:LoadAnimation(animation)
AnimationTrack.Looped = looped
AnimationTrack:Play()
end
function Animate(animationID, looped)
local animation = Instance.new("Animation")
animation.AnimationId = animationID
local animator = self.ViewModel.Humanoid:FindFirstChildOfClass("Animator")
local AnimationTrack = animator:LoadAnimation(animation)
AnimationTrack.Looped = looped
AnimationTrack:Play()
AnimationTrack.Stopped:Wait()
end
Yep, it works fine, my initial problem with the animation being cut off was simply because of an animation error.
But there’s this moment when the second animation is being played and it seems to bug out? https://gyazo.com/09933f19d44d17f4d62f768b6801a180
I’d say load the animation into the humanoid at the start of the script before any other function like Equip is allowed to run. That way when you run that function, it doesn’t take time to load it up via id and you can run it instantly (basically preloaded)
Using PreloadAsync, the problem still seems to persist.
I suppose I’ll have to individually play out the animations, but this seems like a really hacky way of doing it.