Does anybody know a script for when a GUI is clicked, a sound is played locally to the player and nearby players
Play sound locally when a GUI is clicked?
1 answer
You would need to write the script, but this is how I would go about it. First make a Local Script and put a Sound Object inside it. Write the script so that when the script runs it will play what ever the Sound is. Then disable that script and put it somewhere to be cloned later.
Write in your main script when the button is clicked to loop through the players and to check their Distance from where the person who click it's Position. Using magnitude
local Distance = (a.Position-b.Position).magnitude -- the distance between a and b in studs
If it's confirmed that Distance is less then how far you want them to be. Then clone that script, change it's SoundId into the sound effect you want and send into their player and play it. I also recommend to have a :Destroy(script) on the cloned script's functions. So they don't build up over time. Hope this Method helps or you were able to replicate it. Best of Luck!
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
This is not a request site.
Putting a sound into the players gui, will play the sound locally.