Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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

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!

4 comments

0

Thanks! Just so i do this right, i put the audio in the "Workspace", right? Not in the model or the script?

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".

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.

0

no problem, u should click "accept answer" so we can both get reputation, which makes us a better person in SH! :D

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

1 comment

0

Sorry, i mean part.

This discussion is preserved as it was. New answers, comments, and votes are closed.