Audio script not working

I made a script to play an audio by id. It’s not working, can someone tell me why?

local folder = script.Parent.MusicPlayer
local tb = script.Parent.Parent.TextBox
local id = tb.Text

folder.Parent = workspace

script.Parent.MouseButton1Click:Connect(function()
	folder.Music.SoundId = "rbxassetid://" .. id
	folder.Music:Play()
end)

An ID doesn’t need rbxassetid:// attached. Firstly, doing that changes it from a number value to a string, and secondly it just doesn’t need that to work. :IsPlayerInGroup() doesn’t use a group link, just the ID.

Any errors in the output perchance?

There’s nothing related to this script in the output

What exactly are you trying to make, a boombox?

Just changing rbxassetid and putting just the id still doesn’t work, the SoundId still blank

A gui for music, when you press the button and there’s and ID in the textbox it plays that music id

Are you trying to play it locally or server sided

Is it a script or a LocalScript?

It is a normal script, i was thinking that if i used localscripts it would only play the sound for that one player

Does every single player have the gui, and if so then youll probably need a remoteEvent if you want other players to hear the music

try this

local folder = script.Parent.MusicPlayer
local tb = script.Parent.Parent.TextBox
local id = tb.Text

folder.Parent = workspace

script.Parent.MouseButton1Click:Connect(function()
	folder.Music.SoundId = "rbxassetid://" ..tonumber(id)
	folder.Music:Play()
end)

For the record, server scripts can 100% handle UI inputs ,it’s just not recommended to use it in such a manner. Also,

Your id text is at the top of the script. Try putting it in the event instead. Your variable will not update when the text is changed.