so i've got a script here, i'm trying to get it to play two songs the first one being a and the second one being a2. the problem is that a is the only one that plays then it stops and doesnt loop or play a2. i've tried multiple things and i still can't seem to figure it out. help anyone? (NOTE: this script runs through serverscriptservice and has filtering enabled.)
local a = game.SoundService.a local a2 = game.SoundService.a2 while true do wait() a.Playing = true a.Ended:wait() a2.Playing = true a2.Ended:wait() end
local a = game.SoundService.a local a2 = game.SoundService.a2 a.Looped = false a2.Looped = false bool = true part = script.Parent -- I'm assuming that you have your script in a part, so... function onTouch() if bool == false then return end bool = false if part:FindFirstChild("Humanoid") ~= nil then a:Play() if a.IsPlaying ~= true then a2:Play() if a2.IsPlaying ~= true then end end end wait(10) bool = true end part.Touched:connect(onTouch)
I'll tell you right now that using the Ended property of a Sound object combined with the wait() function will not work in a while true do loop because those loops keep going and going and it will want to play the second audio without waiting. I rewrote your script so that a Player can touch a button to play the two, with "a" being first.