Does anybody know a script for when a GUI is clicked, a sound is played locally to the player and nearby players
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!
Closed as Not Constructive by MachoPiggies, LukeSmasher, and xPolarium
This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.
Why was this question closed?