I’m getting the error in the title with the script below. What did I do wrong and how to fix this?
(i tested the sounds and they worked separately)
(The sound is a child of the workspace named “Music”)
while true do
local RandomMusic = math.random(1,10)
workspace.Music.Playing = true
if RandomMusic == 1 then
workspace.Music.SoundId = 4890240919
wait()
elseif RandomMusic == 2 then
workspace.Music.SoundId = 5606889518
wait()
elseif RandomMusic == 3 then
workspace.Music.SoundId = 3325301220
wait()
elseif RandomMusic == 4 then
workspace.Music.SoundId = 3325335957
wait()
elseif RandomMusic == 5 then
workspace.Music.SoundId = 5606868511
wait()
elseif RandomMusic == 6 then
workspace.Music.SoundId = 225000651
wait()
elseif RandomMusic == 7 then
workspace.Music.SoundId = 3443319451
wait()
elseif RandomMusic == 8 then
workspace.Music.SoundId = 857499889
wait()
elseif RandomMusic == 9 then
workspace.Music.SoundId = 4969365774
wait()
elseif RandomMusic == 10 then
workspace.Music.SoundId = 422556160
wait()
end
wait(50)
end