Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why Is The Script Only Play The 1st Soundtrack And Then Stop ?

Asked by
ImfaoXD 158
7 years ago
Edited 7 years ago

After putting together this nice script that play the whole song and it work perfectly fine in my studio. But when I tested it in the server the 1st soundtrack play and it stop after that. How come? Can anyone help me out? I like this script so much.

local sound=Instance.new("Sound",script.Parent)
sound.Volume=1
local tracks={}
tracks.list={}
tracks.delayTime=10 --time between each track
function tracks:new(clips)
local track={}
for i=1,#clips do
track[i]=clips[i]   
end 
tracks.list[#tracks.list+1]=track
end
function tracks:play()
while (true) do 
for i=1,#tracks.list do
local track=tracks.list[i]
for x=1,#track do
sound:Stop()
local clip=track[x]
sound.SoundId=("rbxassetid://"..clip)   
sound:Play()
if (sound.TimeLength==0) then repeat wait() until(sound.TimeLength>0) end
wait(sound.TimeLength) 
end 
wait(tracks.delayTime)  
end end end

--This is the part where you can add tracks to the script: 

tracks:new({316656692,316656720}) --Bastille
tracks:new({316656588,316656618}) --Call Me Maybe

--You can have as many tracks as you want, and as many id's as you want for each track

tracks:play()
0
Did you make this script? itsJooJoo 195 — 7y
0
Well, I did take it from free model and added in some code. Why? ImfaoXD 158 — 7y

Answer this question