I am trying to make it so when a user inputs a sound ID in the textbox and presses the play button
it will play the desired song. However I can't find out what's wrong. I have tried ..tonumber(input.Text) but that does not seem to work.
local Input = script.Parent.Parent.Parent.MusicID
function play()
for i, v in pairs(game.Workspace:children()) do if v:IsA("Sound") then v:Destroy() end end
local s = Instance.new("Sound", game.Workspace) s.SoundId = "http://www.roblox.com/asset/?id=" ..tonumber(input.Text)
s.Volume = 1
s.Pitch = pitch
s.Looped = true
s.archivable = false repeat
s:Play()
wait(2.5)
s:Stop()
wait(.5)
s:Play() until
s.IsPlaying
end
script.Parent.MouseButton1Down:connect(play)
EDIT:
local Input = script.Parent.Parent.Parent.MusicID
function play()
for i, v in pairs(game.Workspace:GetChildren()) do
end if v:IsA("Sound") then
v:Destroy() end end
local s = Instance.new("Sound", game.Workspace)
s.SoundId = "http://www.roblox.com/asset/?id=" ..(Input.Text)
s.Volume = 1
s.Pitch = pitch
s.Looped = true
s.archivable = false repeat
s:Play()
wait(2.5)
s:Stop()
wait(.5)
s:Play() until
s.IsPlaying
script.Parent.MouseButton1Down:connect(play)

6 comments
This solution did not work either. :( Check my edit in the question to see what I changed.
Did you replace both line 4 and line 5?
Yes.
I will repost the whole script for you.
Okay.
Wait, when I press the play button, the button that plays the song you inputed, nothing happens? I checked the parents and everything.