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

Ontouch play a sound?

Asked by 10 years ago

How can I make it so that when someone touches a block it plays a sound that's grouped inside the script.

1 answer

Log in to vote
1
Answered by
MrFlimsy 345 Moderation Voter
10 years ago
01local debounce = false
02game.Workspace.BlockNameHere:connect(function(hit)
03    if hit.Parent:FindFirstChild("Humanoid") then
04        if debounce == false then
05            debounce = true
06            script.Sound:Play()
07            wait(1.5)
08            debounce = false
09        end
10    end
11end)
Ad

Answer this question