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

Sounds not working? [FAIL I forgot play()] dont neeed help

Asked by
Thetacah 712 Moderation Voter
10 years ago

Anyone have an idea why this doesn't play a sound? It doesn't play a thing so the while loop keeps on going.

function playsound()
    if(soundids and sound) then
        print("Getting ready to play a sound to the workspace!")
        local randomsound = math.random(1, #soundids)
        local soundplay = soundids[randomsound]
        sound.SoundId = "http://www.roblox.com/asset/?id="..soundplay
    end
end

while(not sound.IsPlaying) do
    if(not sound.IsPlaying) then
    playsound()
    wait(0.03)  
    end
end

Answer this question