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

I have a script and I put it in the object. But the script isn't working. What am i doing wrong?

Asked by 8 years ago
Edited 8 years ago

I put a clickdetector in the part, and then put the script in the model as well. But nothing happens. This is the script.

connect(function()    
Sound1-Play()    
 wait(26) --Wait     
Sound2-Play() 
wait(300)
Sound2-Stop()
wait(1)
Sound3-Play()

end)

And i put the audio in the script.

2 answers

Log in to vote
1
Answered by 8 years ago

Uhhh... You forgot to format your code in a Lua Code Block. Just click the Lua button and place your code between the ~~~~.

Anyway, for your code, you need to make a reference to the Sounds! Also, you can just make the code to wait for the sound to end as well. Let me show you!

script.Parent.MouseButton1Click:connect(function() 
    script.Sound1:Play() 
    script.Sound1.Ended:wait()
    script.Sound2:Play() 
    script.Sound2.Ended:wait()
    script.Sound3:Play() 
end)

If you have any questions, please leave a comment below. Thank you and I hope this will help you!

0
Thanks! Just so i do this right, i put the audio in the "Workspace", right? Not in the model or the script? acsstudios 0 — 8y
0
well... put the audio in the script because i made a reference from the script itself. or change "script.Sound1", "script.Sound2" and "script.Sound3" to "workspace.Sound1", "workspace.Sound2" and"workspace.Sound3". starlebVerse 685 — 8y
0
Ok. Thank you so much! I am new at scripting so i dont know too much. I do know the basics, But thank you. acsstudios 0 — 8y
0
no problem, u should click "accept answer" so we can both get reputation, which makes us a better person in SH! :D starlebVerse 685 — 8y
Ad
Log in to vote
0
Answered by 8 years ago
Edited 8 years ago

You said you put the clickdetector in a model. Or do you mean a part?

0
Sorry, i mean part. acsstudios 0 — 8y

Answer this question