function onFall(H)spawn(function()local i=math.max(math.min(H/Humanoid.JumpPower,1),0)local X=jumpAnim.Pos local u=jumpAnim.Rot local E=(.04*S.fallSettings.fallMultiplier)*i local B=(RAD(4)*S.fallSettings.fallMultiplier)*i local Y=tick()while true do RS.Heartbeat:wait()local H=math.min((tick()-Y)/.15,1)*90 if onGround then break end jumpAnim.Pos=numLerp(X,E,Sine(H))jumpAnim.Rot=numLerp(u,B,Sine(H))if H==90 then break end end X=E u=B E=-0.08*S.fallSettings.fallMultiplier B=-RAD(8)*S.fallSettings.fallMultiplier local N=1 while true do local H=RS.Heartbeat:wait()N=N+(H*60)/N local i=(N-1)/15 if onGround then break end jumpAnim.Pos=numLerp(X,E,i)jumpAnim.Rot=numLerp(u,B,i)end end)end function onLand(H)spawn(function()local i=math.min(H,S.fallSettings.maxDist)*.66666666666667 local X=jumpAnim.Pos local u=jumpAnim.Rot local E=((i/100)*S.fallSettings.landMultiplier)*(runReady and 1 or 2)local B=(RAD(i)*S.fallSettings.landMultiplier)*(runReady and 1 or 2)local Y=tick()while true do RS.Heartbeat:wait()local H=math.min((tick()-Y)/.2,1)if not onGround then break end jumpAnim.Pos=numLerp(X,E,H)jumpAnim.Rot=numLerp(u,B,H)if H==1 then break end end Y=tick()while true do RS.Heartbeat:wait()local H=math.min((tick()-Y)/.3,1)*90 if not onGround then break end jumpAnim.Pos=numLerp(E,0,Sine(H))jumpAnim.Rot=numLerp(B,0,Sine(H))if H==90 then break end end end)end function onHumanoidStateChanged(H,i)if i==Enum.HumanoidStateType.Freefall then onGround=false if S.fallAnimation then onFall(HRP.Velocity.Y)while HRP.Velocity.Y>0 do RS.RenderStepped:wait()end startFallHeight=HRP.Position.Y end elseif H==Enum.HumanoidStateType.Freefall then onGround=true if S.fallAnimation then local H=startFallHeight-HRP.Position.Y onLand(H)end end end
--------------------[ JUMPING ANIMATION ]---------------------------------------------

function onFall(initialVelocity)
	spawn(function()
		local velocityAlpha = math.max(math.min(initialVelocity / Humanoid.JumpPower, 1), 0)
		local startJumpPos = jumpAnim.Pos
		local startJumpRot = jumpAnim.Rot
		local endJumpPos = 0.04 * S.fallSettings.fallMultiplier * velocityAlpha
		local endJumpRot = RAD(4) * S.fallSettings.fallMultiplier * velocityAlpha
		local t0 = tick()
		while true do
			RS.Heartbeat:wait()
			local Alpha = math.min((tick() - t0) / 0.15, 1) * 90
			if onGround then
				break
			end
			jumpAnim.Pos = numLerp(startJumpPos, endJumpPos, Sine(Alpha))
			jumpAnim.Rot = numLerp(startJumpRot, endJumpRot, Sine(Alpha))
			if Alpha == 90 then
				break
			end
		end
		startJumpPos = endJumpPos
		startJumpRot = endJumpRot
		endJumpPos = -0.08 * S.fallSettings.fallMultiplier
		endJumpRot = -RAD(8) * S.fallSettings.fallMultiplier
		local X = 1
		while true do
			local dt = RS.Heartbeat:wait()
			X = X + (dt * 60) / X
			local Alpha = (X - 1) / 15
			if onGround then
				break
			end
			jumpAnim.Pos = numLerp(startJumpPos, endJumpPos, Alpha)
			jumpAnim.Rot = numLerp(startJumpRot, endJumpRot, Alpha)
		end
	end)
end

function onLand(fallDist)
	spawn(function()
		local animAlpha = math.min(fallDist, S.fallSettings.maxDist) * (2 / 3)
		local startJumpPos = jumpAnim.Pos
		local startJumpRot = jumpAnim.Rot
		local endJumpPos = animAlpha / 100 * S.fallSettings.landMultiplier * (runReady and 1 or 2)
		local endJumpRot = RAD(animAlpha) * S.fallSettings.landMultiplier * (runReady and 1 or 2)
		local t0 = tick()
		while true do
			RS.Heartbeat:wait()
			local Alpha = math.min((tick() - t0) / 0.2, 1)
			if not onGround then
				break
			end
			jumpAnim.Pos = numLerp(startJumpPos, endJumpPos, Alpha)
			jumpAnim.Rot = numLerp(startJumpRot, endJumpRot, Alpha)
			if Alpha == 1 then
				break
			end
		end
		t0 = tick()
		while true do
			RS.Heartbeat:wait()
			local Alpha = math.min((tick() - t0) / 0.3, 1) * 90
			if not onGround then
				break
			end
			jumpAnim.Pos = numLerp(endJumpPos, 0, Sine(Alpha))
			jumpAnim.Rot = numLerp(endJumpRot, 0, Sine(Alpha))
			if Alpha == 90 then
				break
			end
		end
	end)
end

function onHumanoidStateChanged(oldState, newState)
	if newState == Enum.HumanoidStateType.Freefall then
		onGround = false
		if S.fallAnimation then
			onFall(HRP.Velocity.Y)
			while HRP.Velocity.Y > 0 do
				RS.RenderStepped:wait()
			end
			startFallHeight = HRP.Position.Y
		end
	elseif oldState == Enum.HumanoidStateType.Freefall then
		onGround = true
		if S.fallAnimation then
			local fallDist = startFallHeight - HRP.Position.Y
			onLand(fallDist)
		end
	end
end
