local c={Died=0,Running=1;Swimming=2,Climbing=3;Jumping=4,GettingUp=5,FreeFalling=6,FallingDown=7;Landing=8,Splash=9}local T=nil local m={}local B=game:GetService("\082\101\112\108\105\099\097\116\101\100\083\116\111\114\097\103\101")local u=B:FindFirstChild("\068\101\102\097\117\108\116\083\111\117\110\100\069\118\101\110\116\115")local G=(UserSettings()):IsUserFeatureEnabled("\085\115\101\114\085\115\101\083\111\117\110\100\068\105\115\112\097\116\099\104\101\114")if G then if not u then u=Instance.new("\070\111\108\100\101\114",B)u.Name="\068\101\102\097\117\108\116\083\111\117\110\100\069\118\101\110\116\115"u.Archivable=false end local c=u:FindFirstChild("\082\101\109\111\118\101\067\104\097\114\097\099\116\101\114\069\118\101\110\116")if c==nil then c=Instance.new("\082\101\109\111\116\101\069\118\101\110\116",u)c.Name="\082\101\109\111\118\101\067\104\097\114\097\099\116\101\114\069\118\101\110\116"end local T=u:FindFirstChild("\065\100\100\067\104\097\114\097\099\116\101\114\076\111\097\100\101\100\069\118\101\110\116")if T==nil then T=Instance.new("\082\101\109\111\116\101\069\118\101\110\116",u)T.Name="\065\100\100\067\104\097\114\097\099\116\101\114\076\111\097\100\101\100\069\118\101\110\116"end T:FireServer()game.Players.LocalPlayer.CharacterRemoving:connect(function(T)c:FireServer(game.Players.LocalPlayer)end)end local Y=script.Parent.Parent local l=Y:WaitForChild("\072\101\097\100")while not T do for c,m in pairs(Y:GetChildren())do if m:IsA("\072\117\109\097\110\111\105\100")then T=m break end end if T then break end Y.ChildAdded:wait()end m[c.Died]=l:WaitForChild("\068\105\101\100")m[c.Running]=l:WaitForChild("\082\117\110\110\105\110\103")m[c.Swimming]=l:WaitForChild("\083\119\105\109\109\105\110\103")m[c.Climbing]=l:WaitForChild("\067\108\105\109\098\105\110\103")m[c.Jumping]=l:WaitForChild("\074\117\109\112\105\110\103")m[c.GettingUp]=l:WaitForChild("\071\101\116\116\105\110\103\085\112")m[c.FreeFalling]=l:WaitForChild("\070\114\101\101\070\097\108\108\105\110\103")m[c.Landing]=l:WaitForChild("\076\097\110\100\105\110\103")m[c.Splash]=l:WaitForChild("\083\112\108\097\115\104")if G then local c=u:FindFirstChild("\068\101\102\097\117\108\116\083\101\114\118\101\114\083\111\117\110\100\069\118\101\110\116")else v13=(game:GetService("\082\101\112\108\105\099\097\116\101\100\083\116\111\114\097\103\101")):FindFirstChild("\068\101\102\097\117\108\116\083\101\114\118\101\114\083\111\117\110\100\069\118\101\110\116")end if v13 then v13.OnClientEvent:connect(function(c,T,m)if m and c.TimePosition~=0 then c.TimePosition=0 end if c.IsPlaying~=T then c.Playing=T end end)end local q=game:GetService("\083\111\117\110\100\083\101\114\118\105\099\101")local y={YForLineGivenXAndTwoPts=function(c,T,m,B,u)local G=(m-u)/(T-B)return G*c+(m-G*T)end,Clamp=function(c,T,m)return math.min(m,math.max(T,c))end;HorizontalSpeed=function(c)return(c.Velocity+Vector3.new(0,-c.Velocity.Y,0)).magnitude end;VerticalSpeed=function(c)return math.abs(c.Velocity.Y)end}local function C()return game.Workspace.FilteringEnabled and q.RespectFilteringEnabled end function y.Play(c)if C()then c.CharacterSoundEvent:FireServer(true,true)end if c.TimePosition~=0 then c.TimePosition=0 end if not c.IsPlaying then c.Playing=true end end function y.Pause(c)if C()then c.CharacterSoundEvent:FireServer(false,false)end if c.IsPlaying then c.Playing=false end end function y.Resume(c)if C()then c.CharacterSoundEvent:FireServer(true,false)end if not c.IsPlaying then c.Playing=true end end function y.Stop(c)if C()then c.CharacterSoundEvent:FireServer(false,true)end if c.IsPlaying then c.Playing=false end if c.TimePosition~=0 then c.TimePosition=0 end end local Z={}function setSoundInPlayingLoopedSounds(c)local T=#Z local m=0 while true do if Z[m]==c then return end if true then if m<T then else break end elseif T<m then else break end m=m+1 end table.insert(Z,c)end function stopPlayingLoopedSoundsExcept(c)local T=#Z-(-1)while true do if Z[T]~=c then y.Pause(Z[T])table.remove(Z,T)end if false then if T<1 then else break end elseif 1<T then else break end T=T+-1 end end local s={}s[Enum.HumanoidStateType.Dead]=function()stopPlayingLoopedSoundsExcept()y.Play(m[c.Died])end s[Enum.HumanoidStateType.RunningNoPhysics]=function(c)stateUpdated(Enum.HumanoidStateType.Running,c)end local b=(UserSettings()):IsUserFeatureEnabled("\085\115\101\114\070\105\120\067\104\097\114\097\099\116\101\114\083\111\117\110\100\073\115\115\117\101\115")local g=nil local n=0 s[Enum.HumanoidStateType.Running]=function(T)local B=m[c.Running]stopPlayingLoopedSoundsExcept(B)if b and(g==Enum.HumanoidStateType.Freefall and n>.1)then local T=m[c.FreeFalling]T.Volume=math.min(1,math.max(0,(n-50)/110))y.Play(T)n=0 end if b then if T~=nil and T>.5 then y.Resume(B)setSoundInPlayingLoopedSounds(B)return elseif T~=nil then stopPlayingLoopedSoundsExcept()return else return end elseif not(y.HorizontalSpeed(l)>.5)then stopPlayingLoopedSoundsExcept()return end y.Resume(B)setSoundInPlayingLoopedSounds(B)end s[Enum.HumanoidStateType.Swimming]=function(T)if b then local c=T else v22=y.VerticalSpeed(l)end if g~=Enum.HumanoidStateType.Swimming and v22>.1 then local T=m[c.Splash]T.Volume=y.Clamp(y.YForLineGivenXAndTwoPts(y.VerticalSpeed(l),100,.28,350,1),0,1)y.Play(T)end local B=m[c.Swimming]stopPlayingLoopedSoundsExcept(B)y.Resume(B)setSoundInPlayingLoopedSounds(B)end s[Enum.HumanoidStateType.Climbing]=function(T)local B=m[c.Climbing]if b then if T~=nil and math.abs(T)>.1 then y.Resume(B)stopPlayingLoopedSoundsExcept(B)else y.Pause(B)stopPlayingLoopedSoundsExcept(B)end elseif y.VerticalSpeed(l)>.1 then y.Resume(B)stopPlayingLoopedSoundsExcept(B)else stopPlayingLoopedSoundsExcept()end setSoundInPlayingLoopedSounds(B)end s[Enum.HumanoidStateType.Jumping]=function()if g==Enum.HumanoidStateType.Jumping then return end stopPlayingLoopedSoundsExcept()y.Play(m[c.Jumping])end s[Enum.HumanoidStateType.GettingUp]=function()stopPlayingLoopedSoundsExcept()y.Play(m[c.GettingUp])end s[Enum.HumanoidStateType.Freefall]=function()if g==Enum.HumanoidStateType.Freefall then return end m[c.FreeFalling].Volume=0 stopPlayingLoopedSoundsExcept()n=math.max(n,math.abs(l.Velocity.y))end s[Enum.HumanoidStateType.FallingDown]=function()stopPlayingLoopedSoundsExcept()end s[Enum.HumanoidStateType.Landed]=function()stopPlayingLoopedSoundsExcept()if y.VerticalSpeed(l)>75 then local T=m[c.Landing]T.Volume=y.Clamp(y.YForLineGivenXAndTwoPts(y.VerticalSpeed(l),50,0,100,1),0,1)y.Play(T)end end s[Enum.HumanoidStateType.Seated]=function()stopPlayingLoopedSoundsExcept()end function stateUpdated(c,T)if s[c]~=nil then if b then if c~=Enum.HumanoidStateType.Running then if c~=Enum.HumanoidStateType.Climbing then if c~=Enum.HumanoidStateType.Swimming then if c==Enum.HumanoidStateType.RunningNoPhysics then s[c](T)else s[c]()end else s[c](T)end else s[c](T)end else s[c](T)end else s[c]()end end g=c end T.Died:connect(function()stateUpdated(Enum.HumanoidStateType.Dead)end)T.Running:connect(function(c)stateUpdated(Enum.HumanoidStateType.Running,c)end)T.Swimming:connect(function(c)stateUpdated(Enum.HumanoidStateType.Swimming,c)end)T.Climbing:connect(function(c)stateUpdated(Enum.HumanoidStateType.Climbing,c)end)T.Jumping:connect(function()stateUpdated(Enum.HumanoidStateType.Jumping)end)T.GettingUp:connect(function()stateUpdated(Enum.HumanoidStateType.GettingUp)end)T.FreeFalling:connect(function()stateUpdated(Enum.HumanoidStateType.Freefall)end)T.FallingDown:connect(function()stateUpdated(Enum.HumanoidStateType.FallingDown)end)T.StateChanged:connect(function(c,T)stateUpdated(T)end)function onUpdate(T,B)local u=m[c.FreeFalling]if g==Enum.HumanoidStateType.Freefall then if l.Velocity.Y<0 then if 75<y.VerticalSpeed(l)then y.Resume(u)u.Volume=y.Clamp(u.Volume+(B/1.1)*(T/B),0,1)else u.Volume=0 end else u.Volume=0 end else y.Pause(u)end if g==Enum.HumanoidStateType.Running then if y.HorizontalSpeed(l)<.5 then y.Pause(m[c.Running])end end end local d=tick()while true do onUpdate(tick()-d,.25)d=tick()wait(.25)end


local v1 = {
	Died = 0, 
	Running = 1, 
	Swimming = 2, 
	Climbing = 3, 
	Jumping = 4, 
	GettingUp = 5, 
	FreeFalling = 6, 
	FallingDown = 7, 
	Landing = 8, 
	Splash = 9
};
local v2 = nil;
local v3 = {};
local l__ReplicatedStorage__4 = game:GetService("ReplicatedStorage");
local v5 = l__ReplicatedStorage__4:FindFirstChild("DefaultSoundEvents");
local v6 = UserSettings():IsUserFeatureEnabled("UserUseSoundDispatcher");
if v6 then
	if not v5 then
		v5 = Instance.new("Folder", l__ReplicatedStorage__4);
		v5.Name = "DefaultSoundEvents";
		v5.Archivable = false;
	end;
	local v7 = v5:FindFirstChild("RemoveCharacterEvent");
	if v7 == nil then
		v7 = Instance.new("RemoteEvent", v5);
		v7.Name = "RemoveCharacterEvent";
	end;
	local v8 = v5:FindFirstChild("AddCharacterLoadedEvent");
	if v8 == nil then
		v8 = Instance.new("RemoteEvent", v5);
		v8.Name = "AddCharacterLoadedEvent";
	end;
	v8:FireServer();
	game.Players.LocalPlayer.CharacterRemoving:connect(function(p1)
		v7:FireServer(game.Players.LocalPlayer);
	end);
end;
local l__Parent__9 = script.Parent.Parent;
local l__Head__10 = l__Parent__9:WaitForChild("Head");
while not v2 do
	for v11, v12 in pairs(l__Parent__9:GetChildren()) do
		if v12:IsA("Humanoid") then
			v2 = v12;
			break;
		end;
	end;
	if v2 then
		break;
	end;
	l__Parent__9.ChildAdded:wait();
end;
v3[v1.Died] = l__Head__10:WaitForChild("Died");
v3[v1.Running] = l__Head__10:WaitForChild("Running");
v3[v1.Swimming] = l__Head__10:WaitForChild("Swimming");
v3[v1.Climbing] = l__Head__10:WaitForChild("Climbing");
v3[v1.Jumping] = l__Head__10:WaitForChild("Jumping");
v3[v1.GettingUp] = l__Head__10:WaitForChild("GettingUp");
v3[v1.FreeFalling] = l__Head__10:WaitForChild("FreeFalling");
v3[v1.Landing] = l__Head__10:WaitForChild("Landing");
v3[v1.Splash] = l__Head__10:WaitForChild("Splash");
if v6 then
	local v13 = v5:FindFirstChild("DefaultServerSoundEvent");
else
	v13 = game:GetService("ReplicatedStorage"):FindFirstChild("DefaultServerSoundEvent");
end;
if v13 then
	v13.OnClientEvent:connect(function(p2, p3, p4)
		if p4 and p2.TimePosition ~= 0 then
			p2.TimePosition = 0;
		end;
		if p2.IsPlaying ~= p3 then
			p2.Playing = p3;
		end;
	end);
end;
local l__SoundService__1 = game:GetService("SoundService");
local v14 = {
	YForLineGivenXAndTwoPts = function(p5, p6, p7, p8, p9)
		local v15 = (p7 - p9) / (p6 - p8);
		return v15 * p5 + (p7 - v15 * p6);
	end, 
	Clamp = function(p10, p11, p12)
		return math.min(p12, math.max(p11, p10));
	end, 
	HorizontalSpeed = function(p13)
		return (p13.Velocity + Vector3.new(0, -p13.Velocity.Y, 0)).magnitude;
	end, 
	VerticalSpeed = function(p14)
		return math.abs(p14.Velocity.Y);
	end
};
local function u2()
	return game.Workspace.FilteringEnabled and l__SoundService__1.RespectFilteringEnabled;
end;
function v14.Play(p15)
	if u2() then
		p15.CharacterSoundEvent:FireServer(true, true);
	end;
	if p15.TimePosition ~= 0 then
		p15.TimePosition = 0;
	end;
	if not p15.IsPlaying then
		p15.Playing = true;
	end;
end;
function v14.Pause(p16)
	if u2() then
		p16.CharacterSoundEvent:FireServer(false, false);
	end;
	if p16.IsPlaying then
		p16.Playing = false;
	end;
end;
function v14.Resume(p17)
	if u2() then
		p17.CharacterSoundEvent:FireServer(true, false);
	end;
	if not p17.IsPlaying then
		p17.Playing = true;
	end;
end;
function v14.Stop(p18)
	if u2() then
		p18.CharacterSoundEvent:FireServer(false, true);
	end;
	if p18.IsPlaying then
		p18.Playing = false;
	end;
	if p18.TimePosition ~= 0 then
		p18.TimePosition = 0;
	end;
end;
local u3 = {};
function setSoundInPlayingLoopedSounds(p19)
	local v16 = #u3;
	local v17 = 1 - 1;
	while true do
		if u3[v17] == p19 then
			return;
		end;
		if 0 <= 1 then
			if v17 < v16 then

			else
				break;
			end;
		elseif v16 < v17 then

		else
			break;
		end;
		v17 = v17 + 1;	
	end;
	table.insert(u3, p19);
end;
function stopPlayingLoopedSoundsExcept(p20)
	local v18 = #u3 - -1;
	while true do
		if u3[v18] ~= p20 then
			v14.Pause(u3[v18]);
			table.remove(u3, v18);
		end;
		if 0 <= -1 then
			if v18 < 1 then

			else
				break;
			end;
		elseif 1 < v18 then

		else
			break;
		end;
		v18 = v18 + -1;	
	end;
end;
local v19 = {};
v19[Enum.HumanoidStateType.Dead] = function()
	stopPlayingLoopedSoundsExcept();
	v14.Play(v3[v1.Died]);
end;
v19[Enum.HumanoidStateType.RunningNoPhysics] = function(p21)
	stateUpdated(Enum.HumanoidStateType.Running, p21);
end;
local u4 = UserSettings():IsUserFeatureEnabled("UserFixCharacterSoundIssues");
local u5 = nil;
local u6 = 0;
v19[Enum.HumanoidStateType.Running] = function(p22)
	local v20 = v3[v1.Running];
	stopPlayingLoopedSoundsExcept(v20);
	if u4 and u5 == Enum.HumanoidStateType.Freefall and u6 > 0.1 then
		local v21 = v3[v1.FreeFalling];
		v21.Volume = math.min(1, math.max(0, (u6 - 50) / 110));
		v14.Play(v21);
		u6 = 0;
	end;
	if u4 then
		if p22 ~= nil and p22 > 0.5 then
			v14.Resume(v20);
			setSoundInPlayingLoopedSounds(v20);
			return;
		elseif p22 ~= nil then
			stopPlayingLoopedSoundsExcept();
			return;
		else
			return;
		end;
	elseif not (v14.HorizontalSpeed(l__Head__10) > 0.5) then
		stopPlayingLoopedSoundsExcept();
		return;
	end;
	v14.Resume(v20);
	setSoundInPlayingLoopedSounds(v20);
end;
v19[Enum.HumanoidStateType.Swimming] = function(p23)
	if u4 then
		local v22 = p23;
	else
		v22 = v14.VerticalSpeed(l__Head__10);
	end;
	if u5 ~= Enum.HumanoidStateType.Swimming and v22 > 0.1 then
		local v23 = v3[v1.Splash];
		v23.Volume = v14.Clamp(v14.YForLineGivenXAndTwoPts(v14.VerticalSpeed(l__Head__10), 100, 0.28, 350, 1), 0, 1);
		v14.Play(v23);
	end;
	local v24 = v3[v1.Swimming];
	stopPlayingLoopedSoundsExcept(v24);
	v14.Resume(v24);
	setSoundInPlayingLoopedSounds(v24);
end;
v19[Enum.HumanoidStateType.Climbing] = function(p24)
	local v25 = v3[v1.Climbing];
	if u4 then
		if p24 ~= nil and math.abs(p24) > 0.1 then
			v14.Resume(v25);
			stopPlayingLoopedSoundsExcept(v25);
		else
			v14.Pause(v25);
			stopPlayingLoopedSoundsExcept(v25);
		end;
	elseif v14.VerticalSpeed(l__Head__10) > 0.1 then
		v14.Resume(v25);
		stopPlayingLoopedSoundsExcept(v25);
	else
		stopPlayingLoopedSoundsExcept();
	end;
	setSoundInPlayingLoopedSounds(v25);
end;
v19[Enum.HumanoidStateType.Jumping] = function()
	if u5 == Enum.HumanoidStateType.Jumping then
		return;
	end;
	stopPlayingLoopedSoundsExcept();
	v14.Play(v3[v1.Jumping]);
end;
v19[Enum.HumanoidStateType.GettingUp] = function()
	stopPlayingLoopedSoundsExcept();
	v14.Play(v3[v1.GettingUp]);
end;
v19[Enum.HumanoidStateType.Freefall] = function()
	if u5 == Enum.HumanoidStateType.Freefall then
		return;
	end;
	v3[v1.FreeFalling].Volume = 0;
	stopPlayingLoopedSoundsExcept();
	u6 = math.max(u6, math.abs(l__Head__10.Velocity.y));
end;
v19[Enum.HumanoidStateType.FallingDown] = function()
	stopPlayingLoopedSoundsExcept();
end;
v19[Enum.HumanoidStateType.Landed] = function()
	stopPlayingLoopedSoundsExcept();
	if v14.VerticalSpeed(l__Head__10) > 75 then
		local v26 = v3[v1.Landing];
		v26.Volume = v14.Clamp(v14.YForLineGivenXAndTwoPts(v14.VerticalSpeed(l__Head__10), 50, 0, 100, 1), 0, 1);
		v14.Play(v26);
	end;
end;
v19[Enum.HumanoidStateType.Seated] = function()
	stopPlayingLoopedSoundsExcept();
end;
function stateUpdated(p25, p26)
	if v19[p25] ~= nil then
		if u4 then
			if p25 ~= Enum.HumanoidStateType.Running then
				if p25 ~= Enum.HumanoidStateType.Climbing then
					if p25 ~= Enum.HumanoidStateType.Swimming then
						if p25 == Enum.HumanoidStateType.RunningNoPhysics then
							v19[p25](p26);
						else
							v19[p25]();
						end;
					else
						v19[p25](p26);
					end;
				else
					v19[p25](p26);
				end;
			else
				v19[p25](p26);
			end;
		else
			v19[p25]();
		end;
	end;
	u5 = p25;
end;
v2.Died:connect(function()
	stateUpdated(Enum.HumanoidStateType.Dead);
end);
v2.Running:connect(function(p27)
	stateUpdated(Enum.HumanoidStateType.Running, p27);
end);
v2.Swimming:connect(function(p28)
	stateUpdated(Enum.HumanoidStateType.Swimming, p28);
end);
v2.Climbing:connect(function(p29)
	stateUpdated(Enum.HumanoidStateType.Climbing, p29);
end);
v2.Jumping:connect(function()
	stateUpdated(Enum.HumanoidStateType.Jumping);
end);
v2.GettingUp:connect(function()
	stateUpdated(Enum.HumanoidStateType.GettingUp);
end);
v2.FreeFalling:connect(function()
	stateUpdated(Enum.HumanoidStateType.Freefall);
end);
v2.FallingDown:connect(function()
	stateUpdated(Enum.HumanoidStateType.FallingDown);
end);
v2.StateChanged:connect(function(p30, p31)
	stateUpdated(p31);
end);
function onUpdate(p32, p33)
	local v27 = v3[v1.FreeFalling];
	if u5 == Enum.HumanoidStateType.Freefall then
		if l__Head__10.Velocity.Y < 0 then
			if 75 < v14.VerticalSpeed(l__Head__10) then
				v14.Resume(v27);
				v27.Volume = v14.Clamp(v27.Volume + p33 / 1.1 * (p32 / p33), 0, 1);
			else
				v27.Volume = 0;
			end;
		else
			v27.Volume = 0;
		end;
	else
		v14.Pause(v27);
	end;
	if u5 == Enum.HumanoidStateType.Running then
		if v14.HorizontalSpeed(l__Head__10) < 0.5 then
			v14.Pause(v3[v1.Running]);
		end;
	end;
end;
local v28 = tick();
while true do
	onUpdate(tick() - v28, 0.25);
	v28 = tick();
	wait(0.25);
end;
