i wanna make if error "Unable to download sound data" appears in console then my sound delete
local Event = game:GetService("ReplicatedStorage").Event
Event.PlaySound.OnServerEvent:Connect(function(Player, AssetId, Volume, Pitch)
local Sound = instance.new("Sound")
Sound.Parent = Player.Character.Radio
Sound.Name = "Music"
Sound.Volume = Volume or 0.5
Sound.Pitch = Pitch or 0.5
if typeof(AssetId) == "table" then
Sound.SoundId = "http://www.roblox.com/asset/?id="..AssetId[math.random(1,#AssetId)]
else
Sound.SoundId = "http://www.roblox.com/asset/?id="..AssetId
end
Sound:Play()
end)

2 comments
You could wrap your function with a pcall to check if it errors or not
You could wrap your function with a pcall to check if it errors or not