local g=""local e=nil local V=nil local y=nil function toolKeyFrameReachedFunc(e)if e=="\069\110\100"then playToolAnimation(g,.0,zombie)end end function playToolAnimation(b,p,M,E)local u=rollAnimation(b)local I=animTable[b][u].anim if V~=I then if e~=nil then e:Stop()e:Destroy()p=0 end e=M:LoadAnimation(I)if E then e.Priority=E end e:Play(p)g=b V=I y=e.KeyframeReached:connect(toolKeyFrameReachedFunc)end end function stopToolAnimations()local b=g if y~=nil then y:disconnect()end g=""V=nil if e~=nil then e:Stop()e:Destroy()e=nil end return b 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
