hello, i have a sound manager as a server script
local songs = script.Parent
local songstable = {}
local lastsong = nil
for i,v in pairs(songs:GetChildren()) do
if v:IsA("Sound") then
table.insert(songstable,v)
end
end
local chosensong = songstable[math.random(1,#songstable)]
while true do
if raid == false then
if playing == false then
playing = true
for a,c in pairs(songstable) do
if raid == false then
print("playing normal song (whiletrue loop normal)")
repeat wait() chosensong = songstable[math.random(1,#songstable)] until chosensong ~= lastsong
lastsong = chosensong
chosensong:Play()
chosensong.Ended:Wait()
chosensong:Stop()
end
end
end
end
wait(1)
end
it loops through a folder, then add its to the table, this is fine, however
before 10 secs, or more or less,another song starts playing despite having chosensong.Ended:Wait()
please help