Well, the music plays only once for 100 seconds, then it doesn't choose music again. I don't know if I did something wrong or not, please help me. It also doesn't error when it's looped a full 100 seconds.
music = {176407800, 166886402, 183503743, 185698490, 165065112, 145127587, 155146819, 178066730, 137985283} while true do local id = math.random(1, #music) game.Workspace.Sound.SoundId = "rbxassetid://" .. music[id] game.Workspace.Sound:Play() wait(100) game.Workspace.Sound:Stop() end
The numbers in the table on line 1 must be strings, since SoundId is a string, Put quotation marks around each value in the table, and you will be good to go.
For example:
176407800
should look like this "176407800"
Well, you messed up on line 4. You almost had it, though. When getting a random parameter from a table, you have to use the template, which is provided in line 4.
music = {176407800, 166886402, 183503743, 185698490, 165065112, 145127587, 155146819, 178066730, 137985283} while true do local id = music[math.random(1, #music)] game.Workspace.Sound.SoundId = "rbxassetid://" .. music[id] game.Workspace.Sound:Play() wait(100) game.Workspace.Sound:Stop() end
while true do local h = Instance.new("Hint") h.Parent = game.Workspace h.Text = "Game by JustGimmeDaBux. PM JustGimmeDaBux for Information!" wait(7) h.Text = "Remember: Griefing, C4, AND flooding are STRICTLY PROHIBITED." wait(7) h.Text = "Found an Exploiter? PM JustGimmeDaBux the FULL USERNAME with PROOF!!" wait(7) h.Text = "Thanks for playing! Leave a like/comment. Keep building!"
Above is my script. Yours looks like you're trying to do the same thing. Your script below looks fine, but this may work to improve the script.
music = {176407800, 166886402, 183503743, 185698490, 165065112, 145127587, 155146819, 178066730, 137985283} while true do local id = music[math.random(1, #music)] -- Error on this line game.Workspace.Sound.SoundId = "rbxassetid://" .. music[id] game.Workspace.Sound:Play() wait(100) -- You could lower the time because some songs may not have a loop and keep going through blank song until the 100 seconds are up. game.Workspace.Sound:Stop() end -- Before your end, you should add several and then add a repeat script so it randomly repeats the music so your viewers don't run out of music to listen to.
Hope I helped!