how to make a playlist in the world that everybody hear the same song? i'd like that for a club, thanks! <3
COMMUNITY QUESTION
how to make a playlist in the world that everybody hear the same song?
1 answer
local Song = 0
local Currentsong
local Debounce = 0
local Playlist = { --A table to store the playlist
[1] = "Song1", --Insert song name here
[2] = "Song2", --Insert song name here
}
function StartNextSong()
if Song == #Playlist then -- looks if the playlist is over
Song = 1
Currentsong = script.Parent.Music:FindFirstChild(Playlist[Song]) --Finds the current song
Currentsong.Playing = true --Starts the current song
print ("Now Playing: "..Playlist[Song])
wait (1)
Debounce = 0
elseif Song ~= #Playlist then
Song = Song + 1
Currentsong = script.Parent.Music:FindFirstChild(Playlist[Song]) --Finds the current song
Currentsong.Playing = true --Starts the current song
print ("Now Playing: "..Playlist[Song])
wait (1)
Debounce = 0
end
end
function EndCurrentSong()
Debounce = Debounce + 1
if Debounce == 1 then
Currentsong = script.Parent.Music:FindFirstChild(Playlist[Song]) --Finds the current song
Currentsong.Playing = false --Stops the current song
StartNextSong()
end
end
StartNextSong() --Starts playlist
wait ()
while true do
wait (0.1)
Currentsong = script.Parent.Music:FindFirstChild(Playlist[Song])
Currentsong.Ended:Connect(EndCurrentSong)
end
Here is the script. The explanation is in the script.
The script must be in a folder called MusicPlaylist, which contains a folder named Music.
The song name in the playlist must be the same as the name in the folder
1 comment
0
Btw i dont know if this is the best method
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
This site is not a request site. Include your attempt for help.