null nil false Sound false LocalSound 0.1) then local vol = math.min(1.0, math.max(0.0, (fallSpeed - 50) / 110)) sLanding.Volume = vol sLanding:Play() fallSpeed = 0 end if speed>0.5 then sRunning:Resume() sRunning.Pitch = speed / 8.0 else sRunning:Pause() end prevState = "Run" end function onSwimming(speed) if (prevState ~= "Swim" and speed > 0.1) then local volume = math.min(1.0, speed / 350) sSplash.Volume = volume sSplash:Play() prevState = "Swim" end sClimbing:Stop() sRunning:Stop() sSwimming.Pitch = 1.6 sSwimming:Resume() end function onClimbing(speed) sRunning:Stop() sSwimming:Stop() if speed>0.01 then sClimbing:Resume() sClimbing.Pitch = speed / 5.5 else sClimbing:Pause() end prevState = "Climb" end -- connect up function stopLoopedSounds() sRunning:Stop() sClimbing:Stop() sSwimming:Stop() end 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) ]]>