Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

how would i make a2 play after a?

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

4 comments

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

0

a2 would work fine...

0

Yeah, a2 will just like normal.

0

Just play the sound in workspace. Place those sounds in workspace and try it.

1 answer

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.

This discussion is preserved as it was. New answers, comments, and votes are closed.