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

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

Asked by
Acheo 230 Moderation Voter
8 years ago

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.

0
Squeaky CailThePuppy 70 — 8y
0
Hey Acheo, I didn't know you have an account on this site! M39a9am3R 3210 — 8y
0
I just made it last night XD Acheo 230 — 8y

1 answer

Log in to vote
0
Answered by 8 years ago

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!

0
I like this method, I'll try when I'm home. Acheo 230 — 8y
Ad

Answer this question