function stopLoopedSounds()sRunning:Stop()sClimbing:Stop()sSwimming:Stop()end if hasPlayer==nil then Humanoid.Died:connect(onDied)Humanoid.Running:connect(onRunning)Humanoid.Swimming:connect(onSwimming)Humanoid.Climbing:connect(onClimbing)Humanoid.Jumping:connect(function(Z)onStateNoStop(Z,sJumping)prevState="\074\117\109\112"end)Humanoid.GettingUp:connect(function(Z)stopLoopedSounds()onStateNoStop(Z,sGettingUp)prevState="\071\101\116\085\112"end)Humanoid.FreeFalling:connect(function(Z)stopLoopedSounds()onStateFall(Z,sFreeFalling)prevState="\070\114\101\101\070\097\108\108"end)Humanoid.FallingDown:connect(function(Z)stopLoopedSounds()end)Humanoid.StateChanged:connect(function(Z,q)if not(q.Name=="\068\101\097\100"or q.Name=="\082\117\110\110\105\110\103"or q.Name=="\082\117\110\110\105\110\103\078\111\080\104\121\115\105\099\115"or q.Name=="\083\119\105\109\109\105\110\103"or q.Name=="\074\117\109\112\105\110\103"or q.Name=="\071\101\116\116\105\110\103\085\112"or q.Name=="\070\114\101\101\102\097\108\108"or q.Name=="\070\097\108\108\105\110\103\068\111\119\110")then stopLoopedSounds()end end)end
-- connect up

function stopLoopedSounds()
	sRunning:Stop()
	sClimbing:Stop()
	sSwimming:Stop()
end

if hasPlayer == nil then
	Humanoid.Died:connect(onDied)
	Humanoid.Running:connect(onRunning)
	Humanoid.Swimming:connect(onSwimming)
	Humanoid.Climbing:connect(onClimbing)
	Humanoid.Jumping:connect(function(state)
		onStateNoStop(state, sJumping)
		prevState = "Jump"
	end)
	Humanoid.GettingUp:connect(function(state)
		stopLoopedSounds()
		onStateNoStop(state, sGettingUp)
		prevState = "GetUp"
	end)
	Humanoid.FreeFalling:connect(function(state)
		stopLoopedSounds()
		onStateFall(state, sFreeFalling)
		prevState = "FreeFall"
	end)
	Humanoid.FallingDown:connect(function(state)
		stopLoopedSounds()
	end)
	Humanoid.StateChanged:connect(function(old, new)
		if
			not (
				new.Name == "Dead"
				or new.Name == "Running"
				or new.Name == "RunningNoPhysics"
				or new.Name == "Swimming"
				or new.Name == "Jumping"
				or new.Name == "GettingUp"
				or new.Name == "Freefall"
				or new.Name == "FallingDown"
			)
		then
			stopLoopedSounds()
		end
	end)
end
