Get rid of the sound errors in output

hi i have made a script that gets rid of the sound id errors in output since i got fed up with them anyways heres the script:

local LogService = game:GetService("LogService")
local function FindAudioErrors()
	local Output = LogService:GetLogHistory()
	for Index, Message in ipairs(Output) do
		if Message.messageType == Enum.MessageType.MessageError then
			local ErrorMessage = Message.message
			local Asset = string.match(ErrorMessage, "rbxassetid://%d+")
			if Asset then
				for IndexTwo, Sound in pairs(game:GetDescendants()) do
					if Sound:IsA("Sound") then
						if Sound.SoundId == Asset then
							local OldId = Sound.SoundId
							Sound.SoundId = ""
							warn("Cleared ".. Sound:GetFullName().. "'s SoundId.", "Old Id = ".. OldId)
						end
					end
				end
			end
		end
	end
end
FindAudioErrors()

how to use
just put that in the console and boom. heres what it does

14 Likes

oh and if you want change Sound.SoundId = "" to what to happen to the audio like what i put in is it just sets the sound id to nil and so it doesnt play any audio and also doesnt have any errors

edit
i dont want to make another reply but you have to make the sounds load first so they print the error in the output. just press play on the game

This is saved me a lot of times while i was test my weapons that show a lots of sound errors in output and Thank you so much for the script!

Very helpful and elegantly written. Thank you.