function onRunning(w)w/=getRigScale()if w>.01 then playAnimation("\119\097\108\107",.1,Humanoid)if currentAnimInstance and currentAnimInstance.AnimationId=="\104\116\116\112\058\047\047\119\119\119\046\114\111\098\108\111\120\046\099\111\109\047\097\115\115\101\116\047\063\105\100\061\049\056\048\052\050\054\051\053\052"then setAnimationSpeed(w/14.5)end pose="\082\117\110\110\105\110\103"else if emoteNames[currentAnim]==nil then playAnimation("\105\100\108\101",.1,Humanoid)pose="\083\116\097\110\100\105\110\103"end end end function onDied()pose="\068\101\097\100"end function onJumping()playAnimation("\106\117\109\112",.1,Humanoid)jumpAnimTime=jumpAnimDuration pose="\074\117\109\112\105\110\103"end function onClimbing(w)w/=getRigScale()playAnimation("\099\108\105\109\098",.1,Humanoid)setAnimationSpeed(w/12.0)pose="\067\108\105\109\098\105\110\103"end function onGettingUp()pose="\071\101\116\116\105\110\103\085\112"end function onFreeFall()if jumpAnimTime<=0 then playAnimation("\102\097\108\108",fallTransitionTime,Humanoid)end pose="\070\114\101\101\070\097\108\108"end function onFallingDown()pose="\070\097\108\108\105\110\103\068\111\119\110"end function onSeated()pose="\083\101\097\116\101\100"end function onPlatformStanding()pose="\080\108\097\116\102\111\114\109\083\116\097\110\100\105\110\103"end function onSwimming(w)if w>0 then pose="\082\117\110\110\105\110\103"else pose="\083\116\097\110\100\105\110\103"end end function getTool()for w,j in ipairs(Figure:GetChildren())do if j.className=="\084\111\111\108"then return j end end return nil end function getToolAnim(w)for w,j in ipairs(w:GetChildren())do if j.Name=="\116\111\111\108\097\110\105\109"and j.className=="\083\116\114\105\110\103\086\097\108\117\101"then return j end end return nil end function animateTool()if toolAnim=="\078\111\110\101"then playToolAnimation("\116\111\111\108\110\111\110\101",toolTransitionTime,Humanoid,Enum.AnimationPriority.Idle)return end if toolAnim=="\083\108\097\115\104"then playToolAnimation("\116\111\111\108\115\108\097\115\104",0,Humanoid,Enum.AnimationPriority.Action)return end if toolAnim=="\076\117\110\103\101"then playToolAnimation("\116\111\111\108\108\117\110\103\101",0,Humanoid,Enum.AnimationPriority.Action)return end end



function onRunning(speed)
	speed /= getRigScale()
	
	if speed > 0.01 then
		playAnimation("walk", 0.1, Humanoid)
		if currentAnimInstance and currentAnimInstance.AnimationId == "http://www.roblox.com/asset/?id=180426354" then
			setAnimationSpeed(speed / 14.5)
		end
		pose = "Running"
	else
		if emoteNames[currentAnim] == nil then
			playAnimation("idle", 0.1, Humanoid)
			pose = "Standing"
		end
	end
end

function onDied()
	pose = "Dead"
end

function onJumping()
	playAnimation("jump", 0.1, Humanoid)
	jumpAnimTime = jumpAnimDuration
	pose = "Jumping"
end

function onClimbing(speed)
	speed /= getRigScale()
	
	playAnimation("climb", 0.1, Humanoid)
	setAnimationSpeed(speed / 12.0)
	pose = "Climbing"
end

function onGettingUp()
	pose = "GettingUp"
end

function onFreeFall()
	if (jumpAnimTime <= 0) then
		playAnimation("fall", fallTransitionTime, Humanoid)
	end
	pose = "FreeFall"
end

function onFallingDown()
	pose = "FallingDown"
end

function onSeated()
	pose = "Seated"
end

function onPlatformStanding()
	pose = "PlatformStanding"
end

function onSwimming(speed)
	if speed > 0 then
		pose = "Running"
	else
		pose = "Standing"
	end
end

function getTool()	
	for _, kid in ipairs(Figure:GetChildren()) do
		if kid.className == "Tool" then return kid end
	end
	return nil
end

function getToolAnim(tool)
	for _, c in ipairs(tool:GetChildren()) do
		if c.Name == "toolanim" and c.className == "StringValue" then
			return c
		end
	end
	return nil
end

function animateTool()
	
	if (toolAnim == "None") then
		playToolAnimation("toolnone", toolTransitionTime, Humanoid, Enum.AnimationPriority.Idle)
		return
	end

	if (toolAnim == "Slash") then
		playToolAnimation("toolslash", 0, Humanoid, Enum.AnimationPriority.Action)
		return
	end

	if (toolAnim == "Lunge") then
		playToolAnimation("toollunge", 0, Humanoid, Enum.AnimationPriority.Action)
		return
	end
end
