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

How to make the script act AFTER the sound stops playing?

Asked by 9 years ago
wait(0.1)
ASong:Play()
wait(0.5)
BSong:Play()
wait(0.5)

When ASong plays, it plays for 0.5 seconds and just play BSong. How can I make it so the script waits for the song to finish up?

EDIT: This is the full script

ASong = script.Parent.Sound1
BSong = script.Parent.Sound2
CSong = script.Parent.Sound3
DSong = script.Parent.Sound4
ESong = script.Parent.Sound5
FSong = script.Parent.Sound6
GSong = script.Parent.Sound7

while true do
wait(0.1)
ASong:Play()
wait(0.5)
BSong:Play()
wait(0.5)
CSong:Play()
wait(0.5)
DSong:Play()
wait(0.5)
ESong:Play()
wait(0.5)
FSong:Play()
wait(0.5)
GSong:Play()
wait(0.5)
end

1 answer

Log in to vote
4
Answered by
BlastNet 250 Moderation Voter
9 years ago

You should take a look here: http://wiki.roblox.com/index.php?title=API:Class/Sound/Ended

Here's an example:

local music = workspace.Sound
music:Play()
music.Ended:connect(function()
-- code here
end)
0
This would work for single music, right? What about if there is more then one? BringMeTacos 20 — 9y
Ad

Answer this question