[FIXED] I need help creating instance sound to childrens. [SERVER SPEAKER]

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.
image

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
1 Like

To get the sound to come out of more than one part, I think you’ll need to use the new Audio Beta:
https://devforum.roblox.com/t/new-audio-api-beta-elevate-sound-and-voice-in-your-experiences/2848873

I don’t know why your loop stops after 2 songs, it looks right at first glance, I didn’t test it in studio.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.