How to play animation speed based on players speed and how to end an animation smoothly?

this is what i have now

i may have found a way to do the animation speed based off players speed but am not sure if its the proper way to do it. I thought you had to do this through adjustweight. I feel like this is a bad method to complete this as it could mess with original animation speeds but am not sure

currentAnimTrack:AdjustSpeed(Humanoid.Parent.HumanoidRootPart.AssemblyLinearVelocity.magnitude / 16)

( i put this in the default animate humanoid script)

i tried using some adjustWeights to see how they end the animation etc but i have no idea how to use adjustWeight,i found this from the dev fourm and its inside the default animate script, changing a couple lines

	if (anim ~= currentAnimInstance) then
		if (currentAnimTrack ~= nil) then

		currentAnimSpeed = 1.0
		-- load it to the humanoid; get AnimationTrack
		currentAnimTrack = humanoid:LoadAnimation(anim)
		currentAnimTrack.Priority = Enum.AnimationPriority.Core
		-- play the animation
		currentAnimTrack:Play(transitionTime, 0)
		currentAnim = animName
		currentAnimInstance = anim
		currentAnimTrack:AdjustWeight(1, 0.5)

pretty sure the adjustweight make the animation stop smoothly but, is there a way to make it begin stopping as the characters slowing down to idle? As it only begins the return to idle position when the characters already fully Idle, I’d want it to begin going to idle position as its slowing down to idle so it isnt choppy and playing an extra animation when the characters stopped

Is there a way to do this?