Roblox Scripts Not Playing Sound ID

So basically Im trying to make A sound player, but if i input a song it wont play and gives me this error

     game.ReplicatedStorage.MusicPlay.OnServerEvent:Connect(function(Players)
print("Event Made it")
sound.SoundId = "rbxassetid://".. game.StarterGui.Music.Frame.TextBox.Text
sound:Play()

end)‘’’

but it gives me this error :arrow_forward: Failed to load sound rbxassetid://: Unable to download sound data (x2)

1 Like

Where do you define sound? Can we see your variables?

If you’re trying to access the text of something, this is not a good way to do so. StarterGui is a service, anything inputted into a textbox will not replicate here, it only shows in a specific player’s PlayerGui. What I would do instead is fire the sound ID with the event as well so it will be passed onto the server.


local sound = game.Workspace.RadioMesh.Sound

local button = game.StarterGui.Music.Frame.TextButton

local IDN = game.StarterGui.Music.Frame.TextBox

i used IDN then i changed it cause its not working

When you send massage to server you should put variable text in it like that

FireServer(PlaceOfTextLabel.Text)

And when call it in server make that

game.ReplicatedStorage.MusicPlay.OnServerEvent(plr, text)

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

Let me test to see if it works :grinning:

This is unrelated to the issue you’re having, but you should also be checking whether the ID is a valid audio before playing it.

It is valid i use raining tacos to check

But, what if a player enters something that isn’t an audio?

The gui is only gonna show up for me i was using a song id

well i still have the same error

Server


local button = game.StarterGui.Music.Frame.TextButton

local IDN = game.StarterGui.Music.Frame.TextBox

game.ReplicatedStorage.MusicPlay.OnServerEvent:Connect(function(plr, text)

print("Event Made it")

sound.SoundId = "rbxassetid://"..text

sound:Play()

end)

Client

local TextPlace = game.StarterGui.Music.Frame.TextBox
button.MouseButton1Click:Connect(function()
	game.ReplicatedStorage.MusicPlay:FireServer(TextPlace.Text)
	
end)

09:06:57.621 :arrow_forward: Failed to load sound rbxassetid://: Unable to download sound data (x2) -

it doesnt show the sound id :frowning:

Use tonumber(SoundId) to make the ID a number instead of a string

Try another id or print text in server script

i tried but it gives me this error 09:11:50.332 :arrow_forward: Failed to load sound rbxassetid://: Unable to download sound data (x2) - Studio

That means the audio you entered isn’t actually an audio ID, or the audio is deleted. This is why I suggested you check these before playing it.

But im able to play the song in Studio without the script

Bro there problem in your script in client this problem

local TextPlace = game.StarterGui.Music.Frame.TextBox
Should write
script.Parent
Because all children in gui get copied and go to playergui

Try a different audio id and see if you get the same error