Why my music changer script wont work?

Hello, i got a problem with music changer script and it doesnt work
-i forgot to say that soundid putting only rbxassetid://
here the code

local Choosed = script.Parent.Parent.MusicIDBox.Text

	game.Workspace.Music.SoundId = "rbxassetid://"..Choosed

I need to know what wrong did i do in this script and Thanks for trying to help me :flushed:

Where is music id?And i think in this local Choosed = script.Parent.Parent.MusicIDBox.Text two words parent.Also the problem can be with the music it is in workspace right and it named music if not then it’s not gonna work.

music id in textbox, and theres should be 2 parents i checked, also i forgot to say that soundid putting only rbxassetid:// but without music id, and it named music

The issue is that you are only getting the text once your local script loads in. What you have to do is define Choosed as local Choosed = script.Parent.Parent.MusicIDBox and then get the text each time .MouseButton1Click is fired.

1 Like

its finally worked, thanks you so much

FYI: You should incorporate a RemoteEvent here if you want the SoundId to be replicated and changed for all clients. Just ensure you have a debounce incase of exploiters rapidly changing it.

1 Like