local Songs = require(module path here)
local keys = {}
for key, _ in pairs(Songs) do table.insert(keys, key) end
local songName = keys[math.random(1, #keys)]
local songData = Songs[songName]
print(songName, songData)
No, it’s because your table uses string keys to access its objects. SongList["Closer"] and such. In your case, you have to generate a random song and that can only be done by selecting a random number x from the total of y number of songs. So that part only makes it so your songs are numbered instead of accessed by their name. If you wanted to work directly with the module you’d have to change the SongList’s structure like such:
local SongList = {
{
Name = "From Dust & Ashes",
ID = 7023459476,
Creator = "Anthony Nikita"
},
{
Name = "From Dust & Ashes",
ID = 7024254685,
Creator = "Notaker"
},
}