Obscurely
|
  |
| Joined: 30 May 2013 |
| Total Posts: 1216 |
|
|
| 08 Feb 2016 11:41 AM |
okay, first of all sorry for my lack of scripting knowledge. i would like someone to help me make this script better:
while true do wait(0) script.Music.Pitch = 1 script.Music:play() wait(78.936000000000007) end
the 78.936blah is the length of the song, but it looks quite trashy like that
also, i would like to add multiple songs to my game, playing one after another like a mixtape, but i have no idea how to even start going about that
i know i'll have to change the asset id each time but idek how to do that
ty for reading :) if u can help ty even more |
|
|
| Report Abuse |
|
|
|
| 08 Feb 2016 11:46 AM |
Use this for the wait():
http://wiki.roblox.com/index.php?title=API:Class/Sound/TimeLength
|
|
|
| Report Abuse |
|
|
Obscurely
|
  |
| Joined: 30 May 2013 |
| Total Posts: 1216 |
|
|
| 08 Feb 2016 11:48 AM |
| thank you. anyone have any advice about the multiple songs? |
|
|
| Report Abuse |
|
|
|
| 08 Feb 2016 11:50 AM |
Not sure if this would work, but if you made a model in the script containing all the songs:
songs = {}
for _, v in pairs(script.MusicStore:GetChildren()) do table.insert(songs, v) end
while true do for _, s in pairs(songs) do s.Pitch = 1 s:Play() wait(s.TimeLength) s:Stop() end end
|
|
|
| Report Abuse |
|
|
Panwellz
|
  |
| Joined: 16 Oct 2012 |
| Total Posts: 749 |
|
|
| 08 Feb 2016 11:52 AM |
while true do wait(0) script.Music.Pitch = 1 script.Music:play() wait(78.936000000000007) script.Music:stop() script.Music2.Pitch = 1 script.Music2:play() wait(lenght) -- and so on end
I think that's how you add more songs
|
|
|
| Report Abuse |
|
|
|
| 08 Feb 2016 12:04 PM |
If you want to create a playlist that selects custom songs, create a script in the StarterGui,
gw=game.Workspace
function message(text,time) local oldmsg=gw:FindFirstChild("Hint") if oldmsg then oldmsg.Parent=nil end local spacenumber=time*25 local msg=Instance.new("Hint") msg.Parent=gw wait(1/25) local maketext="" for i2=1, i do maketext=maketext.." " end maketext=maketext..text for i2=1, spacenumber-i do maketext=maketext.." " end msg.Text=maketext end]] msg.Text=text wait(0) msg.Parent=nil end
last="" lastlast="" while true do wait(1) local tracks=script:GetChildren() local rn=math.random(1,#tracks) local track=tracks[rn] if track~=nil then if track.className=="Sound" and track.Name~=last and track.Name~=lastlast then lastlast=last last=track.Name message(track.Name,5) track:play() wait(80) track:pause() end end end |
|
|
| Report Abuse |
|
|
|
| 08 Feb 2016 12:08 PM |
| then add a 'sound' into that script and change the 'SoundId' to the id of your song. You can create multiple |
|
|
| Report Abuse |
|
|
Obscurely
|
  |
| Joined: 30 May 2013 |
| Total Posts: 1216 |
|
|
| 08 Feb 2016 12:11 PM |
| thank you for all the different, complex replies - i used panwellz's script because it was the simplest to understand to a newbie to scripting :) |
|
|
| Report Abuse |
|
|
|
| 08 Feb 2016 12:14 PM |
you might not wanna stop the 1st Music instance, make it not looped, and play the next Music2 instance about game:service'RunService'.RenderStepped:wait()*10 earlier. the fact that sounds take time to load, you should also Preload them
|
|
|
| Report Abuse |
|
|
Obscurely
|
  |
| Joined: 30 May 2013 |
| Total Posts: 1216 |
|
|
| 08 Feb 2016 12:19 PM |
| @amb what would be the problem with stopping the music? |
|
|
| Report Abuse |
|
|
Soybeen
|
  |
| Joined: 17 Feb 2010 |
| Total Posts: 21462 |
|
|
| 08 Feb 2016 01:26 PM |
--[[ Randomized Jukebox by Soybeen
Directions: Insert he IsD of the songs that you want to play. Put this script in a Sound in the Workspace (for everyone to hear) GOOD2GO ]]
songs = ({ 14443565, 14443692, 14443659, })
lastplayed = "" sp = script.Parent numsongs = #songs math.randomseed(tick())
while wait() do
tracknum = (math.random(1, numsongs)) if (songs[tracknum]) ~= lastplayed then lastplayed = songs[tracknum] sp.SoundId = ("http://www.roblox.com/asset/?id="..songs[tracknum]) sp:Play() print("Playing: "..songs[tracknum].." Last Played: "..lastplayed) wait(script.Parent.TimeLength) sp:Stop() sp.SoundId = "" wait(2) end end |
|
|
| Report Abuse |
|
|