I have code that randomizes songs, and I found a solution, but I need help coding it. (Keep scrolling low-resolution users for explanation)
local musicTable = script.Music:GetChildren() -- yes i recycled this from my impact sound script :troll:
local randomSong = musicTable[math.random(1, #musicTable)]
What I want to do here is I want to reference the randomized song so I can write some code on when it ends and I can trigger a new sound to be picked.

2 comments
Fun fact: You referenced the song. randomSong is the referenced object, displayed as a variable. I'm not sure what you are asking other than this.
No, that only picks a random song. It doesn't know which one it picked, though.