Hello, please can someone tell me what I have done wrong with line 16? I want it to loop the above soundtrack 10 times but it only plays once.
This is the error message: Workspace.Part.Script:18: attempt to call global 'loop' (a nil value)
Thank you.
BoolValue = script.Parent.Parent.EmergencyLight1.Toggle
sound1=game.Workspace.Sound1
sound2=game.Workspace.Sound2
sound3=game.Workspace.Sound3
sound4=game.Workspace.Sound4
function onClick()
if BoolValue.Value == false then
BoolValue.Value = true
print(BoolValue.Value)
sound1:Play()
wait(3)
sound2:Play()
wait(5)
sound3:Play()
loop(10) -- Why doesn't this loop? It just waits then plays the other sound
wait(85)
sound4:Play()
else BoolValue.Value = false
end
end
script.Parent.ClickDetector.MouseClick:connect(onClick)

1 comment
Worked perfectly fine. Thanks! I just did sound3:Play() wait(10) sound3:Stop() :)