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

How do you make a sound play from a person and people far away cant hear it?

Asked by 6 years ago

I finished a script that plays a sound when a button is pressed but it destroys everyone's ears where ever they are in the map.

Here is the script i'm using

function onKeyPress(inputObject, gameProcessedEvent)
    if inputObject.KeyCode == Enum.KeyCode.E then
    end
    if IsEquipped == true and inputObject.KeyCode == Enum.KeyCode.E then
   game.Workspace.Sound:Play()
    end
end

game:GetService("UserInputService").InputBegan:connect(onKeyPress)

function onKeyPress(inputObject, gameProcessedEvent)
    if inputObject.KeyCode == Enum.KeyCode.E then
    end
    if IsEquipped == true and inputObject.KeyCode == Enum.KeyCode.E then
   game.Workspace.Sound:Stop()
    end
end

game:GetService("UserInputService").InputEnded:connect(onKeyPress)

If you could show me how to make it play from the person and how to make it get more quiet as you move farther away that would be great.

Answer this question