i know there’s several topics on this but i have a folder of songs that i cant really get to play. it picks a random number from how many songs are in the folder but its throwing me an error like this:
ty!
script:
local songs = game:GetService("SoundService").songs
while wait() do
for i, song in pairs(songs:GetChildren()) do
if song:IsA("Sound") then
local randomNo = math.random(1, #songs:GetChildren())
local randomSong = song[randomNo]
randomSong:Play()
randomSong.Ended:Wait()
end
end
end
solution for those who are stuck: (credits: every1 who replied )
local songs = game:GetService("SoundService").songs
while wait() do
for i, song in pairs(songs:GetChildren()) do
if song:IsA("Sound") then
local randomNo = math.random(1, #songs:GetChildren())
local randomSong = songs:GetChildren()[randomNo]
randomSong:Play()
randomSong.Ended:Wait()
end
end
end