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

How would I make this so that it plays locally for a single player only? [NO FE]

Asked by
JSAcela 25
7 years ago

Making a star wars game, and I have a sound script here that plays when you get hit by a bullet.

function onTouched(hit)
    if hit.Name == "Bullet" then
        local S = Instance.new("Sound")
        S.Parent = workspace
        S.SoundId = "http://www.roblox.com/asset/?id=333632339"
        S.Volume = 1
        S.Looped = true
        S.Playing = true
    end
end

script.Parent.Touched:connect(onTouched)

But it plays for everyone. How could I modify this so that it plays for the player only?

2 answers

Log in to vote
0
Answered by 7 years ago

Put the sound inside of the player's Camera, just use a LocalScript.

0
And how would I do that? JSAcela 25 — 7y
Ad
Log in to vote
0
Answered by 7 years ago

Instead of putting the sound in the "workspace" simply put it into the torso of the player that was hit, or any other part that is close to it.

Answer this question