Safe and Reliable Way to Check if SoundID is Valid

I know that it has been asked many times how to check if an ID is valid, but all the solutions miss one thing.

I know that I can check the name of the product with marketplace service to tell if it is “Content Deleted” or “Removed for Copyright”. However, there is one more thing that can cause an ID to not play and that is if it is a stereo as Roblox made it so only mono tracks work.

When these tracks fail to play, they error with error 46 and LogService can be used to detect this.

However, my issue is that this error only appears on the client. Even if I create a sound instance on the server and set the id there, the error only appears on the client. This is an issue because if I have logic that deletes people’s data when the song breaks, I have to put this on the client and then an exploiter can cause a fake error with the Error command and trick it into deleting the data.

Is there any way I can reliably detect this Error 46 from the server and be 100% sure that the audio is actually broken? Thanks.

This is a tricky question to answer but why are you deleting the players data upon the error of a sound in the first place? I believe there might be a better way around this problem rather than relying on LogService.

If there is an easier way then I would love to hear it. I need to delete this data because it is shown to many players and it isn’t a great experience for them if the songs they get are broken.

Could you perhaps send a remote out to all players and then make your decision based on the majority? This way, if there’s 1 exploiter in the lobby then they’ll be overruled. The only situation in which this would be bad is if there are multiple exploiters in the lobby who all collaboratively work together in succession, however that’d be hard and I doubt somebody would go to all that effort for something like this.

That’s a creative idea but my lobbies are only one player. Maybe something with messaging service might be needed between servers.

If it’s erroring then cant you wrap a pcall on client to detect. e.g

local _,response = pcall(function()
end 
if response then

 fireserver(response)
end

Unfortunately no. The error does not derive from a specific line of code. It is an error that Roblox studio just throws when an audio fails to load, so there is nothing to wrap in a pcall.

Regardless it will stop your code from halting. After searching i believe this post is something that can help you: How to detect if soundid is invalid?

Thanks but to my knowledge pcall only catches errors and prevents haulting from errors thrown within the pcall. Also, this post only checks if the Id exists, not if it is removed for any reason. Checking the song length after is not reliable as this would happen even if the sound files to load due to internet.