Custom Footstep Sounds not working

local materialSounds = {

	[Enum.Material.DiamondPlate] = game.ServerStorage.Sounds:WaitForChild("DiamondPlate").SoundId,
	[Enum.Material.Glass] =  game.ServerStorage.Sounds:WaitForChild("Glass").SoundId,
	[Enum.Material.Grass] =  game.ServerStorage.Sounds:WaitForChild("Grass").SoundId,
	[Enum.Material.Ice] =  game.ServerStorage.Sounds:WaitForChild("Ice").SoundId,
	[Enum.Material.Metal] =  game.ServerStorage.Sounds:WaitForChild("Metal").SoundId,
	[Enum.Material.Wood] =  game.ServerStorage.Sounds:WaitForChild("Wood").SoundId,
	[Enum.Material.SmoothPlastic] = game.ServerStorage.Sounds:WaitForChild("SmoothPlastic").SoundId,
	[Enum.Material.Sand] = game.ServerStorage.Sounds:WaitForChild("Sand").SoundId,
	[Enum.Material.Concrete] = game.ServerStorage.Sounds:WaitForChild("Concrete").SoundId,
	[Enum.Material.Granite] = game.ServerStorage.Sounds:WaitForChild("Granite").SoundId

}

game.Players.PlayerAdded:Connect(function (plr)
	plr.CharacterAdded:Connect(function (char)
		local hum = char:WaitForChild("Humanoid")
		local hrp = char:WaitForChild("HumanoidRootPart")
		local Running1 = game.ServerStorage.Sounds.SmoothPlastic:Clone()
		Running1.Parent = hrp
		hum.Running:Connect(function ()
			Running1.Playing = true
			Running1:Play()
			print("YO MAMA ES FAT")
		end)
		
		hum:GetPropertyChangedSignal("FloorMaterial"):Connect(function ()

			local floorMat = hum.FloorMaterial
			local floorSound = materialSounds[floorMat]
			print("Mat Changed")
			if floorSound then
				--soundE:FireServer(floorSound, materialSounds, true)
				Running1.SoundId = floorSound
			
			else
				--soundE:FireServer(footSounds, materialSounds, false)
				Running1.SoundId = materialSounds[Enum.Material.SmoothPlastic]
				
			end
		end)
	end)
	
end)
while wait() do
    print("YO MAMA ES FAT")
end

local materialSounds = {

	[Enum.Material.DiamondPlate] = game.ServerStorage.Sounds:WaitForChild("DiamondPlate").SoundId,
	[Enum.Material.Glass] =  game.ServerStorage.Sounds:WaitForChild("Glass").SoundId,
	[Enum.Material.Grass] =  game.ServerStorage.Sounds:WaitForChild("Grass").SoundId,
	[Enum.Material.Ice] =  game.ServerStorage.Sounds:WaitForChild("Ice").SoundId,
	[Enum.Material.Metal] =  game.ServerStorage.Sounds:WaitForChild("Metal").SoundId,
	[Enum.Material.Wood] =  game.ServerStorage.Sounds:WaitForChild("Wood").SoundId,
	[Enum.Material.SmoothPlastic] = game.ServerStorage.Sounds:WaitForChild("SmoothPlastic").SoundId,
	[Enum.Material.Sand] = game.ServerStorage.Sounds:WaitForChild("Sand").SoundId,
	[Enum.Material.Concrete] = game.ServerStorage.Sounds:WaitForChild("Concrete").SoundId,
	[Enum.Material.Granite] = game.ServerStorage.Sounds:WaitForChild("Granite").SoundId

}

game.Players.PlayerAdded:Connect(function (plr)
	plr.CharacterAdded:Connect(function (char)
		local hum = char:WaitForChild("Humanoid")
		local hrp = char:WaitForChild("HumanoidRootPart")
		local Running1 = game.ServerStorage.Sounds.SmoothPlastic:Clone()
		Running1.Parent = hrp
		hum.Running:Connect(function ()
			Running1.Playing = true
			Running1:Play()
			print("YO MAMA ES FAT")
		end)
		
		hum:GetPropertyChangedSignal("FloorMaterial"):Connect(function ()

			local floorMat = hum.FloorMaterial
			local floorSound = materialSounds[floorMat]
			print("Mat Changed")
			if floorSound then
				--soundE:FireServer(floorSound, materialSounds, true)
				Running1.SoundId = floorSound
			
			else
				--soundE:FireServer(footSounds, materialSounds, false)
				Running1.SoundId = materialSounds[Enum.Material.SmoothPlastic]
				
			end
		end)
	end)
	
end)

The while loop will break since it is not in spawn(function()

spawn(function()
   while wait() do
       print("YO MAMA ES FAT")
   end
end

local materialSounds = {

	[Enum.Material.DiamondPlate] = game.ServerStorage.Sounds:WaitForChild("DiamondPlate").SoundId,
	[Enum.Material.Glass] =  game.ServerStorage.Sounds:WaitForChild("Glass").SoundId,
	[Enum.Material.Grass] =  game.ServerStorage.Sounds:WaitForChild("Grass").SoundId,
	[Enum.Material.Ice] =  game.ServerStorage.Sounds:WaitForChild("Ice").SoundId,
	[Enum.Material.Metal] =  game.ServerStorage.Sounds:WaitForChild("Metal").SoundId,
	[Enum.Material.Wood] =  game.ServerStorage.Sounds:WaitForChild("Wood").SoundId,
	[Enum.Material.SmoothPlastic] = game.ServerStorage.Sounds:WaitForChild("SmoothPlastic").SoundId,
	[Enum.Material.Sand] = game.ServerStorage.Sounds:WaitForChild("Sand").SoundId,
	[Enum.Material.Concrete] = game.ServerStorage.Sounds:WaitForChild("Concrete").SoundId,
	[Enum.Material.Granite] = game.ServerStorage.Sounds:WaitForChild("Granite").SoundId

}

game.Players.PlayerAdded:Connect(function (plr)
	plr.CharacterAdded:Connect(function (char)
		local hum = char:WaitForChild("Humanoid")
		local hrp = char:WaitForChild("HumanoidRootPart")
		local Running1 = game.ServerStorage.Sounds.SmoothPlastic:Clone()
		Running1.Parent = hrp
		hum.Running:Connect(function ()
			Running1.Playing = true
			Running1:Play()
			print("YO MAMA ES FAT")
		end)
		
		hum:GetPropertyChangedSignal("FloorMaterial"):Connect(function ()

			local floorMat = hum.FloorMaterial
			local floorSound = materialSounds[floorMat]
			print("Mat Changed")
			if floorSound then
				--soundE:FireServer(floorSound, materialSounds, true)
				Running1.SoundId = floorSound
			
			else
				--soundE:FireServer(footSounds, materialSounds, false)
				Running1.SoundId = materialSounds[Enum.Material.SmoothPlastic]
				
			end
		end)
	end)
	
end)