I have a sound script for ambient noises. It's designed to play an audio clip in a seamless loop by always playing a new audio before the current audio ends. It was working perfectly until today and I'm not sure why. Now, the sound doesn't even clone but the print() functions still fire.
This is the error I am receiving:
11:10:33.338 - attempt to call a number value
any ideas? thanks
--getSound
for i,v in pairs (script.Parent:GetChildren()) do
if v:isA("Sound") then
soundObj = v
print("got sound ... " .. soundObj.Name)
end
end
soundLength = soundObj.TimeLength
print("length = " .. soundLength)
function countDown(sound)
sound:remove()
end
while true do
local newSound = soundObj:clone()
newSound.Parent = script.Parent
newSound:play()
print("played new sound .. " ..newSound.Name)
delay(countDown(newSound), soundLength)
print("delay fired")
wait(soundLength-1)
end
