function onSwimming(Q)if userAnimateScaleRun then Q/=getHeightScale()end if Q>1.0 then local x=10.0 playAnimation("\115\119\105\109",.4,Humanoid)setAnimationSpeed(Q/x)pose="\083\119\105\109\109\105\110\103"else playAnimation("\115\119\105\109\105\100\108\101",.4,Humanoid)pose="\083\116\097\110\100\105\110\103"end 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 getToolAnim(Q)for Q,x in ipairs(Q:GetChildren())do if x.Name=="\116\111\111\108\097\110\105\109"and x.className=="\083\116\114\105\110\103\086\097\108\117\101"then return x end end return nil end local Q=0 function stepAnimate(x)local H=1 local q=1 local E=x-Q Q=x local K=0 local k=false if jumpAnimTime>0 then jumpAnimTime=jumpAnimTime-E end if pose=="\070\114\101\101\070\097\108\108"and jumpAnimTime<=0 then playAnimation("\102\097\108\108",fallTransitionTime,Humanoid)elseif pose=="\083\101\097\116\101\100"then playAnimation("\115\105\116",.5,Humanoid)return elseif pose=="\082\117\110\110\105\110\103"then playAnimation("\119\097\108\107",.2,Humanoid)updateVelocity(x)elseif pose=="\068\101\097\100"or pose=="\071\101\116\116\105\110\103\085\112"or pose=="\070\097\108\108\105\110\103\068\111\119\110"or pose=="\083\101\097\116\101\100"or pose=="\080\108\097\116\102\111\114\109\083\116\097\110\100\105\110\103"then stopAllAnimations()H=.1 q=1 k=true end local O=Character:FindFirstChildOfClass("\084\111\111\108")if O and O:FindFirstChild("\072\097\110\100\108\101")then local Q=getToolAnim(O)if Q then toolAnim=Q.Value Q.Parent=nil toolAnimTime=x+.3 end if x>toolAnimTime then toolAnimTime=0 toolAnim="\078\111\110\101"end animateTool()else stopToolAnimations()toolAnim="\078\111\110\101"toolAnimInstance=nil toolAnimTime=0 end end
-------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------

function onSwimming(speed)
	if userAnimateScaleRun then
		speed /= getHeightScale()
	end
	if speed > 1.00 then
		local scale = 10.0
		playAnimation("swim", 0.4, Humanoid)
		setAnimationSpeed(speed / scale)
		pose = "Swimming"
	else
		playAnimation("swimidle", 0.4, Humanoid)
		pose = "Standing"
	end
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

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

local lastTick = 0

function stepAnimate(currentTime)
	local amplitude = 1
	local frequency = 1
	local deltaTime = currentTime - lastTick
	lastTick = currentTime

	local climbFudge = 0
	local setAngles = false

	if jumpAnimTime > 0 then
		jumpAnimTime = jumpAnimTime - deltaTime
	end

	if pose == "FreeFall" and jumpAnimTime <= 0 then
		playAnimation("fall", fallTransitionTime, Humanoid)
	elseif pose == "Seated" then
		playAnimation("sit", 0.5, Humanoid)
		return
	elseif pose == "Running" then
		playAnimation("walk", 0.2, Humanoid)
		updateVelocity(currentTime)
	elseif
		pose == "Dead"
		or pose == "GettingUp"
		or pose == "FallingDown"
		or pose == "Seated"
		or pose == "PlatformStanding"
	then
		stopAllAnimations()
		amplitude = 0.1
		frequency = 1
		setAngles = true
	end

	-- Tool Animation handling
	local tool = Character:FindFirstChildOfClass("Tool")
	if tool and tool:FindFirstChild("Handle") then
		local animStringValueObject = getToolAnim(tool)

		if animStringValueObject then
			toolAnim = animStringValueObject.Value
			-- message recieved, delete StringValue
			animStringValueObject.Parent = nil
			toolAnimTime = currentTime + 0.3
		end

		if currentTime > toolAnimTime then
			toolAnimTime = 0
			toolAnim = "None"
		end

		animateTool()
	else
		stopToolAnimations()
		toolAnim = "None"
		toolAnimInstance = nil
		toolAnimTime = 0
	end
end
