Hello. I have a music script that plays three songs in a row, but after a while I end up with a lot of sound files in the workspace because they don't get removed when they are finished playing. This is a problem because who ever joins after a while will get all of the sounds playing at once. Here is my script:
while true do
local s1 = Instance.new("Sound")
s1.Name = "Sound1"
s1.SoundId = "http://www.roblox.com/asset/?id=162613575"
s1.Volume = 2 --SONG 1
s1.Pitch = 1
s1.Looped = false
s1.archivable = false
s1.Parent = game.Workspace
wait(0)
s1:play()
wait(120) --waits until the next song plays
local s2 = Instance.new("Sound")
s2.Name = "Sound2"
s2.SoundId = "http://www.roblox.com/asset/?id=162614272"
s2.Volume = 2
s2.Pitch = 1 --SONG 2
s2.Looped = false
s2.archivable = false
s2.Parent = game.Workspace
wait(0)
s2:play()
wait(120) --waits until the next song plays
local s3 = Instance.new("Sound")
s3.Name = "Sound3"
s3.SoundId = "http://www.roblox.com/asset/?id=162615529"
s3.Volume = 2
s3.Pitch = 1 --SONG 3
s3.Looped = false
s3.archivable = false
s3.Parent = game.Workspace
wait(0)
s3:play()
wait(120) --waits until the next song plays
s1:play()
end
I am wondering how I can remove the "Sound" object before a new one comes in. I have tried Workspace.Sound1:Destroy after each, just changing the number after what the object is called. Hopefully someone can help me.
