I’m not that pro in scripting, can someone help. My objective is to make a server speaker music.
My first error is sound created in just one sound part instead of four.
My second error is after playing two music it’s stop, I don’t know how do I loop this everytime music ended.
local musicList = {1846669558, 1841488840, 903893442, 1837917934}
local currentTrack = 1
local sound = nil
local function playMusic()
sound = Instance.new("Sound")
sound.Name = "SoundControl"
sound.Parent = game.Workspace.SpeakersControl.Speakers.SoundPart
sound.Volume = 1
sound.Playing = true
sound.SoundId = "rbxassetid://"..musicList[currentTrack]
sound.Ended:Connect(function()
sound:Destroy()
currentTrack = currentTrack + 1
if currentTrack > #musicList then
currentTrack = 1
end
playMusic()
end)
end
playMusic() -- play the music initially