Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why is PreloadAsync yielding infinitly?

Asked by 4 years ago

Whenever I run my music script, the PreloadAsync() yields infinitly. No errors showed up, but a Print() function I set up never fires and the music doesn't play. (The original script had about 8 songs, but I had to shorten it to make it fit.)

content = game:GetService("ContentProvider")
music = {"rbxassetid://1581067887","rbxassetid://553600220"}
content:PreloadAsync(music)
while true do
    local pick = math.random(1,table.getn(music))
    local song = music[pick]    
    script.Music.SoundId = song
    script.Music:Play()
    print("Music Playing")
    wait(script.Music.TimeLength)
end

1 answer

Log in to vote
0
Answered by 4 years ago

Turns out that the input in to the PreloadAsync is a table of the actual objects, not the asset ids.

Ad

Answer this question