This should select an id from the table and play it (other part in a local script), but instead the song plays for like ~5 seconds and then another song is played, and it keeps repeating itself.
It never waits for an actual song to finish before playing a new one.
work.SoundBrick.Sound.Ended:connect(function()
if not debounce then
debounce = true
-- added to debug
work.SoundBrick.Sound:Stop()
local randomSong = songs[math.random(1, #songs)]
print(randomSong)
wait(0.5)
remotes.Events.PlaySong:FireAllClients(randomSong) -- add in params
wait(4)
debounce = false
end
end)

1 comment
Yeah this is the correct answer. I don't know why he didn't try that. Use the roblox wiki for help for problems like this. http://wiki.roblox.com/index.php?title=API:Class/Sound Whenever I have a problem I check the wiki first. If you know Lua's syntax properly, the wiki should help for most problems like this.