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

How do I make it so when a player hears a sound no one else hears the sound?

I know I should use a local script which I did but the sound can still be heard by other players here is the code

button1 = game.Workspace.button1
button2 = game.Workspace.button2
speaker = game.Workspace.speaker
player = game.Players.LocalPlayer

function pplay()
s = Instance.new("Sound",player)
s.SoundId = " http://www.roblox.com/asset/?id=375746963"
s.Volume = 1
s.Pitch = 1
s:Play()
end

function stopp()
	if s.IsPlaying then
		s:Stop()
	end
end

button1.ClickDetector.MouseClick:connect(pplay)
button2.ClickDetector.MouseClick:connect(stopp)


1 answer

✓ Accepted answer

You can do this by putting the sound in the players PlayerGui

s = Instance.new("Sound",player.PlayerGui)

1 comment

0

Thanks works :)

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