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)
