With the current Sound implementation on ROBLOX, we are lacking a system which lets us accurately determine if a sound is playing (or get its length). To create a soundtrack right now, you must use ContentProvider.Preload to load your sounds, and then make a note of the length of every track. Then you need to play the sound, wait the appropriate length, and then stop the sound, and play the next one.
Something like this:
local SoundObject = Workspace.Part.Sound
local Sounds = {
{id=1234, length=50},
{id=5678, length=20}
}
while true do
for _, sound in ipairs(Sounds) do
SoundObject:Stop()
SoundObject.SoundId = "rbxassetid://" .. sound.id
SoundObject:Play()
wait(sound.length + 2)
end
end
1 comment
This IsPlaying property doesn't turn to false when the sound stops playing naturally, only when you call :Stop() on it.