Humanoid.Changed:Connect(function()if Enum.Material[Humanoid.FloorMaterial.Name]then script.Parent.CurrentMaterial.Value=Humanoid.FloorMaterial.Name else script.Parent.CurrentMaterial.Value=DefaultSound end end)function TurnOffSounds()for A,n in pairs(script.Parent:GetChildren())do if n.ClassName=="\083\111\117\110\100"then n.Playing=false end end end function MakeSound()for A,n in pairs(script.Parent:GetChildren())do if n.ClassName=="\083\111\117\110\100"then if n.Name~=script.Parent.CurrentMaterial.Value then n.Playing=false else if script.Parent.CurrentMaterial.Value=="\065\105\114"and ToggleAirSound==true then n.Playing=true n.PlaybackSpeed=Humanoid.WalkSpeed/18 else if n.Name~="\065\105\114"then n.Playing=true n.PlaybackSpeed=Humanoid.WalkSpeed/18 end end end end end end function MakeDefaultSound()for A,n in pairs(script.Parent:GetChildren())do if n.ClassName=="\083\111\117\110\100"then if n.Name~=DefaultSound then n.Playing=false else n.Playing=true n.PlaybackSpeed=Humanoid.WalkSpeed/18 end end end end while wait(.1)do local A=Humanoid.MoveDirection~=Vector3.new(0,0,0)if A then if script.Parent:FindFirstChild(script.Parent.CurrentMaterial.Value)and script.Parent.CurrentMaterial.Value~=nil then MakeSound()else MakeDefaultSound()end else TurnOffSounds()end end


Humanoid.Changed:Connect(function()
if Enum.Material[Humanoid.FloorMaterial.Name] then
script.Parent.CurrentMaterial.Value = Humanoid.FloorMaterial.Name
else
script.Parent.CurrentMaterial.Value = DefaultSound
end
end)

function TurnOffSounds()
for i,v in pairs(script.Parent:GetChildren()) do
if v.ClassName == "Sound" then
v.Playing = false	
end	
end		
end

function MakeSound()
for i,v in pairs(script.Parent:GetChildren()) do
if v.ClassName == "Sound" then
if v.Name ~= script.Parent.CurrentMaterial.Value then
v.Playing = false	
else
if script.Parent.CurrentMaterial.Value  == 'Air' and ToggleAirSound == true then	
v.Playing = true	
v.PlaybackSpeed = Humanoid.WalkSpeed / 18
else
if v.Name ~= 'Air' then
v.Playing = true	
v.PlaybackSpeed = Humanoid.WalkSpeed / 18
end	
end
end		
end
end
end

function MakeDefaultSound()
for i,v in pairs(script.Parent:GetChildren()) do
if v.ClassName == "Sound" then
if v.Name ~= DefaultSound then
v.Playing = false	
else
v.Playing = true	
v.PlaybackSpeed = Humanoid.WalkSpeed / 18
end			
end
end
end

while wait(1/10) do
local Moving = Humanoid.MoveDirection ~= Vector3.new(0,0,0)
if Moving then
if script.Parent:FindFirstChild(script.Parent.CurrentMaterial.Value) and script.Parent.CurrentMaterial.Value ~= nil then	
MakeSound()
else	
MakeDefaultSound()	
end		
else		
TurnOffSounds()	
end	
end
