#Does anyone know how to make a background music play queue?

1 messages · Page 1 of 1 (latest)

sacred geyser
#

This is my script: local musicFolder = game.Workspace.Music

local music = musicFolder:GetChildren()

local index = math.random(1, #music)

local function PlayNextSong()
if index > #music then
index = 1
end

music[index]:Play() 

end

for _, song in ipairs(music) do
song.Ended:Connect(function()
index += 1
PlayNextSong()
end)
end

PlayNextSong()
None of my tracks are looped, yet for some reason the two of them play at the same time upon joining instead of one at a time. Please help!

fervent fog
#

cuz u dont wait for them

#

oh wait

#

let me see

#

if index > #music then
index = 1
end

useless

fervent fog
sacred geyser
fervent fog
#

y e s

sacred geyser
#

doesnt work

fervent fog
#

does it show any error

sacred geyser
#

OH

#

hold on

fervent fog
#

oh wait

#

I forgot to define music folder

#

my bad

sacred geyser
#

ur good im gonna fix it

fervent fog
#
local musicFolder = workspace.Music
local music = musicFolder:GetChildren()
local index = math.random(1, #music)

local function PlayNextSong()
    local currentSong = music[index]
    currentSong:Play()

    currentSong.Ended:Once(function()
        index = (index % #music) + 1
        PlayNextSong()
    end)
end

PlayNextSong()
sacred geyser
#

yeah its stillnot working

fervent fog
#

does

#

it

#

show

#

error

sacred geyser
#

no

#

whar

fervent fog
#

bro

#

remove

#

breakpoint

#

and its music

#

not Music

#

fatty

#
local musicFolder = workspace.music
local music = musicFolder:GetChildren()
local index = math.random(1, #music)

local function PlayNextSong()
    local currentSong = music[index]
    currentSong:Play()

    currentSong.Ended:Once(function()
        index = (index % #music) + 1
        PlayNextSong()
    end)
end

PlayNextSong()
#

try

#

now

sacred geyser
#

now theres just a slight delay before the other track plays over it

#

oh wait

#

hold on

fervent fog
#

thats probably the song

sacred geyser
#

probably

#

its js not working man

#

maybe they shouldnt be in the same folder

#

?

fervent fog
#

wait

sacred geyser
#

yeah

#

should it be in sound service instead

#

i was unsure w that

sacred geyser
#

ts pmo

young token
#

print will save u

#

trust

sacred geyser
#

i already tried that

#

i deleted all scripts and the second track since the scripts seemed to be doing nothing

#

i removed the scripts and it was the exact same

#

so idk what it is now

young token
#

do printas

#

prints

#

trust

#

me

#

add prints everywhere

sacred geyser
#

wdym

#

in the script?

#

bcs i deleted all scripts

young token
#

ye just print everywhere

sacred geyser
#

dude theres no more script to put print in

#

my script ended up being useless

#

Does anyone know how to make a background music play queue?

fervent fog
#

so the thing is uh

#

your fatass is using a local script in server script service

sacred geyser
#

I deleted the damn scrip5 😭

#

I tested it around, put it in a bunch of different places and it was the same

hollow helmBOT
#

studio** You are now Level 4! **studio