Still have questions? Join our Discord server and get real time help.
0

# how do you make a function onStopped?

NotSoNorm 772
6 years ago

Is there a way that I can get an event to trigger if the sound is not playing anymore?

while true do
wait(1)
if script.Parent.Sound.IsPlaying then
script.Parent.Parent.SongPlayNoter.Visible = true
script.Parent.Parent.ScrollingFrame.Visible = false

elseif script.Parent.Sound.IsPaused then
script.Parent.Parent.ScrollingFrame.Visible = true
script.Parent.Parent.SongPlayNoter.Visible = false
end
end


0
Tesouro 407
6 years ago

You can use Changed event instead of a loop.

sound = script.Parent.Sound -- the sound
function changed() -- every time a property of sound changes, this function runs.
if  sound.IsPlaying == false then -- checks if the sound isn't playing anymore (it stopped)
-- CODE
end
end
sound.Changed:connect(changed)