local v=""local o=nil local F=nil local z=nil function toolKeyFrameReachedFunc(o)if o=="\069\110\100"then playToolAnimation(v,.0,Humanoid)end end function playToolAnimation(f,Q,K,L)local x=rollAnimation(f)local G=animTable[f][x].anim if F~=G then if o~=nil then o:Stop()o:Destroy()Q=0 end o=K:LoadAnimation(G)if L then o.Priority=L end o:Play(Q)v=f F=G z=o.KeyframeReached:connect(toolKeyFrameReachedFunc)end end function stopToolAnimations()local f=v if z~=nil then z:disconnect()end v=""F=nil if o~=nil then o:Stop()o:Destroy()o=nil end return f end


local toolAnimName = ""
local toolAnimTrack = nil
local toolAnimInstance = nil
local currentToolAnimKeyframeHandler = nil

function toolKeyFrameReachedFunc(frameName)
	if (frameName == "End") then
		playToolAnimation(toolAnimName, 0.0, Humanoid)
	end
end


function playToolAnimation(animName, transitionTime, humanoid, priority)
	local idx = rollAnimation(animName)
	local anim = animTable[animName][idx].anim

	if (toolAnimInstance ~= anim) then

		if (toolAnimTrack ~= nil) then
			toolAnimTrack:Stop()
			toolAnimTrack:Destroy()
			transitionTime = 0
		end

		-- load it to the humanoid; get AnimationTrack
		toolAnimTrack = humanoid:LoadAnimation(anim)
		if priority then
			toolAnimTrack.Priority = priority
		end

		-- play the animation
		toolAnimTrack:Play(transitionTime)
		toolAnimName = animName
		toolAnimInstance = anim

		currentToolAnimKeyframeHandler = toolAnimTrack.KeyframeReached:connect(toolKeyFrameReachedFunc)
	end
end

function stopToolAnimations()
	local oldAnim = toolAnimName

	if (currentToolAnimKeyframeHandler ~= nil) then
		currentToolAnimKeyframeHandler:disconnect()
	end

	toolAnimName = ""
	toolAnimInstance = nil
	if (toolAnimTrack ~= nil) then
		toolAnimTrack:Stop()
		toolAnimTrack:Destroy()
		toolAnimTrack = nil
	end

	return oldAnim
end
