Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Music script plays 3 songs then stops only happens in the actual game?

Ive made a music script for 6 Sounds in my game all have the same script they all play the same sounds at the same time. The first three sounds play but after that they stop working. it works in studio but not in the actual game.

--Script Code-- for all 6 scripts

while true do
	--Openning Act - Marshmello--
	wait(300)
	script.Parent.SoundId = "rbxassetid://2842091118"
	script.Parent.TimePosition = 0
	script.Parent.PlaybackSpeed = 1
	script.Parent:Play()
	wait(77.22)
	script.Parent.SoundId = "rbxassetid://536049623"
	script.Parent.TimePosition = 0
	script.Parent.PlaybackSpeed = 1
	script.Parent:Play()
	wait(5)
	script.Parent.Parent.Parent.TextScreen1.SurfaceGui.TextLabel.Text = "Marshmello"
	script.Parent.Parent.Parent.TextScreen2.SurfaceGui.TextLabel.Text = "Marshmello"
	wait(194.55)
	script.Parent.SoundId = "rbxassetid://2009121244"
	script.Parent.TimePosition = 0
	script.Parent.PlaybackSpeed = 1
	script.Parent:Play()
	wait(177.66)
	script.Parent.SoundId = "rbxassetid://1224413857"
	script.Parent.TimePosition = 0
	script.Parent.PlaybackSpeed = 1
	script.Parent:Play()
	wait(120)
	script.Parent.SoundId = "rbxassetid://1992476684"
	script.Parent.TimePosition = 0
	script.Parent.PlaybackSpeed = 1
	script.Parent:Play()
	wait(158)
	script.Parent.SoundId = "rbxassetid://2231029439"
	script.Parent.TimePosition = 0
	script.Parent.PlaybackSpeed = 0.9
	script.Parent:Play()
	wait(220)
	--Performance Break--
	script.Parent.SoundId = "rbxassetid://1119872534"
	script.Parent.TimePosition = 0
	script.Parent.PlaybackSpeed = 1
	script.Parent:Play()
	wait(108.23)
	--Ariana Grande--
	script.Parent.SoundId = "rbxassetid://2203053377"
	script.Parent.TimePosition = 0
	script.Parent.PlaybackSpeed = 0.9
	script.Parent:Play()
	wait(20)
	script.Parent.Parent.Parent.TextScreen1.SurfaceGui.TextLabel.Text = "Ariana Grande"
	script.Parent.Parent.Parent.TextScreen2.SurfaceGui.TextLabel.Text = "Ariana Grande"
	script.Parent.SoundId = "rbxassetid://2776127492"
	script.Parent.TimePosition = 0
	script.Parent.PlaybackSpeed = 1
	script.Parent:Play()
	wait(236.36)
	script.Parent.SoundId = "rbxassetid://2203053377"
	script.Parent.TimePosition = 0
	script.Parent.PlaybackSpeed = 0.9
	script.Parent:Play()
	wait(218.15)
	script.Parent.SoundId = "rbxassetid://3030656816"
	script.Parent.TimePosition = 0
	script.Parent.PlaybackSpeed = 1
	script.Parent:Play()
	wait(168.55)
	script.Parent.SoundId = "rbxassetid://2832218038"
	script.Parent.TimePosition = 0
	script.Parent.PlaybackSpeed = 1
	script.Parent:Play()
	wait(192.5)
	script.Parent.SoundId = "rbxassetid://422549464"
	script.Parent.TimePosition = 0
	script.Parent.PlaybackSpeed = 0.75
	script.Parent:Play()
	wait(160)
	script.Parent.SoundId = "rbxassetid://2833182578"
	script.Parent.TimePosition = 0
	script.Parent.PlaybackSpeed = 1
	script.Parent:Play()
	wait(239.23)
	script.Parent.SoundId = "rbxassetid://2071829884"
	script.Parent.TimePosition = 0
	script.Parent.PlaybackSpeed = 0.92
	script.Parent:Play()
	wait(185)
	--Performance Break--
	script.Parent.SoundId = "rbxassetid://339723165"
	script.Parent.TimePosition = 0
	script.Parent.PlaybackSpeed = 1
	script.Parent:Play()
	wait(107)
	--PBillie Eilish--
	script.Parent.SoundId = "rbxassetid://3015811673"
	script.Parent.TimePosition = 0
	script.Parent.PlaybackSpeed = 0.85
	script.Parent:Play()
	wait(5)
	script.Parent.Parent.Parent.TextScreen1.SurfaceGui.TextLabel.Text = "Billie Eilish"
	script.Parent.Parent.Parent.TextScreen2.SurfaceGui.TextLabel.Text = "Billie Eilish"
	wait(122.9)
	script.Parent.SoundId = "rbxassetid://3111781839"
	script.Parent.TimePosition = 0
	script.Parent.PlaybackSpeed = 0.95
	script.Parent:Play()
	wait(91.74)
	script.Parent.SoundId = "rbxassetid://2053012994"
	script.Parent.TimePosition = 0
	script.Parent.PlaybackSpeed = 1
	script.Parent:Play()
	wait(197.93)
	script.Parent.SoundId = "rbxassetid://3019378745"
	script.Parent.TimePosition = 0
	script.Parent.PlaybackSpeed = 0.83
	script.Parent:Play()
	wait(116)
	--Performance Break--
	script.Parent.SoundId = "rbxassetid://718105109"
	script.Parent.TimePosition = 0
	script.Parent.PlaybackSpeed = 1
	script.Parent:Play()
	wait(229.38)
	script.Parent.SoundId = "rbxassetid://3109400449"
	script.Parent.TimePosition = 0
	script.Parent.PlaybackSpeed = 0.835
	script.Parent:Play()
	wait(181)
	--Beyonce--
	script.Parent.SoundId = "rbxassetid://426645887"
	script.Parent.TimePosition = 0
	script.Parent.PlaybackSpeed = 1
	script.Parent:Play()
	wait(5)
	script.Parent.Parent.Parent.TextScreen1.SurfaceGui.TextLabel.Text = "Beyonce"
	script.Parent.Parent.Parent.TextScreen2.SurfaceGui.TextLabel.Text = "Beyonce"
	wait(74.89)
	script.Parent.SoundId = "rbxassetid://156549348"
	script.Parent.TimePosition = 0
	script.Parent.PlaybackSpeed = 0.97
	script.Parent:Play()
	wait(80)
	script.Parent.SoundId = "rbxassetid://2525021359"
	script.Parent.TimePosition = 0
	script.Parent.PlaybackSpeed = 0.825
	script.Parent:Play()
	wait(200)
	--End Of Performances--
	script.Parent.SoundId = "rbxassetid://2135469266"
	script.Parent.TimePosition = 0
	script.Parent.PlaybackSpeed = 0.8
	script.Parent:Play()
	wait(150)
	script.Parent.SoundId = "rbxassetid://1712709123"
	script.Parent.TimePosition = 0
	script.Parent.PlaybackSpeed = 1
	script.Parent:Play()
	wait(32.14)
	--Lady Gaga--
	script.Parent.SoundId = "rbxassetid://2656278701"
	script.Parent.TimePosition = 0
	script.Parent.PlaybackSpeed = 0.92
	script.Parent:Play()
	wait(5)
	script.Parent.Parent.Parent.TextScreen1.SurfaceGui.TextLabel.Text = "Lady Gaga"
	script.Parent.Parent.Parent.TextScreen2.SurfaceGui.TextLabel.Text = "Lady Gaga"
	wait(193)
	script.Parent.SoundId = "rbxassetid://2557749379"
	script.Parent.TimePosition = 0
	script.Parent.PlaybackSpeed = 0.835
	script.Parent:Play()
	wait(252)
	--Anne Marrie--
	script.Parent.SoundId = "rbxassetid://1961444910"
	script.Parent.TimePosition = 0
	script.Parent.PlaybackSpeed = 0.9
	script.Parent:Play()
	wait(5)
	script.Parent.Parent.Parent.TextScreen1.SurfaceGui.TextLabel.Text = "Anne Marrie"
	script.Parent.Parent.Parent.TextScreen2.SurfaceGui.TextLabel.Text = "Anne Marrie"
	wait(184)
	--Miley Cyrus--
	script.Parent.SoundId = "rbxassetid://2232401721"
	script.Parent.TimePosition = 0
	script.Parent.PlaybackSpeed = 0.8
	script.Parent:Play()
	wait(5)
	script.Parent.Parent.Parent.TextScreen1.SurfaceGui.TextLabel.Text = "Miley Cyrus"
	script.Parent.Parent.Parent.TextScreen2.SurfaceGui.TextLabel.Text = "Miley Cyrus"
	wait(204)
	script.Parent.SoundId = "rbxassetid://2503005120"
	script.Parent.TimePosition = 0
	script.Parent.PlaybackSpeed = 0.9
	script.Parent:Play()
	wait(195)
	script.Parent.SoundId = "rbxassetid://3063825391"
	script.Parent.TimePosition = 0
	script.Parent.PlaybackSpeed = 0.91
	script.Parent:Play()
	wait(222.52)
	script.Parent:Stop()
end

2 answers

✓ Accepted answer

I think some of your audio might be content deleted. Either way, I made a script that should make things easier for you. You can put all your songs in to songstList and specify stuff like the artist name, the pitch, the volume, etc and they will all play in order. Waiting all the time can be unreliable

audioObject = script.Parent

songsList = {
	{SongId = "2842091118", ArtistName = "ArtistNameHere", PlayBackSpeed = 1, Volume = 1, CallIntermission = false, IntermissionTime = 0},
	{SongId = "2842091118", ArtistName = "ArtistNameHere", PlayBackSpeed = 1, Volume = 1, CallIntermission = false, IntermissionTime = 0},
}

function playSong(song)
	--Location of text you want to change.Text = song.ArtistName

	audioObject.SoundId = "rbxassetid://" .. tostring(song.SongId)
	audioObject.PlaybackSpeed = song.PlayBackSpeed
	audioObject.Volume = song.Volume
	audioObject:Play()
	wait(audioObject.TimeLength)
end

while true do
	for i, song in ipairs(songsList) do
		if(song.CallIntermisson == false)then
			playSong(song)
		else
			wait(song.IntermissionTime)
			playSong(song)
		end
	end
end

7 comments

0

Ok great thank you ill give it a try

0

I tried it and the songs don't play in order and also don't play at the correct pitch/playback that I have put in

0

May I see how you put it in songsList?

0

i just checked and the script is playing in order. it's just that for some reason it shows the first song's length as 0

0

yeah, it's actually working fine. just when you play a song, it takes a second for roblox to get it's properties. i think you might be putting the songs out of order in the songsList list can i please see your code to make sure?

0

Sure

0

I made another answer with my script in it as the comments wouldn't let me post is

Here is the script with all the songs in there

  audioObject = script.Parent
	 
	songsList = {
	    {SongId = "2842091118", ArtistName = "M", PlayBackSpeed = 1, Volume = 1, CallIntermission = false, IntermissionTime = 300},
	    {SongId = "536049623", ArtistName = "Ma", PlayBackSpeed = 1, Volume = 1, CallIntermission = false, IntermissionTime = 0},
	    {SongId = "2009121244", ArtistName = "Mar", PlayBackSpeed = 1, Volume = 1, CallIntermission = false, IntermissionTime = 0},
	    {SongId = "1224413857", ArtistName = "Mars", PlayBackSpeed = 1, Volume = 1, CallIntermission = false, IntermissionTime = 0},
	    {SongId = "1992476684", ArtistName = "Marsh", PlayBackSpeed = 1, Volume = 1, CallIntermission = false, IntermissionTime = 0},
	    {SongId = "2231029439", ArtistName = "Marshmello", PlayBackSpeed = 0.9, Volume = 1, CallIntermission = false, IntermissionTime = 0},
	    {SongId = "1119872534", ArtistName = "Intermision", PlayBackSpeed = 1, Volume = 1, CallIntermission = false, IntermissionTime = 0},
	    {SongId = "2203053377", ArtistName = "Ariana", PlayBackSpeed = 0.9, Volume = 1, CallIntermission = false, IntermissionTime = 0},
	    {SongId = "2776127492", ArtistName = "A", PlayBackSpeed = 1, Volume = 1, CallIntermission = false, IntermissionTime = 0},
	    {SongId = "2203053377", ArtistName = "Ar", PlayBackSpeed = 0.9, Volume = 1, CallIntermission = false, IntermissionTime = 0},
	    {SongId = "3030656816", ArtistName = "Ari", PlayBackSpeed = 1, Volume = 1, CallIntermission = false, IntermissionTime = 0},
	    {SongId = "2832218038", ArtistName = "Aria", PlayBackSpeed = 1, Volume = 1, CallIntermission = false, IntermissionTime = 0},
	    {SongId = "422549464", ArtistName = "Arian", PlayBackSpeed = 0.75, Volume = 1, CallIntermission = false, IntermissionTime = 0},
	    {SongId = "2833182578", ArtistName = "Arianag", PlayBackSpeed = 1, Volume = 1, CallIntermission = false, IntermissionTime = 0},
	    {SongId = "2071829884", ArtistName = "Arianagr", PlayBackSpeed = 0.92, Volume = 1, CallIntermission = false, IntermissionTime = 0},
	    {SongId = "339723165", ArtistName = "Intermision", PlayBackSpeed = 0.9, Volume = 1, CallIntermission = false, IntermissionTime = 0},
	    {SongId = "3015811673", ArtistName = "Bi", PlayBackSpeed = 0.85, Volume = 1, CallIntermission = false, IntermissionTime = 0},
	    {SongId = "3111781839", ArtistName = "Bill", PlayBackSpeed = 0.9, Volume = 1, CallIntermission = false, IntermissionTime = 0},
	    {SongId = "2053012994", ArtistName = "Billi", PlayBackSpeed = 1, Volume = 1, CallIntermission = false, IntermissionTime = 0},
	    {SongId = "3019378745", ArtistName = "Billie", PlayBackSpeed = 0.3, Volume = 1, CallIntermission = false, IntermissionTime = 0},
	    {SongId = "718105109", ArtistName = "Intermision", PlayBackSpeed = 1, Volume = 1, CallIntermission = false, IntermissionTime = 0},
	    {SongId = "3109400449", ArtistName = "Intermision", PlayBackSpeed = 0.835, Volume = 1, CallIntermission = false, IntermissionTime = 0},
	    {SongId = "426645887", ArtistName = "Bey", PlayBackSpeed = 1, Volume = 1, CallIntermission = false, IntermissionTime = 0},
	    {SongId = "156549348", ArtistName = "Beyon", PlayBackSpeed = 0.97, Volume = 1, CallIntermission = false, IntermissionTime = 0},
	    {SongId = "2525021359", ArtistName = "Beyonce", PlayBackSpeed = 0.825, Volume = 1, CallIntermission = false, IntermissionTime = 0},
	    {SongId = "2135469266", ArtistName = "Intermision", PlayBackSpeed = 0.8, Volume = 1, CallIntermission = false, IntermissionTime = 0},
	    {SongId = "1712709123", ArtistName = "Intermision", PlayBackSpeed = 1, Volume = 1, CallIntermission = false, IntermissionTime = 0},
	    {SongId = "2656278701", ArtistName = "Ga", PlayBackSpeed = 0.92, Volume = 1, CallIntermission = false, IntermissionTime = 0},
	    {SongId = "2557749379", ArtistName = "Gaga", PlayBackSpeed = 0.835, Volume = 1, CallIntermission = false, IntermissionTime = 0},
	    {SongId = "1961444910", ArtistName = "Anne", PlayBackSpeed = 0.9, Volume = 1, CallIntermission = false, IntermissionTime = 0},
	    {SongId = "2232401721", ArtistName = "Mi", PlayBackSpeed = 0.8, Volume = 1, CallIntermission = false, IntermissionTime = 0},
	    {SongId = "2503005120", ArtistName = "Mile", PlayBackSpeed = 0.9, Volume = 1, CallIntermission = false, IntermissionTime = 0},
	    {SongId = "3063825391", ArtistName = "Miley", PlayBackSpeed = 0.91, Volume = 1, CallIntermission = false, IntermissionTime = 0},
	    
	}
	 
	function playSong(song)
	    --Location of text you want to change.Text = song.ArtistName
	 
	    audioObject.SoundId = "rbxassetid://" .. tostring(song.SongId)
	    audioObject.PlaybackSpeed = song.PlayBackSpeed
	    audioObject.Volume = song.Volume
	    audioObject:Play()
	    wait(audioObject.TimeLength)
	end
	 
	while true do
	    for i, song in ipairs(songsList) do
	        if(song.CallIntermisson == false)then
	            playSong(song)
	        else
	            wait(song.IntermissionTime)
	            playSong(song)
	        end
	    end
end

1 comment

0

The names of the artist are weird as I though maybe as the artist was the same it went to the next artist but I was wrong

This discussion is preserved as it was. New answers, comments, and votes are closed.