Hi!
I have a Remote Event that's sent to a script under ServerScriptStorage, in the course of that Remote Event, I need to play a Sound, with info for that Sound sent from the RemoteEvent. The audio does play, but it plays for everyone in the server, and I need just the player who triggered the even to hear it.
Script in ServerScriptStorage
TheRemoteEvent.OnServerEvent:Connect(function(Player,SoundSent) local NewSound = SoundSent.SoundId local SoundForPlayerToHear = Instance.new("Sound") SoundForPlayerToHear.SoundId = NewSound -- Other Stuff Happens First SoundForPlayerToHear:Play() end)
Here's where it gets fun, the "SoundSent" Sound file is from a folder stored inside the Player, which can change every time the player loads the game and chooses a different set of sound files to have. So there's never a specific SoundId to point to as it changes, but the Local Script that fires the Remote Event to the Server includes the necessary Sound file, "SoundSent".
But as stated before, when I do this, everyone hears the audio being played, and I only want the player to hear it.
How should this be tweaked to where it only plays for the player who triggered the event, while still keeping it inside this Server Script?
Thanks!