So I made a GUI and put this script in it.
01 | local okbutton = script.Parent.TextButton |
02 |
03 | function onClicked(id) |
04 | id = script.Parent.TextBox.Text |
05 | local music 1 = Instance.new( "Sound" ) |
06 |
07 | music 1. Parent = game.Workspace |
08 |
09 | music 1. SoundId = "http://www.roblox.com/asset/?id=" ..id |
10 |
11 | wait( 1 ) |
12 | music 1 :Play() |
13 | end |
14 |
15 | script.Parent.TextButton.MouseButton 1 Click:Connect(onClicked) |
Well, it's not working. Can somebody help me fix this?
I tested my script out and I found out that it works!
01 | local okbutton = script.Parent.TextButton |
02 | okbutton.MouseButton 1 Click:Connect( function () |
03 | local id = script.Parent.TextBox.Text |
04 | local music 1 = Instance.new( "Sound" ) |
05 |
06 | music 1. Parent = game.Workspace |
07 |
08 | music 1. SoundId = "rbxassetid://" ..id |
09 |
10 | wait( 1 ) |
11 | music 1 :Play() |
12 | end ) |