Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How to make a text box update?

Hello. I am trying to make server music player GUI. The problem is the text box, where a player enters the audio id is not updating. What I mean is, when I press play audio, it tries to play the default text box text that I had set.

eyy = script.Parent.Parent.TextBox.Text
script.Parent.MouseButton1Click:connect(function()
game.Workspace.Sound.SoundId = ('rbxassetid://'..eyy.Text)
game.Workspace.Sound:Play()
end)

I get this error "Sound Workspace.Sound Failed to load rbxassetid://Enter Audio ID here"

That is the script I have right now. Please tell me what's wrong with it, and how to fix it.

Thanks

1 answer

✓ Accepted answer

This is happening because, if you set a variable to the text of the textbox, it'll only store the string of that text at that time. Instead, you should do something like this:

eyy = script.Parent.Parent.TextBox
script.Parent.MouseButton1Click:connect(function()
	game.Workspace.Sound.SoundId = ('rbxassetid://'..eyy.Text)
	game.Workspace.Sound:Play()
end)

1 comment

0

Thanks! You really helped me.

This discussion is preserved as it was. New answers, comments, and votes are closed.