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

.Ended isn't working! How can I fix this?

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.

script.Song.Ended:connect(function()
print("Song has ended!")
end)

In studio it works but ingame it doesnt. I am using a serverscript.

3 comments

0

Squeaky

0

Hey Acheo, I didn't know you have an account on this site!

0

I just made it last night XD

1 answer

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,

Song = game.Workspace.SoundFolder:FindFirstChild("MyLittlePonySong")
if not Song then return end
Song:Play()
wait(Song.SoundLength) -- like I said, it's probably not called sound length
print("Song has ended!")

Hope I helped!

1 comment

0

I like this method, I'll try when I'm home.

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