[v1.0.0] Playlist Module

Banner (8)

Reasons to use the module :

  • Music is a key to fun in games and this module is made for that.
  • This module has alot of functions to help you configure your playlists.
  • Easy to understand & use.

Fast download :

PlaylistModule.rbxm (4.5 KB)

Demo Place:

Untitled Game.rbxl (55.9 KB)

Setup / Installation :

You can make your own playlists and insert your own songs and it’s really easy!

Step 1 : Take the module (Model) then insert it in ReplicatedStorage or something else if you want and make a folder in the module that is going to be our playlist (name it whatever you want).
Step 2 : Put songs you like in the folder you just made. (You can remove the default ones of course)
Step 3 : Finally you can require the module and use the :Start() function :

local PlaylistModule = require(game.ReplicatedStorage.PlaylistModule) -- Location depends on where you put the module

PlaylistModule:Start(YourPlaylistName, LoopPlaylist, songsVolume) -- You don't need to fill in all the arguments because the module has default settings

Template Script :

local PlaylistModule = require(game.ReplicatedStorage.PlaylistModule) -- Location depends on where you put the module
PlaylistModule:Start("TestPlaylist", false, 0.5) -- You don't need to fill in all the arguments because the module has default settings

Functions:

Start()

function PlaylistModule:Start(PlaylistName : string?, LoopablePlaylist : boolean?, Volume : number?)

Starts the playlist.

Arguments:

  • PlaylistName : string : The playlist folder you’re looking for.
  • LoopablePlaylist : boolean? : If you want the playlist to loop forever
  • Volume : number? : The volume of the sounds you inserted in the playlist folder.

SkipForward()

function PlaylistModule:SkipForward(PlaylistName : string, allowSameSong : boolean?, Volume : number?)

Skips forward in the playlist.

Arguments:

  • PlaylistName : string : The playlist folder you’re looking for.
  • allowSameSong : boolean? : If you want to have the same song when you skip (recommended false)
  • Volume : number? : The volume of the sounds you inserted in the playlist folder.

GetCurrentSongName()

function PlaylistModule:GetCurrentSongName(returnTime : boolean?)

Returns current song name/time position.

Arguments:

  • returnTime : boolean? : If you want to return the sound current time position aswell.

SkipBackwards()

function PlaylistModule:SkipBackwards(Volume : number?)

Skips backwards in the playlist.

Arguments:

  • Volume: number? : The volume of the sounds you inserted in the playlist folder.

PauseCurrentSong()

function PlaylistModule:PauseCurrentSong()

Pauses the current song that is playing.

ResumeCurrentSong()

function PlaylistModule:ResumeCurrentSong()

Resumes the current song that is playing.

AdjustCurrentSongVolume()

function PlaylistModule:AdjustCurrentSongVolume(newVolume : number?, tweenVolume : boolean?, tweenTime : number?)

Adjusts the current song volume.

Arguments:

  • newVolume: number? : The volume you want to have.
  • tweenVolume : boolean? : If you want to tween the volume.
  • tweenTime : number? : The time you want the tween to take when tweening.

LoopCurrentSong()

function PlaylistModule:LoopCurrentSong()

Loops the current song that is playing.

UnLoopCurrentSong()

function PlaylistModule:UnLoopCurrentSong()

Unloops the current song that is playing.

ChangeCurrentSongTimePosition()

function PlaylistModule:ChangeCurrentSongTimePosition(newTimePosition : number, tweenTimePosition : boolean?, tweenTime : number?)

Adjusts the current song time position.

Arguments:

  • newTimePosition : number : The time position you want to have.
  • tweenTimePosition : boolean? : If you want to tween the time position.
  • tweenTime : number? : The time you want the tween to take when tweening.

AssignCurrentSongSoundGroup()

function PlaylistModule:AssignCurrentSongSoundGroup(soundGroup : SoundGroup)

Sets the current song to a sound group.

Arguments:

  • soundGroup : SoundGroup : The Sound Group you want to assign it to.

ChangeCurrentSongPlaybackSpeed()

function PlaylistModule:ChangeCurrentSongPlaybackSpeed(newPlaybackSpeed : number)	

Changes the current song play back speed.

Arguments:

  • newPlaybackSpeed : number : The playback speed you want to assign it to.

ChangeCurrentSongRollOffMode()

function PlaylistModule:ChangeCurrentSongRollOffMode(newRollOffMode : Enum)	

Changes the current song roll off mode.

Arguments:

  • newRollOffMode : Enum : The rolloffmode you want to assign it to.

ChangeCurrentSongRollOff()

function PlaylistModule:ChangeCurrentSongRollOff(rollOffMax : number, rollOffMin : number)

Changes the current song roll off min/max.

Arguments:

  • rollOffMax : number : The rolloffmax you want to assign it to.
  • rollOffMin : number : The rolloffmin you want to assign it to.

ChangeCurrentSongRollOff()

function PlaylistModule:ResetAllSongsToDefaultSettings(PlaylistName : string)

Changes the current song roll off min/max.

Arguments:

  • PlaylistName : string : The playlist name you want to reset sound settings for.

AddSong()

function PlaylistModule:AddSong(songID : string)

Adds a new song to the playlist (client sided)

Arguments:

  • songID : string : Song ID

Stop()

function PlaylistModule:Stop()

Stops the playlist.

Source Code :

Note :

Enjoy using the module, I hope it can help you in your projects.

Let me know if you find any bugs I will fix them right away.

9 Likes

Seems like a really nice module and I could maybe use it in my game. But I really think you should add events like “CurrentSongEnded” and stuff, and maybe an option so instead of having multiple sound instances you just switch a single sound’s ID and store the playlist in a table/dictionary with all the IDs and volumes (so it’s more performant and organized).

Anyhow, I really like the idea and module, keep up the good work!

1 Like

Will do that! Thank you so much for those suggestions, appreciate it.

1 Like

This is sweet, nice update with a demo that you can start off the bat and play with!

And double sweet on your demo song choice! Some grooving jams!

Also is the music that is heard only client side? Relates to items below, where a player can also add song ids

I few more ideas:

might be good to to just have small music icon that opens up, ether the big gui, or the mini below.

So that way you are saving screen space for the users game viewing area

Mini gui that just has ‘play > < skips… and expand to the bigger gui’ , Play toggles to pause

Bigger gui:
have the song id that is playing
maybe have the song title
have a input box where a song ID can be put in by the player

add data store so it saves the players list. (need to have a add and delete song too so they can customize their list)

Bonus:
Have like jam mixes that are selectable by the player
1 could be the players new list. Rest are pre programmed ID lists by the game dev … like 2 could be like jazz smooth jazz mix… 3 could be techno etc…
have so the mixes can have a title name.

Add volume control so the player can decrease increase

have a mute that mutes the song but not the games sounds Play button toggle to pause
have a pause button…

Just some thoughts

1 Like

I’m going to work on this right now; module will be updated soon! (yes the music is client sided)

1 Like

Instead of using a string to get the playlist folder, I think it would be nice to have another option to pass it an instance so we dont have to structure the code to have it as a child.

but pretty simple and nice module def using it