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

How to place the TextBox Text and put it into the music id?

So I did: > StarterGui >ScreenGui >TextBox

if script.Parent.Text ~= " " then
	texty = script.Parent.Text
	game.Workspace.Music.SoundId = texty
end

For some reason I tried to get the text and put in into the music id, seems to fail. Also, the music stops, I don't know how to make it know when to stop.

2 comments

0

Try adding "rbxassetid://" in the beginning. Here is an example: "rbxassetid://" ..tonumber(Your thing here)

0

Doesn't seem to do anything

1 answer

script.Parent.FocusLost:Connect(function(enter) --this parameter is if then "enter" key is pressed
	if enter == true then
		game.Workspace.Music.SoundId = ("rbxassetid://"..script.Parent.Text)
		game.Workspace.Music:Play()
	end
end)

This uses the focuslost function to see if the player clicks on the text box to start typing. The parameter used here only changes the SoundId if they had pressed enter after typing in the SoundId they want. It changes the SoundId to whatever they input. It then plays the sound if it is an actual audio that can be played.

Hopefully this helps you, and if it did please accept the answer! :D

4 comments

0

I put it into a script inside the textbox, but it doesn't seem too work, what's happening?

0

Oh, it's got to be a local script.

0

Thanks!

0

If it helped, please accept the answer. Also, you’re welcome!

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