So I'm trying to make a radio gui for my game that's similar to berezaa's radio, where you can switch between music that only you can listen to and change for free, or server music that everyone can hear, but changing it costs you. I have the changing music part almost down, it switches music correctly, but whenever you put in the ID of something that isn't a sound ID, it spams the client log with errors saying that it's not a sound ID. With that said, I wanna know, how do I check if the ID someone puts into the radio is actually a sound ID in the library? I've seen games connect to the catalog and library (catalog heaven, robloxian high school, etc) and I just wanna know how I can connect to the library to tell if the music ID is actually a sound ID. Sorry if I sound redundant, I just really wanna figure out how to do this. Anyways, here's the code I'm using for the local music of my radio:
script.Parent.MusicIdBox.ChooseButton.MouseButton1Click:Connect(function()
if script.Parent.MusicIdBox.Text ~= "" then
game.Workspace.Music.LocalMusic.SoundId = "http://roblox.com/asset/?id=" .. script.Parent.MusicIdBox.Text
game.Workspace.Music.LocalMusic.TimePosition = 0
end
end)
script.Parent.MusicIdBox.ResetId.MouseButton1Click:Connect(function()
script.Parent.MusicIdBox.Text = "474419296"
game.Workspace.Music.LocalMusic.SoundId = "http://roblox.com/asset/?id=" .. script.Parent.MusicIdBox.Text
game.Workspace.Music.LocalMusic.TimePosition = 0
game.Workspace.Music.LocalMusic.Volume = 0.5
end)
script.Parent.PlayButton.MouseButton1Click:Connect(function()
game.Workspace.Music.ServerMusic.Volume = 0
game.Workspace.Music.LocalMusic.Volume = 0.5
game.Workspace.Music.LocalMusic:Resume()
end)

3 comments
It worked, thanks! I didn't really understand how pcall worked before, so I never used it. Good to know the solution is way less complicated than I thought!
Wait, nevermind. It's not working, it still spams the client log, and it accepts IDs that aren't sounds... I understand pcall a little better now, but I have no clue on how to fix the ID problem and the wiki doesn't help with that too much. Care to elaborate?
I don't use pcalls very often. Updated answer.