How to setup a music system

So I look up how to make a music system It showed nothing to help me I watch 14 Vids Can I get some advise how to setup a music system?

3 Likes

I’ve written a sample script below. It’s untested so it may not work, but this is probably how I’d go about writing this. Basically, ā€œSoundEmitterā€ is the part where all of your music tracks are located, put as many in there as you want. Store this Script in ServerScriptService, and it should do the rest automatically.

Hope this helps. I didn’t add commenting as I figured you needed this just for the functionality aspect.

local soundtracks = workspace.SoundEmitter:GetChildren()
local soundtrack_index = 1

local function Play_Soundtrack()
local sound = soundtracks[soundtrack_index]

sound:Play()

local connection
connection = sound.Ended:Connect(function()
soundtrack_index = (soundtrack_index + 1 > #soundtracks and 1) or soundtrack_index + 1
Play_Soundtrack(soundtracks[soundtrack_index])
connection:Disconnect()
end)
end

Play_Soundtrack(soundtracks[soundtrack_index])

:slight_smile:

4 Likes

This may not seem like help at all, but i recommend just trying things that you think will work. Trial and error and referencing the catalog API’s.

Alright thanks I will check it out.

Does it only work in game are both?

It should either way.

-30chars-

I don’t hear anything Are should I try it in game?

My bad, make ā€˜SoundEmitter’ a Folder or something, not a brick.

1 Like

Ik this a waste of your time but like how do I make a folder I forgot.

If you right-click on the Explorer window, hit ā€˜Insert Object’, then find ā€˜Folder’. Name it ā€˜SoundEmitter’, and store all your music in it.

Ok is there any scripts I need do are do I just start puting Ids.

I playtested the code right now and it works good. All you need to do is put all the soundtracks you want in the folder and the script should do the rest :slight_smile:

Do I add a script to the folder and start putting music ids?

Make a script with the code I gave you, and put the script in ServerScriptService.

Put the ā€œSoundEmitterā€ folder into workspace, and then at that point load it up with whatever soundtracks you want. Input the ID of the music you want into various ā€˜Sound’ objects.

Ok lol I just notice u co-owner of Walmart lol

I have a question are u busy to help me dev my bakery?

Just let me know if your interested.

1 Like

Hello! I followed what you said but it is not working.
I put the script in Server Script Service and then made a folder at workspace named ā€œSoundEmitterā€ and made Sound and put the IDS.

Hey man, it worked for me just a moment ago thought. Did you look at the capitals and where you’ve put them?

1 Like