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 Y,i in pairs(script.Parent:GetChildren())do if i.ClassName=="\083\111\117\110\100"then i.Playing=false end end end function MakeSound()for Y,i in pairs(script.Parent:GetChildren())do if i.ClassName=="\083\111\117\110\100"then if i.Name~=script.Parent.CurrentMaterial.Value then i.Playing=false else if script.Parent.CurrentMaterial.Value=="\065\105\114"and ToggleAirSound==true then i.Playing=true i.PlaybackSpeed=Humanoid.WalkSpeed/12 else if i.Name~="\065\105\114"then i.Playing=true i.PlaybackSpeed=Humanoid.WalkSpeed/12 end end end end end end function MakeDefaultSound()for Y,i in pairs(script.Parent:GetChildren())do if i.ClassName=="\083\111\117\110\100"then if i.Name~=DefaultSound then i.Playing=false else i.Playing=true i.PlaybackSpeed=Humanoid.WalkSpeed/12 end end end end while wait(.1)do local Y=Humanoid.MoveDirection~=Vector3.new(0,0,0)if Y 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 / 12
				else
					if v.Name ~= "Air" then
						v.Playing = true
						v.PlaybackSpeed = Humanoid.WalkSpeed / 12
					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 / 12
			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
