Advertisement
tyridge77

Untitled

Sep 3rd, 2015
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.54 KB | None | 0 0
  1. wait();
  2. local sounds = {};
  3. -- {Sound,Radius,MaxVolume}
  4. sounds.River = {Workspace.River.Sound,50,1}
  5. local rst = game:GetService("RunService").RenderStepped;
  6. local player = game.Players.LocalPlayer;
  7. local char = Workspace:WaitForChild(player.Name);
  8. local torso = char:WaitForChild("Torso");
  9.  
  10. while true do
  11.    rst:wait();
  12.    for _,v in pairs(sounds) do
  13.       local sound,radius,maxvolume = unpack(v);
  14.       local distance = (torso.Position-sound.Parent.Position).magnitude;
  15.       sound.Volume = (1-distance/radius)*(maxvolume);
  16.    end
  17. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement