Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

how would i make a2 play after a?

Asked by
uuoc 0
6 years ago
Edited 6 years ago

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
0
you can't use number or any simbol in string or ver so just use text, don't use a2 you can use b TheSkyofIndia 150 — 6y
0
a2 would work fine... theCJarmy7 1293 — 6y
0
Yeah, a2 will just like normal. FazNook 61 — 6y
0
Just play the sound in workspace. Place those sounds in workspace and try it. FazNook 61 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago
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.

Ad

Answer this question