So right now I have two bricks. One is indoors that contains this script and another is outdoors that contains this script, except that one is set to false.
script.Parent.Touched:connect(function(hit) if hit.Parent:FindFirstChild('Humanoid') then game.StarterGui.Music.EqualizerSoundEffect.Enabled = true game.StarterGui.Rain.EqualizerSoundEffect.Enabled = true end end)
First of all, my goal is to enable the EqualizerSoundEffect that is under 2 sounds named "Music" and "Rain" which are currently placed under PlayerGui (I already have a local script under the PlayerGui that plays the music by the way).
BUT
My problem: The script just doesn't work and when I just have both of the sounds placed under Workspace and have it enabled from there, the EqualizerSoundEffect is enabled for everyone in the game, but I only want it to be enabled for the person entering a room.
I'm hoping someone can help me clear this up because I don't want to have to make my game single player just because I can't get a simple sound effect to only happen locally. Thanks.
Server script:
local RemoteEvent = game.ReplicatedStorage:WaitForChild("NameOfRemote") -- place a remote event in ReplicatedStorage local RainAudio = game.StarterGui.Rain local MusicAudio = game.StarterGui.Music script.Parent.Touched:connect(function(part) local parentModel = part.Parent local humanoid = parentModel:FindFirstChildOfClass("Humanoid") if humanoid then -- verify if it's a player not a npc if game.Players:FindFirstChild(parentModel.Name) then -- parentModel = Character RemoteEvent:FireClient(RainAudio, MusicAudio) -- send the sounds you want the local script to change end end end)
Local script:
local RemoteEvent = game.ReplicatedStorage:WaitForChild("NameOfRemote") -- make sure this is the exact remote the server script is using RemoteEvent.OnClientEvent:Connect(function(rainAudio, musicAudio) rainAudio.EqualizerSoundEffect.Enabled = true musicAudio.EqualizerSoundEffect.Enabled = true end)