Failed to load sound

Hey! We have a GUI that plays a song
image
Set up like above ^

When a player enters an ID and click the button to play it, it’ll print this error:

The script can be seen below, we’ve tried to edit the ending script of where it grabs the asset ID etc but nothing seems to fix this error.


local IDN = script.Parent.Parent.TextBox.Text

local Sound = workspace.BeachSpeaker.Sound

Sound.SoundId = "rbxassetid://" .. IDN

Sound:Play()

end

script.Parent.MouseButton1Click:connect(OpenSong)
1 Like

Anything that a client changes on the box does not change to server, thus the ID won’t change. You have to utilize remotes.

1 Like
local IDN = script.Parent.Parent.TextBox
IDN.FocusLost:Connect(function(enterPressed) 
     if enterPressed then
            Sound.SoundId = "rbxassetid://"..IDN.Text
            Sound:Play()
     end
end)

Try something like this. You can do some extra checks as you read a new sound value to make sure that it is valid (possibly by converting to number).

Refer to Operatik’s response. The script is running on the server and won’t be able to detect the value of IDN changing because it does not replicate across Roblox’s client-server boundaries.

Oops, you are correct. I missed that this was a ServerScript. If this is something that needs to be played only on the client-side, I’d recommend swapping out the script for a LocalScript.