Smooth Idle Transition for Tools

  1. What do you want to achieve? Keep it simple and clear!
    Just like the title said, I want to make the idle animation smooth as possible when equipping a tool.

  2. What is the issue? Include screenshots / videos if possible!

https://gyazo.com/dd16ee7200cf9cbf5afd34003645ec35.mp4

The issue is that the sword does not go to it’s proper place when equipped.

The proper place is at 0:03 of the Gyazo Video.

  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub?

I looked for solutions in Developer Hub and tried most of them, the current method I used here was the “Changing Animate(from Character)'s Animation Id.”, if it’s confusing you can look at the code to make more sense.

local tool 				= script.Parent
local player 			= game.Players.LocalPlayer
local character 		= player.Character or player.CharacterAdded:Wait()
local prevIdle 			= character:WaitForChild('Animate',60).idle.Animation1
local prevIdleId		= "http://www.roblox.com/asset/?id=507766388"
local AnimationsFolder 	= tool:WaitForChild('Animations',60)
local IdleInstance 		= character:WaitForChild('Animate',60).idle
local prevWalk 			= character:WaitForChild('Animate',60).run.RunAnim
local prevWalkId 		= "http://www.roblox.com/asset/?id=913402848"

local Idle 				= AnimationsFolder.Idle
local cached_Idle 		= character.Humanoid:WaitForChild('Animator',60):LoadAnimation(Idle)
local walk 				= AnimationsFolder.Walk
--local cached_walk 		= character.Humanoid:WaitForChild('Animator',60):LoadAnimation(walk)



tool.Equipped:Connect(function()
	cached_Idle:Play()
	character.RightHand:WaitForChild('ToolMotor').Part1 = tool.GreatSword
	tool.Connect:FireServer(tool.GreatSword)
	prevIdle.AnimationId 								= Idle.AnimationId
	IdleInstance.Animation2.AnimationId 				= Idle.AnimationId
	prevWalk.AnimationId = walk.AnimationId
	cached_Idle:Stop()
end)


tool.Unequipped:Connect(function()
	prevIdle.AnimationId 								= prevIdleId
	IdleInstance.Animation2.AnimationId 				= prevIdleId
	prevWalk.AnimationId								= prevWalkId
	character.RightHand:WaitForChild('ToolMotor').Part1 = nil
end)

I have had this problem before, what I did was change the humanoid state of the character to update the animation immediately without having to move.

Can you give me an example on how I would do this? Thank you!

in tool.Equipped:

character.Humanoid:ChangeState(Enum.HumanoidStateType.Landed)

https://gyazo.com/7f036efc57de0f57dcfd638218c8949c.mp4
It works good, but is there a way so that the Sword doesn’t spin like that?

it’s because it takes a bit to interpolate to the new pose, so I would play an equip animation over that

Oh, didn’t think of that; thank you!

Just wanted to add that you can change the fade time of both playing/stopping an animation via the first argument of the Play/Stop methods respectively.

Track:Play(0.5) --Animation 'fades' for 0.5 seconds before reaching full speed.
Track:Stop(0.5) --Animation 'fades' for 0.5 seconds before reaching zero speed.