generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Quick Question

Previous Thread :: Next Thread 
Crazy010517 is not online. Crazy010517
Joined: 17 Sep 2011
Total Posts: 1161
20 Dec 2015 01:13 PM
Is Sound.Stopped triggered when a song ends?
How do you detect if a song ends?
Report Abuse
SonyController is not online. SonyController
Joined: 10 Jan 2011
Total Posts: 176
20 Dec 2015 01:15 PM
http://wiki.roblox.com/index.php?title=API:Class/Sound/Ended
Report Abuse
Crazy010517 is not online. Crazy010517
Joined: 17 Sep 2011
Total Posts: 1161
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
Crazy010517 is not online. Crazy010517
Joined: 17 Sep 2011
Total Posts: 1161
20 Dec 2015 01:30 PM
It never detects the song's end.
Report Abuse
CloneTrooper1019 is not online. CloneTrooper1019
Joined: 19 Jan 2009
Total Posts: 6227
20 Dec 2015 01:31 PM
I don't think the event fires on the server-side.
Are you using a LocalScript?
Report Abuse
Crazy010517 is not online. Crazy010517
Joined: 17 Sep 2011
Total Posts: 1161
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
Crazy010517 is not online. Crazy010517
Joined: 17 Sep 2011
Total Posts: 1161
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
CloneTrooper1019 is not online. CloneTrooper1019
Joined: 19 Jan 2009
Total Posts: 6227
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
Crazy010517 is not online. Crazy010517
Joined: 17 Sep 2011
Total Posts: 1161
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
Crazy010517 is not online. Crazy010517
Joined: 17 Sep 2011
Total Posts: 1161
20 Dec 2015 05:49 PM
^^^
IT WORKED!!!
BOOM!
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image