Switch between to animations!

I am making a viewmodel system. I have an equip animation, and after thats finished I want it to go to the idle animation, but for some reason after the equip animation is finished, it reverts back to the default character rig and then plays the idle animation.


Is there anyway to smoothly lerp between these animations? Im not to familiar with animation systems so any help is appreciated.

local module = {}


function module.Init(...)

	local anim = viewModel.Animations.Equip
	local idle = viewModel.Animations.Idle
	
	function module.Start()
		local animationTrack = viewModel.AnimationController.Animator:LoadAnimation(anim)
		animationTrack.Looped = false
		animationTrack:Play()
		animationTrack.Stopped:Connect(function()
			print("Ahh")
			local idleTrack = viewModel.AnimationController.Animator:LoadAnimation(idle)
			animationTrack.Looped = true
			animationTrack:Stop()
			idleTrack:Play()
		end)
	end
end

return module

It would be good if you loaded both of your Animations (Equip and Idle) before actually using them:

local anim = viewModel.Animations.Equip
local idle = viewModel.Animations.Idle

local animationTrack = viewModel.AnimationController.Animator:LoadAnimation(anim)
local idleTrack = viewModel.AnimationController.Animator:LoadAnimation(idle)

Also why exactly do you loop the equip Animation after it already stopped?

there is alternative way to play animations and smoothly blend between them:

  1. Make sure every animation is looped and is playing directly
  2. Manage animation priorities with :AdjustWeight()