RobloxScripterAI
Discord ↗
Link Copied to Clipboard
×
"create music player and music playlist"
-- server script local musicPlayer = Instance.new("Sound", game.Workspace) local musicPlaylist = {} -- Add songs to the playlist table.insert(musicPlaylist, "rbxassetid://YourSongID1") table.insert(musicPlaylist, "rbxassetid://YourSongID2") table.insert(musicPlaylist, "rbxassetid://YourSongID3") -- Play the songs local currentSongIndex = 1 musicPlayer.SoundId = musicPlaylist[currentSongIndex] musicPlayer:Play() -- When the song finishes, play the next one musicPlayer.Ended:Connect(function() currentSongIndex = currentSongIndex 1 if currentSongIndex > #musicPlaylist then currentSongIndex = 1 end musicPlayer.SoundId = musicPlaylist[currentSongIndex] musicPlayer:Play() end)