local o=""local u=nil local A=nil local D=nil function toolKeyFrameReachedFunc(u)if u=="\069\110\100"then playToolAnimation(o,.0,zombie)end end function playToolAnimation(r,h,U,s)local p=rollAnimation(r)local a=animTable[r][p].anim if A~=a then if u~=nil then u:Stop()u:Destroy()h=0 end u=U:LoadAnimation(a)if s then u.Priority=s end u:Play(h)o=r A=a D=u.KeyframeReached:connect(toolKeyFrameReachedFunc)end end function stopToolAnimations()local r=o if D~=nil then D:disconnect()end o=""A=nil if u~=nil then u:Stop()u:Destroy()u=nil end return r end


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

function toolKeyFrameReachedFunc(frameName)
	if (frameName == "End") then
		playToolAnimation(toolAnimName, 0.0, zombie)
	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
