Wubzer

Wubz's Sound Bar

Sep 3rd, 2017
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.12 KB | None | 0 0
  1. --// WXBZ's Sound Bar
  2. --// Script could be better but is not that bad.
  3.  
  4.  
  5.  
  6.  
  7. --//Variables
  8. local plrs = game:GetService("Players");
  9. local plr = plrs.LocalPlayer;
  10. local char = plr.Character;
  11. local humroot = char.HumanoidRootPart;
  12. local p1;
  13. local p2;
  14. local snd;
  15. local paudio = false;
  16. local colorz = {
  17.     Color3.fromRGB(255, 0, 0),
  18.     Color3.fromRGB(218, 133, 65),
  19.     Color3.fromRGB(255, 255, 0),
  20.     Color3.fromRGB(0, 255, 0),
  21.     Color3.fromRGB(4, 175, 236),
  22.     Color3.fromRGB(255, 0, 91)
  23. }
  24.  
  25.  
  26.  
  27.  
  28. --// Handling
  29. do
  30.    
  31.     wait(0.5);
  32.    
  33.     local function wparts()
  34.         --// Weld Creation
  35.         local w1 = Instance.new("Weld");
  36.         local w2 = Instance.new("Weld");
  37.         --// w1 Configuration
  38.         w1.Part0 = humroot;
  39.         w1.Part1 = p1;
  40.         w1.C0 = humroot.CFrame:inverse();
  41.         w1.C1 = p1.CFrame:inverse();
  42.         --// w2 Configuration
  43.         w2.Part0 = humroot;
  44.         w2.Part1 = p2;
  45.         w2.C0 = humroot.CFrame:inverse();
  46.         w2.C1 = p2.CFrame:inverse();
  47.         --// Parents
  48.         w1.Parent = p1;
  49.         w2.Parent = p2;
  50.     end;
  51.    
  52.     local function cparts()
  53.         --// Part Creation
  54.         p1 = Instance.new("Part");
  55.         p2 = Instance.new("Part");
  56.         snd = Instance.new("Sound");
  57.         --// p1 Configuration
  58.         p1.BrickColor = BrickColor.new("Really red");
  59.         p1.Material = Enum.Material.Neon;
  60.         p1.Name = "Part1";
  61.         p1.CFrame = humroot.CFrame * CFrame.new(4, 3.5, 0);
  62.         p1.Anchored = true;
  63.         p1.CanCollide = false;
  64.         p1.Size = Vector3.new(1, 1, 1);
  65.         --// p2 Configuration
  66.         p2.BrickColor = BrickColor.new("Really red");
  67.         p2.Material = Enum.Material.Neon;
  68.         p2.Name = "Part2";
  69.         p2.CFrame = humroot.CFrame * CFrame.new(-4, 3.5, 0);
  70.         p2.Anchored = true;
  71.         p2.CanCollide = false;
  72.         p2.Size = Vector3.new(1, 1, 1);
  73.         --// snd
  74.         snd.EmitterSize = 63;
  75.         --// Anchor & Parent
  76.         p1.Parent = workspace;
  77.         p1.Anchored = false;
  78.         p2.Parent = workspace;
  79.         p2.Anchored = false;
  80.         snd.Parent = humroot;
  81.        
  82.         wparts();
  83.     end;
  84.    
  85.     local function colors()
  86.         while true do
  87.             for _, c2 in pairs(colorz) do
  88.                 for i = 0, 1, 0.01 do
  89.                     p1.Color = Color3.new(((p1.Color.r*(1-i))+(c2.r*i)),((p1.Color.g*(1-i))+(c2.g*i)),((p1.Color.b*(1-i))+(c2.b*i)));
  90.                     p2.Color = Color3.new(((p1.Color.r*(1-i))+(c2.r*i)),((p1.Color.g*(1-i))+(c2.g*i)),((p1.Color.b*(1-i))+(c2.b*i)));
  91.                     wait()
  92.                 end;
  93.             end;
  94.         end;
  95.     end;
  96.    
  97.     local function psize()
  98.         while (paudio) do
  99.            
  100.             p1.Size = Vector3.new(1, snd.PlaybackLoudness * 0.01, 1);
  101.             p2.Size = Vector3.new(1, snd.PlaybackLoudness * 0.01, 1);
  102.             wparts();
  103.             wait();
  104.         end;
  105.     end;
  106.    
  107.     local function playaudio(m)
  108.         if (string.sub(m, 1, 6) == "$play ") then
  109.             paudio = false;
  110.             snd.SoundId = "rbxassetid://" .. tostring(string.sub(m, 7));
  111.             snd:Play();
  112.             paudio = true;
  113.             spawn(psize);
  114.         elseif (string.sub(m, 1, 5) == "$loop") then
  115.             snd.Looped = not snd.Looped;
  116.         elseif (string.sub(m, 1, 6) == "$stop") then
  117.             paudio = false;
  118.             snd:Stop();
  119.             p1.Size = Vector3.new(1, 1, 1);
  120.             p2.Size = Vector3.new(1, 1, 1);
  121.             wparts();
  122.         elseif (string.sub(m, 1, 5) == "$vol ") then
  123.             snd.Volume = tonumber(string.sub(m, 6));
  124.         end;
  125.     end;
  126.    
  127.     cparts(); plr.Chatted:Connect(function(msg) playaudio(msg); end); spawn(colors); --// Function Calling
  128.    
  129. end;
Add Comment
Please, Sign In to add comment