when a part is pushed onto a different part then a sound plays once, how can i script this?? (am a noob at scripting)
✓ ANSWER ACCEPTED
how can i make a sound play when a part touches another part?
1 answer
✓ Accepted answer
local AnotherPart = workspace.AnotherPart
local Sound = game.Workspace.Sound
local Debounce = false
local COOLDOWN = 5
script.Parent.Touched:Connect(function(hit)
if hit == AnotherPart and not Debounce then
Debounce = true
Sound:Play()
task.wait(COOLDOWN)
Debounce = false
end
end)
AnotherPart will be the part where it will play the sound when touched the script.Parent brick.
Be sure to locate the AnotherPart and the Sound to where they are in the game
COOLDOWN is the cooldown value so it makes the sound playing have cooldown
Last thing is put this script inside the brick
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
check the new scirpt