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