Ok so when I tested the script in studio it worked fine, but then when I went in game it didn't play the audio. I looked for many solutions and failed, if any of you know how to fix it please tell me how, I would really appreciate it. :)
repeat wait() until game.Players.LocalPlayer.Character while wait() do for i,v in pairs(game.Players:GetChildren())do if (v.Character.Head.Position - script.Parent.Position).magnitude <= 100 then game.Players.LocalPlayer.PlayerGui.Rain.Volume = 0.5 else game.Players.LocalPlayer.PlayerGui.Rain.Volume = 0 end end end
Put it in a local script. That's all to it.