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

How can i play a sound when player touched block in that script?

Asked by 2 years ago
local jumpscareModule = require(game.ReplicatedStorage:WaitForChild("Modules"):WaitForChild("Jumpscare Manager"))
local debounces = { }
local Players = game:GetService("Players")

script.Parent.Touched:connect(function(hit)
    local player = game.Players:GetPlayerFromCharacter(hit.Parent)

    if debounces[player] then
        return
    end

    debounces[player] = true
        jumpscareModule.Jumpscare(player)
    wait(4)
    debounces[player] = nil
    end)

Answer this question