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

How do I make a sound play when a button is pushed?

Asked by 4 years ago

When you click on a part, I wanna know how to make a sound play when you click it.

2 answers

Log in to vote
1
Answered by 4 years ago
Edited 4 years ago

Hello, this isn't a request site but this is probably your first question, i suggest you try solving the answer first. Ok i will help you solve your question:

Local Sound = workspace.Sound --Let say your Sound is in Workspace and it is named Sound
script.Parent.MouseClick:Connect(function() -- The click detector is clicked, it fire this function (Put clickDetector inside your button and this script inside click Detector
       Sound:Play() -- Play the sound
end)

Hope that solved your question, remember that this isn't a request site :D

Ad
Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

Upload ur sound to workspace and name it Sound

play

Local Sound = game.workspace.Sound
script.Parent.MouseClick:Connect(function()
       Sound:Play()
end)

stop

Local Sound = game.workspace.Sound
script.Parent.MouseClick:Connect(function()
       Sound:Stop()
end)

Answer this question