I am trying to enable walking sound when I am not flying. I have a flying script and whenever I fly I want the game to disable walking sound because in mid-air while flying I hear walking sound. How can I enable walking sound while I am not flying and disable while I am flying?
local wDown = false local sDown = false local isFlying = false local speed = 10 local MAX_SPEED = 45 local MIN_SPEED = 0 spawn(function() while player.Character.Humanoid.Health > 0 do if isFlying then local r = 1+(speed/45) player.Character:SetPrimaryPartCFrame(CFrame.new(player.Character.PrimaryPart.Position,mouse.Hit.p)*CFrame.Angles(math.pi/r,math.pi,math.pi)) player.Character.Torso.FlyingVelocity.Velocity = (mouse.Hit.p - player.Character.Torso.Position).unit * speed if wDown then speed = speed + 5 if speed > MAX_SPEED then speed = MAX_SPEED end elseif sDown then speed = speed - 5 if speed < MIN_SPEED then speed = MIN_SPEED end end end game:GetService("RunService").RenderStepped:wait() end end)
I would not diable it as it may cause errors in other script instead I would set the volume to 0. All of the players sounds are current in the Head so you can simple set the volume of running to 0.
script.Parent:WaitForChild('Head'):WaitForChild('Running').Volume = 0 -- def value script.Parent:WaitForChild('Head'):WaitForChild('Running').Volume = 0.65
Hope this helps.