Okay the title seems complicated,but I will tell you explanation now! So how would I make that after the music stops playing it goes onto another one!And again,again,again and again.
Very noob at scripting but do I need to change something here?
local s = Instance.new("Sound") s.Name = "Sound" s.SoundId = "http://www.roblox.com/asset/?id=I know I put the ID here" s.Volume = 0.1 s.Pitch = 1 s.Looped = true s.archivable = false s.Parent = game.Workspace wait(0) s:play() wait(15) local s = Instance.new("Sound") s.Name = "Sound" s.SoundId = "http://www.roblox.com/asset/?id=Again,I know I put the ID here!" s.Volume = 0.1 s.Pitch = 1 s.Looped = true s.archivable = false s.Parent = game.Workspace wait(0) s:play()
I know I did two playing,but is that it?OR differently?
Please help!And Merry Christmas to all :D!!! Thank You!
Merry Christmas (even though I don't celebrate this).
local s = Instance.new("Sound") s.Name = "Sound" s.SoundId = "http://www.roblox.com/asset/?id=I know I put the ID here" s.Volume = 0.1 s.Pitch = 1 s.Looped = true s.archivable = false s.Parent = game.Workspace wait(0) s:play() wait(1) if not s.Playing==true then local s = Instance.new("Sound") s.Name = "Sound" s.SoundId = "http://www.roblox.com/asset/?id=Again,I know I put the ID here!" s.Volume = 0.1 s.Pitch = 1 s.Looped = true s.archivable = false s.Parent = game.Workspace wait(0) s:play() end s:play()
That should do it.
You should have a table that have all the sounds and its properties:
local Sounds = { Sound1 = { Name = "Name Here", Id = "http://www.roblox.com/asset/?id=I know I put the ID here", }, Sound2 = { Name = "Name Here", Id = "http://www.roblox.com/asset/?id=I know I put the ID here", } )
And make a loop that do of some what ElVolKo said.
while wait(0.01) do -- Loops over and over if SoundLocation:Playing ~= true then -- SoundLocation is for you to put where to Sound Object is located. Also this check if the music is playing. local SoundNumber = math.random(1, #Sounds) -- Select a random sound SoundLocation.Name = Sounds[SoundNumber][1] -- Put in the name SoundLocation.SoundId = Sounds[SoundNumber][2] -- Change the Id SoundLocation:Play() end end
Putting it all together should be like this:
local Sounds = { Sound1 = { Name = "Name Here", Id = "http://www.roblox.com/asset/?id=I know I put the ID here", }, Sound2 = { Name = "Name Here", Id = "http://www.roblox.com/asset/?id=I know I put the ID here", } ) while wait(0.01) do if SoundLocation:Playing ~= true then -- SoundLocation is for you to put where to Sound Object is located. local SoundNumber = math.random(1, #Sounds) SoundLocation.Name = Sounds[SoundNumber][1] -- Put in the name SoundLocation.SoundId = Sounds[SoundNumber][2] -- Change the Id SoundLocation:Play() end end