Melody - the perfect music module for you


Melody is a music module to help you play, queue, loop a playlist, and manage music easily.

This is my first module and devforum post so if you have any suggestions please let me know


This module allows the user to make a looped playlist of songs using just 2 lines of code and has a lot more features.

Melody is made simple to use.

first insert melody to your game, then put it in replicated storage.

for a basic setup do the following in a localscript:

Melody = require(game.ReplicatedStorage.Melody).new({"some id"--[[ add as many ids as you want --]]}, workspace--[[parent --]])

let’s say you want to add/remove a song from the queue

Melody:AddSoundIdToQueue("id") -- adds the soundId to the queue
Melody:RemoveSoundIdFromQueue("id") -- removes the specified soundId from the queue
Melody:RemoveCurrentSoundIdFromQueue() --removes the current playing soundId from the queue

some other functions

Melody:GetQueue() --returns the queue

Melody:SkipCurrentSong() --skips the current playing song

Melody:Pause() -- pauses the song

Melody:Stop() --stops the song completely

Melody:Destroy() --destroys the sound instance and removes the queue

Melody:GetSoundId() --returns the current soundId

Melody:GetSoundIndex() --returns the current index of the queue

Melody:GetSound() --returns the instance of the sound

Quite simple isn’t it?

If you find any errors/bugs or if you have a suggestion please let me know.

Would you use this?
  • Yes
  • No

0 voters

How would you rate this module?
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10

0 voters


Module looks awesome, If I were to suggest something, Allow us to add an array of ID’s not manually assign one song.

The offsets like Volume, Speed and Loop can be outside of the array. Something like this:{
 Volume = .5;
 Speed = 1;
 Looped = false;

 IDs = { 0, 1, 2, 3 };

I can see that being much easier than having 20+ lines of just :Play with a ton of arguments :smiley:


thanks for the suggestion V0.0.2 is now out :slight_smile:

The module itself is good, You did a great job on it. But…

Not trying to be that guy, But what are the perks/advantages of using this module? It would be better if you used OOP (Oriented Object Programming) instead of just adding all the Songs inside a single table. It seems like the module is just a wrapper for Creating Sounds, Getting Properties (Which could be easily done by doing Sound.TimePosition, Sound.TimeLength, etc)

Of course, That’s just a suggestion for you! I understand that this is your first Module, But despiting all that stuff i mentioned above, You did a great job on it! :slight_smile:


If they were to add OOP, I might use it, but it its current state, it seems hard to use, and I can always make my own OOP module for my game that is a better fit for my game than this.

I personally find this module redundant and useless, as you can just use a regular script and a sound and it would be just fine. But, I do think that the structure of your code is nice.


im not planning on using this for 2 reasons:

  • you use wait() instead of task.wait()
  • did while wait() do bad practice.

But cool nonetheless! Keep up the great work bro!

What’s stopping you from creating an audio instance and playing it?

why do I see like every other person say it’s great- it’s literally just an"Sound")

1 Like

As stated before in the “why would I use this”

Dude so what, it’s simple to make a loopable audio system

local sound ="Sound")
sound.SoundId = "your I'd whatever"

Just because your module decreases just 1 line dosent mean it’s suddenly useful.

1 Like

ok, and, where’s the loop here?

1 Like

The loop is right here.

Read code first.

1 Like

all you did was play the same sound 2 times, which you can just do by setting looped to true , that isn’t what this module does, did you even understand what the module does in the first place?

Oh. So your module is even worse then. You can do it all in 4 lines too. No need for module

1 Like

How would i make it work for a main menu only? would be really fun to use.

you can use Melody:Stop() or Melody:Pause() after the user presses the play button

Dude this module is just a music wrapper. Not useful

1 Like

Ah cool imma now see how to do it, since i dont do UI stuff that much

very useful for me (yes ratio)


How is it useful to you? You can do the same thing with“sound”)

What’s even worse is that you can’t set the parent of the audio. (Using the module)

1 Like