Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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?

1 comment

2 answers

✓ Accepted answer

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

1 comment

0

And how would I do that?

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.

This discussion is preserved as it was. New answers, comments, and votes are closed.