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

how can i make this sound start script only play for the player who touched the brick?

hi, i made a script that makes it so when a player touches the brick, it plays a new sound and ends the old one, the only problem is is that it plays the sound for everyone in the server.

here is the script i was using before:

script.Parent.Touched:connect(function(hit)
	game.Workspace.Sound:Play()
end)

here is the script i thought might work:

script.Parent.Touched:connect(function(hit)
	game.Players[hit.Parent.Name].game.Workspace.Sound:Play()
end)

thanks in advance, from poopypigeon245

2 comments

0

also a localscript didn't work either

0

Is the game filtering enabled?

1 answer

You can use local sounds. You just have to move the sound into the players player gui.

script.Parent.Touched:connect(function(hit)
   local plr = hit.Parent.Name
   if game.Players:FindFirstChild(plr) then
   workspace.Sound:Clone().Parent = game.Players[plr].PlayerGui
   if game.Players[plr].PlayerGui.Sound.IsPlaying == false then
    game.Players[plr].PlayerGui.Sound:Play()
end end end)

2 comments

0

I would move the sound somewhere in the server storage but it is up to you,

0

so it works fine, but i nned to make sure it ends the sound when the next trigger block is touched, i managed to find a way to do it, but it only worked on studio (the part you made worked in game)

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