IoIiderp
|
  |
| Joined: 05 Feb 2012 |
| Total Posts: 8613 |
|
|
| 09 Mar 2016 06:52 AM |
| No events ever seem to fire... |
|
|
| Report Abuse |
|
|
Graidlyz
|
  |
| Joined: 25 Dec 2011 |
| Total Posts: 13357 |
|
|
| 09 Mar 2016 06:58 AM |
Sound.IsPlaying or somethin
|
|
|
| Report Abuse |
|
|
Graidlyz
|
  |
| Joined: 25 Dec 2011 |
| Total Posts: 13357 |
|
|
| 09 Mar 2016 07:02 AM |
you mean, when you stop the sound, or when it ends?
also i misread, i thought you wanted to check if a sound is playing
|
|
|
| Report Abuse |
|
|
jplt
|
  |
| Joined: 29 Apr 2012 |
| Total Posts: 17 |
|
|
| 09 Mar 2016 07:18 AM |
| SoundInstance.Stopped:connect() |
|
|
| Report Abuse |
|
|
IoIiderp
|
  |
| Joined: 05 Feb 2012 |
| Total Posts: 8613 |
|
|
| 09 Mar 2016 07:26 AM |
I have a song, and it once it ends it needs to play a random song.
@jp .Stopped only fires in studio
@Grai Even when the song ended it still thinks its playing |
|
|
| Report Abuse |
|
|
jplt
|
  |
| Joined: 29 Apr 2012 |
| Total Posts: 17 |
|
|
| 09 Mar 2016 07:29 AM |
| Oops, I meant SoundInstance.Ended:connect() |
|
|
| Report Abuse |
|
|
IoIiderp
|
  |
| Joined: 05 Feb 2012 |
| Total Posts: 8613 |
|
|
| 09 Mar 2016 07:33 AM |
@jp .Ended also doesn't fire... |
|
|
| Report Abuse |
|
|
Graidlyz
|
  |
| Joined: 25 Dec 2011 |
| Total Posts: 13357 |
|
|
| 09 Mar 2016 07:35 AM |
well, there's another way to play a sound when the last one ended but it looks ugly imo,
sound:Play() wait(sound.TimeLength) othersound:Play() wait(othersound.TimeLength)
|
|
|
| Report Abuse |
|
|
jplt
|
  |
| Joined: 29 Apr 2012 |
| Total Posts: 17 |
|
|
| 09 Mar 2016 07:39 AM |
Or something like: repeat wait() until SoundInstance.TimePosition == SoundInstance.TimeLength |
|
|
| Report Abuse |
|
|
IoIiderp
|
  |
| Joined: 05 Feb 2012 |
| Total Posts: 8613 |
|
|
| 09 Mar 2016 07:58 AM |
| Okay thanks ill do that, but then I will also have to make a custom :Stop() function. |
|
|
| Report Abuse |
|
|
jplt
|
  |
| Joined: 29 Apr 2012 |
| Total Posts: 17 |
|
|
| 09 Mar 2016 08:01 AM |
| Why, you can just use SoundInstance:Stop()? |
|
|
| Report Abuse |
|
|
IoIiderp
|
  |
| Joined: 05 Feb 2012 |
| Total Posts: 8613 |
|
|
| 09 Mar 2016 08:04 AM |
| Because then the wait will continue... |
|
|
| Report Abuse |
|
|
jplt
|
  |
| Joined: 29 Apr 2012 |
| Total Posts: 17 |
|
|
| 09 Mar 2016 08:12 AM |
| When you use repeat like mine it will stop waiting when its ended |
|
|
| Report Abuse |
|
|
IoIiderp
|
  |
| Joined: 05 Feb 2012 |
| Total Posts: 8613 |
|
|
| 09 Mar 2016 08:16 AM |
TimePosition stays on 0 when you play the game... Also seems like I didn't need the custom Stop() function |
|
|
| Report Abuse |
|
|
IoIiderp
|
  |
| Joined: 05 Feb 2012 |
| Total Posts: 8613 |
|
|
| 09 Mar 2016 08:17 AM |
Okay thanks everyone I got it working, the script:
math.randomseed(tick()) dela = true local music = {"143959455", "130762736", "142435409"} local midi;
wait()
function fireMusic() if dela then dela = false wait() midi = music[math.random(1,#music)] script.Parent.SoundId = "rbxassetid://" .. midi script.Parent:Play() local mmu = game:GetService("MarketplaceService"):GetProductInfo(midi) local mmun = mmu.Name local h = Instance.new("Hint", game.Workspace) h.Text = mmun game:GetService("Debris"):AddItem(h, 4) wait(script.Parent.TimeLength) script.Parent:Stop() dela = true wait() fireMusic() end end
fireMusic() |
|
|
| Report Abuse |
|
|
IoIiderp
|
  |
| Joined: 05 Feb 2012 |
| Total Posts: 8613 |
|
|
| 09 Mar 2016 08:19 AM |
| And doesn't work in online mode... |
|
|
| Report Abuse |
|
|
IoIiderp
|
  |
| Joined: 05 Feb 2012 |
| Total Posts: 8613 |
|
|
| 09 Mar 2016 08:20 AM |
| I know why it doesn't work... TimeLength stays on 0 |
|
|
| Report Abuse |
|
|
IoIiderp
|
  |
| Joined: 05 Feb 2012 |
| Total Posts: 8613 |
|
| |
|
IoIiderp
|
  |
| Joined: 05 Feb 2012 |
| Total Posts: 8613 |
|
| |
|
|
| 09 Mar 2016 12:03 PM |
DegradeSpeed = 1 Clock = Sound.TimeLength
repeat wait(DegradeSpeed) Clock = Clock - 1 until ClockedAt == 0 |
|
|
| Report Abuse |
|
|
IoIiderp
|
  |
| Joined: 05 Feb 2012 |
| Total Posts: 8613 |
|
|
| 09 Mar 2016 12:04 PM |
@xSpec TimeLength is broken and returns 0 no matter what. |
|
|
| Report Abuse |
|
|
|
| 09 Mar 2016 12:14 PM |
Alright, give me a bit, this is not hard to fix. |
|
|
| Report Abuse |
|
|
|
| 09 Mar 2016 12:26 PM |
Do this instead, just type in the TimeLength to the tables, I for now just wrote whatever. If you want to expand on the options and if statements let me know.
SoundLibrary = { ['Menu'] = {false,234,0} ['Click'] = {false,432,0} -- ['Name'] = {IsPlaying,TimeLength,CurrentTime} -- Type these MANUALLY! }
TimeTable
MusicList = PlayerGui.Folder Track = MusicList.Menu
function PlayTrack(Track) SoundLibrary[Track.Name][1] = true SoundLibrary[Track.Name][3] = SoundLibrary[Track.Name][1] Track:Play() end
function TrackManager() for TrackSelected = 1,#MusicList:GetChildren() do if SoundLibrary[TrackSelected.Name][3] ~= 0 then SoundLibrary[TrackSelected.Name][3] = SoundLibrary[TrackSelected.Name][3] - 1 end end
I typed the majority of it on here so you may need to clean some parts of it up, the general idea is there.
|
|
|
| Report Abuse |
|
|
|
| 09 Mar 2016 12:27 PM |
-- FIX
function TrackManager() for TrackSelected = 1,#MusicList:GetChildren() do if SoundLibrary[TrackSelected.Name][3] ~= 0 then SoundLibrary[TrackSelected.Name][3] = SoundLibrary[TrackSelected.Name][3] - 1 else SoundLibrary[TrackSelected.Name][1] = false end end |
|
|
| Report Abuse |
|
|
|
| 09 Mar 2016 12:29 PM |
-- FIX 2
function PlayTrack(Track) SoundLibrary[Track.Name][1] = true SoundLibrary[Track.Name][3] = SoundLibrary[Track.Name][2] Track:Play() end |
|
|
| Report Abuse |
|
|