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

3 comments
Because you used Play Solo
You used the blue Play button with a roblox character, that is Play Solo. In that mode, the client and server are not separated
Oh ok I understand now thanks for the fast reply m8 :D