So I'm scripting a new game but for some reason when I call the event known as .Ended towards the sound it doesn't work! The code is located at the top of the script. I've even tried coroutines.
1 | script.Song.Ended:connect( function () |
2 | print ( "Song has ended!" ) |
3 | end ) |
In studio it works but ingame it doesnt. I am using a serverscript.
Just try this, after playing the song ,Song:Play(), add a wait(Song.SoundLength) It's probably not called .SoundLength but you can find what it's called in the properties. And then after the wait that's when the song has ended. Here's and example,
1 | Song = game.Workspace.SoundFolder:FindFirstChild( "MyLittlePonySong" ) |
2 | if not Song then return end |
3 | Song:Play() |
4 | wait(Song.SoundLength) -- like I said, it's probably not called sound length |
5 | print ( "Song has ended!" ) |
Hope I helped!