Okay so me and a friend were going to make a script that cycles through music in a game and searches for any models called "Screen" in workspace and a block called "-" inside it which has a surfacegui and textlables. Here is a picture of how it is laid out: Picture
Okay so what we're having trouble with is getting it to work ingame. It works perfectly in studio, but as soon as we test ingame, it just loops the 1st song and doesn't move on, is this a fault on ROBLOX's side or are we doing something wrong in the script? If so please could you point it out. Here is the script:
Music = {}
function AddMusic(Name, id)
table.insert(Music, {Title=Name,ID=id});
end
Musica = true
AddMusic("Uptown Funk",210232032)
AddMusic("Blank Space",200481071)
AddMusic("Centuries",181547615)
AddMusic("Sugar",212017208)
AddMusic("Like I Can Remix",195112281)
AddMusic("Gravity Falls - 8 bit",156026545)
AddMusic("Elector Monster",169875502)
coroutine.resume(coroutine.create(function()
while Musica do
Musica = false
for i,v in pairs(Music) do
local Sound = Instance.new("Sound",workspace)
Sound.Archivable = true
Sound.SoundId = "http://www.roblox.com/asset/?id="..v.ID
for _,Screen in pairs(workspace:children()) do
if Screen:IsA("Model") and Screen.Name == "Screen" and Screen:findFirstChild("-") then
Screen["-"].SurfaceGui.Frame.Cur.Text = "Current Song: "..v.Title
if Music[i+1] then
Screen["-"].SurfaceGui.Frame.Nex.Text = "Next Song: "..Music[i+1].Title
else
Screen["-"].SurfaceGui.Frame.Nex.Text = "Next Song: "..Music[1].Title
end
end
end
Sound.Volume = 1
Sound.Looped = true
wait()
Sound:Play()
Sound.DidLoop:wait()
Sound:Stop()
Sound:Destroy()
end
Musica = true
wait()
end
end))
Yes I know there is no point in it being inside a coroutine, but I added it just in case I wanted to add anything else into the script later, or if my friend wanted it. It's the exact same without the coroutine.

4 comments
cmon like 2 hours and still no help x.x
Line 23:- Sound.SoundId = "http://www.roblox.com/asset/?id="..v.ID ?? should it be just Sound.SoundId = "http://www.roblox.com/asset/?id="..v
How so? i'm not having any troubles playing the right song Id and it should be v.ID why would it be v?
It shouldn't be just 'v' because 'v' is a table and 'ID' is inside the table > v.ID