Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

What's wrong with my random music chooser?

music = {176407800, 166886402, 183503743, 185698490}

while true do
	local id = math.random(1, #music)
	script.Sound.SoundId = "rbxassetid://"..id
	wait(10)
end

It doesn't do anything and I have no errors. What did I do wrong?

1 answer

✓ Accepted answer

Your problem is on line 5 of that code.

The value of id is either 1, 2, 3, or 4. These correspond to the four ids you have in the music table, but you have to actually access the table to get them. :P

script.Sound.SoundId = "rbxassetid://" .. music[id]

3 comments

0

Oh.. lol

0

Hmm, still doesn't seem to work.

0

Oh, because I didn't play it. XD

This discussion is preserved as it was. New answers, comments, and votes are closed.