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

how to get TimeLength in test/play mode ? [UnSolved]

Asked by 9 years ago

Studio 4.896 2.168 4.896

Test0 0 0

 wait(10)
music = script:GetChildren()
a = true
while a == true do
wait(1)
a = false
for i,v in pairs(music) do
local MusicRandom = music[math.random(1,#music)]
MusicRandom:Play()
if music[i].IsPlaying then
    print(music[i].TimeLength)
wait(music[i].TimeLength)
a = true
end
end
end

1 answer

Log in to vote
1
Answered by 9 years ago
 wait(10)
music = script:GetChildren()
while wait(1) do
local MusicRandom = music[math.random(1,#music)]
MusicRandom:Play()
if MusicRandom.IsPlaying then --use MusicRandom instead of music[i] because music[i] isnt the randomly selected music piece.
print(MusicRandom.TimeLength)
wait(MusicRandom.TimeLength)
end
end --the variable 'a' seemed useless in this problem so I toke it out if you don't mind

Try that.

0
still 0 Layfonex 0 — 9y
0
You sure the audio has an audio id in it? FutureWebsiteOwner 270 — 9y
0
yes Layfonex 0 — 9y
0
Also having a problem with TimeLength returning 0 even when playing.. Nickoakz 231 — 8y
Ad

Answer this question