Hello, I am experiencing an error while programming a music script. I don't know how to make it loop but, I'm currentley experiencing an error when I am getting the music ID's from the module I made to store audio information. I will attach the scripts here:
local MusicModule = require(game.ServerScriptService.RestaurantFramework.Music.PlaylistModule)
local Music = game.ReplicatedStorage.Music
local isPlaying = false
function PlaySongs()
for i, SongFile in pairs(MusicModule.Playlist) do
isPlaying = true
Music.SoundId = ("rbxassetid://"..SongFile.ID)
Music.Volume = SongFile.VolumeLevel
Music:Play()
wait(SongFile.Length)
print(SongFile, "finished!")
isPlaying = false
end
end
PlaySongs()
This script errors with:
ServerScriptService.RestaurantFramework.Music.MusicScript:8: attempt to index number with 'ID'
My Module contains the following:
local PlaylistModule = {}
PlaylistModule.Playlist = {
{
Title = "Dance Monkey",
VolumeLevel = 1,
AudioLength = 150.386,
ID = 4517047588
},
Title = "Aku Suka Body Mama Muda Roblox",
VolumeLevel = 1,
AudioLength = 388.78,
ID = 4847222635
}
return PlaylistModule
Am I missing something because, they both try to run at the same time but, I want the songs to play one by and then play the next after its finished. Is there a method to achieve this? I'm also struggling to make it loop so, if anyone can help I'd appreciate it.
