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!

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		= ""
local AnimationsFolder 	= tool:WaitForChild('Animations',60)
local IdleInstance 		= character:WaitForChild('Animate',60).idle
local prevWalk 			= character:WaitForChild('Animate',60).run.RunAnim
local prevWalkId 		= ""

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)

	character.RightHand:WaitForChild('ToolMotor').Part1 = tool.GreatSword
	prevIdle.AnimationId 								= Idle.AnimationId
	IdleInstance.Animation2.AnimationId 				= Idle.AnimationId
	prevWalk.AnimationId = walk.AnimationId

	prevIdle.AnimationId 								= prevIdleId
	IdleInstance.Animation2.AnimationId 				= prevIdleId
	prevWalk.AnimationId								= prevWalkId
	character.RightHand:WaitForChild('ToolMotor').Part1 = nil

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:

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.