I couldn’t solve it at all, I’m using AnimationTrack.Ended event to play idle, but for some reason it plays after equip animation fades out into default tool one. The code:
tool.Equipped:Connect(function()
EQUIPPED = true
if hook_connection then hook_connection:Disconnect() end
if animations.Equip then
animations.Equip:Play()
StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, false)
animations.Equip.Ended:Wait()
print('ended')
animations.Idle:Play()
StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, true)
end
hook_connection = UserInputService.InputBegan:Connect(input_hook)
end)
When calling :Play() on animation tracks without passing any arguments, it defaults the fadeTime for the animation to .1
Also, if this is a server script that may also be why, and if so I’d suggest playing the animations on the client instead or replacing .Ended:Wait() with task.wait(animationtrack.length) instead.
It’s a client script.
Changing to :Play(0) on both animations didn’t help (and I tried it before this post), however task.wait(animationtrack.length) helped. I will mark this as solution, but I still want to know why it does that.
Also, you should call the idle animation before the equip animation instead.
tool.Equipped:Connect(function()
EQUIPPED = true
if hook_connection then hook_connection:Disconnect() end
if animations.Equip then
animations.Idle:Play()
animations.Equip:Play()
StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, false)
animations.Equip.Ended:Wait()
StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, true)
end
hook_connection = UserInputService.InputBegan:Connect(input_hook)
end)
Assuming your animation priority is right, the idle should play right after. The equip animation will play over the Idle as it is on Action priority and not Idle priority.
Also, another error you made here is the difference between .Ended and .Stopped.
instead of doing task.wait(animtrack.Length) you can do animation.Equip.Stopped:Wait()
Stopped will not wait for the animation to fade out and will fire when the defined animation ends. Ended fires when the animation stops moving everything in the world, including the fade out. (so ended will fire after the animation fades out, stopped will fire when the animation ends)