Im making a juke box, and a part outside of it is a click detector, and a gui pops up that lets u put the music id into it. When you click it nothing happens. I’m still really new to scripting so any help is a lot for me.
game.StarterGui["Song ID"] = "gui"
game.StarterGui["Song Id"].TextBox = "id"
local Plr = game.Players.LocalPlayer
local Folder = Instance.new("Folder", Plr)
Folder.Name = "CurrentSong"
local Song = Instance.new("Sound", Folder)
Song.Playing = true
script.Parent.MouseClick:connect(function(Plr)
if gui.Enable == false then
gui.Enable = true
end
Song.SoundId = "rbxassetid://"..id
Song:Play()
end
LocalScripts do not run in Workspace. I would move your script to StarterPlayerScripts or any instance listed here. Also, :connect with a lowercase c is deprecated so I recommend that you use :Connect with a capital C. Also, the property is called Enabled, the d at the end is important, here is a link to the page on the Developer Hub.
On top of @COUNTYL1MITS’s post you aren’t properly referencing the player’s GUI. To get a player’s actual GUI you need to navigate to their own GUI folder.
I was looking at your updated code. If you are trying to get the server to play whatever ID the player typed into the text box, then I believe you’re going to have to use a Remote Event in order to let the server know that the player typed something in the text box. I’m also fairly new to scripting, so this is just an idea I thought of right off the top of my head.
EDIT: Also in your Id variable, you reference the Textbox, but not the Textbox’s Text.