if game.Workspace.Part.ClickDetector then play audio == ('142435409') end
I am trying to get a part when I click it, it will play a certain audio. Is this script correct for that?
if game.Workspace.Part.ClickDetector then play audio == ('142435409') end
I am trying to get a part when I click it, it will play a certain audio. Is this script correct for that?
sound = game.Workspace.Sound --Change this to whatever it is in your game
function onClicked()
sound:Play()--For it to play (142435409) you just should make an audio in workspace, and put that in the SoundId
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
If you are wanting it to play client-side make sure it is a Localscript first. If you are using click detectors then it should look something like this.
audio1 = game.Soundscape.Bomb --you can change this to whatever audio you want to play
function onClicked()
play audio1
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
****I am not sure if that itself will work, but it is basically what is needed for the click detector. I predetermined the audio track to play(in this case "Bomb" from the Soundscape, to simplify the script later on.
This discussion is preserved as it was. New answers, comments, and votes are closed.
5 comments
I think it is audio1:Play(), not play audio1.
The point of it was to give him a basic idea of how to work the Click Detector, because that seemed to be the part that he was having the largest issue with.
Then I would use the comment "--" so it doesnt seem a part of the script.
Did you not read the "****I am not sure if that itself will work, but it is basically what is needed for the click detector. -In other words, It is just for a structural thing so he knows where to put the function to play the audio and how the click detector should be set up.
areiy your script idea is horrible.