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
local debounce = false
game.Workspace.BlockNameHere:connect(function(hit)
    if hit.Parent:FindFirstChild("Humanoid") then
        if debounce == false then
            debounce = true
            script.Sound:Play()
            wait(1.5)
            debounce = false
        end
    end
end)
Ad

Answer this question