|
| 25 Jul 2014 11:19 PM |
I put it in a music script and found out it played with around 4 songs in it but once I started adding and testing it became glitchy. Now I enter and it just plays ONE random song and stops completely. I need it to go through the whole list then loop again through the list.
local songIds = { ["164269189"] = 120, ["144652618"] = 75, ["153859524"] = 60, ["143550410"] = 115, ["148409311"] = 120, ["148409206"] = 120, ["162942693"] = 120, ["164996701"] = 110, ["148334572"] = 120, ["148512213"] = 120, ["159559354"] = 120, ["159561632"] = 120, ["167962120"] = 80, ["158363043"] = 88, ["144249596"] = 112 }
for songId, _ in pairs (songIds) do Game:GetService("ContentProvider"):Preload("http://www.roblox.com/asset/?id=" .. songId) end
script.Parent:Stop()
while true do for songId, songLength in pairs (songIds) do script.Parent:Stop() script.Parent.SoundId = "http://www.roblox.com/asset/?id=" .. songId script.Parent:Play() wait(songLength) end end
-Upcoming Developer- |
|
|
| Report Abuse |
|
|
| |
|
| |
|
128GB
|
  |
| Joined: 17 Apr 2014 |
| Total Posts: 8056 |
|
|
| 25 Jul 2014 11:24 PM |
This is my script lol
Change this for songId, songLength in pairs (songIds) do
to this
for songId, songLength in ipairs (songIds) do
|
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 25 Jul 2014 11:28 PM |
| and remove the quotes around the IDs |
|
|
| Report Abuse |
|
|
128GB
|
  |
| Joined: 17 Apr 2014 |
| Total Posts: 8056 |
|
|
| 25 Jul 2014 11:31 PM |
Actually never mind I have no idea why its not playing in order, but for me its not breaking |
|
|
| Report Abuse |
|
|
|
| 25 Jul 2014 11:33 PM |
128 I will test it again go to my place only one song plays it stops. I am doing thumbs up and I will put you in a description as a developer and you can join the studio group I am creating. If it doesnt work will you rewrite it. it may have a max # of songs it can support.
-Upcoming Developer- |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 25 Jul 2014 11:36 PM |
What order would you play it in? There is no way Lua can figure that out. Do this
local songIds = { {"164269189", 120}, {"144652618", 75}, {"153859524", 60}, {"143550410", 115}, {"148409311", 120}, {"148409206", 120}, {"162942693", 120}, {"164996701", 110}, {"148334572", 120}, {"148512213", 120}, {"159559354", 120}, {"159561632", 120}, {"167962120", 80}, {"158363043", 88}, {"144249596", 112} }
for songId, _ in ipairs (songIds) do Game:GetService("ContentProvider"):Preload("http://www.roblox.com/asset/?id=" .. _[1]) end
script.Parent:Stop()
while true do for songId, songLength in ipairs (songIds) do script.Parent:Stop() script.Parent.SoundId = "http://www.roblox.com/asset/?id=" .. songLength[1] script.Parent:Play() wait(songLength[2]) end end |
|
|
| Report Abuse |
|
|
128GB
|
  |
| Joined: 17 Apr 2014 |
| Total Posts: 8056 |
|
|
| 25 Jul 2014 11:37 PM |
@Cnt Using ipairs makes it crash |
|
|
| Report Abuse |
|
|
|
| 25 Jul 2014 11:37 PM |
Honestly I don't care which order it plays, I will only start caring when lua plays the same song repeatedly which would be very rare.
-Upcoming Developer- |
|
|
| Report Abuse |
|
|
128GB
|
  |
| Joined: 17 Apr 2014 |
| Total Posts: 8056 |
|
|
| 25 Jul 2014 11:39 PM |
| Cntkillme fixed it, but I don't get why when I tried to use ipairs it crashed, its because the for loop didn't run, but why? |
|
|
| Report Abuse |
|
|
|
| 25 Jul 2014 11:40 PM |
All of you get credits and can join thanks means alot.
-Upcoming Developer- |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
| |
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 25 Jul 2014 11:43 PM |
| Oh, when you used it, It just not iterate through the table at all so it was doing while true do end |
|
|
| Report Abuse |
|
|
|
| 25 Jul 2014 11:44 PM |
How many songs will this support?
-Upcoming Developer- |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
| |
|
128GB
|
  |
| Joined: 17 Apr 2014 |
| Total Posts: 8056 |
|
|
| 25 Jul 2014 11:45 PM |
@Cnt It was more of a question of why is it doing that |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 25 Jul 2014 11:46 PM |
ipairs only iterates numerical keys.
while true do for songId, songLength in ipairs (songIds) do --no numerical keys = no loop script.Parent:Stop() script.Parent.SoundId = "http://www.roblox.com/asset/?id=" .. songLength[1] script.Parent:Play() wait(songLength[2]) end --no loop = no wait end |
|
|
| Report Abuse |
|
|
128GB
|
  |
| Joined: 17 Apr 2014 |
| Total Posts: 8056 |
|
| |
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
| |
|
|
| 25 Jul 2014 11:49 PM |
in game its froze plays one and is frozen. join game
-Upcoming Developer- |
|
|
| Report Abuse |
|
|
128GB
|
  |
| Joined: 17 Apr 2014 |
| Total Posts: 8056 |
|
|
| 26 Jul 2014 12:03 AM |
| Script currently being fixed and model updated, sorry, the new one will be tested online before I update it, sorry for the trouble |
|
|
| Report Abuse |
|
|
|
| 26 Jul 2014 12:05 AM |
Ok its ok for the trouble lol it means alot you guys are helping me. Just message me the model link. MEANS ALOT!!!!!!!!!!!!!!
-Upcoming Developer- |
|
|
| Report Abuse |
|
|
|
| 26 Jul 2014 12:25 AM |
Is it in a LocalScript? Preloading only works in LocalScripts |
|
|
| Report Abuse |
|
|
|
| 26 Jul 2014 12:29 AM |
AHAHAHAHAHHAHHHAHAHA I BET IT ISNT LOL THANKS
-Upcoming Developer- |
|
|
| Report Abuse |
|
|