|
| 20 Dec 2015 01:13 PM |
Is Sound.Stopped triggered when a song ends? How do you detect if a song ends?
|
|
|
| Report Abuse |
|
|
|
| 20 Dec 2015 01:15 PM |
| http://wiki.roblox.com/index.php?title=API:Class/Sound/Ended |
|
|
| Report Abuse |
|
|
|
| 20 Dec 2015 01:24 PM |
Why doesn't this work then?
local musiclist = {"163211519","236896548","144419442","161534079","235855135","143959455","283801001","313694441","291168836","228676342",""}--Insert IDs of songs here. local lastplayed = 0 while true do local randomsong = math.random(#musiclist) repeat randomsong = math.random(#musiclist) until musiclist[randomsong] ~= lastplayed --Makes sure that the random song isn't the same as the one that's just been played. lastplayed = musiclist[randomsong] script.Parent.SoundId = ("http://www.roblox.com/asset/?id="..musiclist[randomsong]) script.Parent:Play() local waituntilsoundends = false script.Parent.Music.Ended:connect(function() waituntilsoundends = true end) repeat wait(0.6) until waituntilsoundends == true end
|
|
|
| Report Abuse |
|
|
|
| 20 Dec 2015 01:30 PM |
| It never detects the song's end. |
|
|
| Report Abuse |
|
|
|
| 20 Dec 2015 01:31 PM |
I don't think the event fires on the server-side. Are you using a LocalScript?
|
|
|
| Report Abuse |
|
|
|
| 20 Dec 2015 01:34 PM |
| No. I've tried using a local script and it did detect the end, but I don't know where to put the local script. If I put it in the music and local script inside the playergui, it wouldn't be the same song throughout the server and the music and the script will be respawned if the player dies. |
|
|
| Report Abuse |
|
|
|
| 20 Dec 2015 01:39 PM |
| I really don't care if the songs are synchronized or not, but I have no idea where to put the local script. |
|
|
| Report Abuse |
|
|
|
| 20 Dec 2015 01:56 PM |
Yikes, I hate situations like this. One thing you could do, is just look at the TimeLength property and record it as a variable for each sound, then just call wait with that length. |
|
|
| Report Abuse |
|
|
|
| 20 Dec 2015 02:04 PM |
| Well TimeLength is glitched in servers so that won't work. I think I've figured out a way. I'm gonna test it. So basically, local scripts inside players can detect if the Workspace music ends. Then you can use remote events to communicate. |
|
|
| Report Abuse |
|
|
| |
|