squidingtin

Audio Visualizer Ring [LOUD] V3

Apr 27th, 2018
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local player = game.Players.LocalPlayer
  2. local char = player.Character
  3. local ispeed = 14.44
  4. local sine = 0
  5. local sine2 = 0
  6. local size = 0
  7. local maxTabs = 74
  8. local ai = 360/maxTabs
  9. hrp=char["HumanoidRootPart"]
  10. rd=math.rad
  11. local fold = Instance.new("Folder")
  12. fold.Name = "Vis"
  13. fold.Parent = char
  14. --------------------------------------
  15. local siner = coroutine.wrap(function()
  16. while true do wait()
  17.     sine = sine+1
  18.     end
  19. end)
  20. siner()
  21. --------------------------------------
  22. function TweenMe(joint,prop,cfrmz,alp,es,ed)
  23.     local ts = game:GetService("TweenService")
  24.     local ti = TweenInfo.new(alp,Enum.EasingStyle[es],Enum.EasingDirection[ed],0,false,0)
  25.     local pp = {[prop] = cfrmz}
  26.     local tween = ts:Create(joint,ti,pp)
  27.     tween:Play()
  28. end
  29. function createPart()
  30.     local p = Instance.new("Part")
  31.     p.Anchored = true
  32.     p.CanCollide = false
  33.     p.TopSurface = "Smooth"
  34.     p.BottomSurface = "Smooth"
  35.     p.Material = "Neon"
  36.     p.Size = Vector3.new(1,1,1)
  37.     p.CFrame = CFrame.new(hrp.CFrame.p)
  38.     return p
  39. end
  40. local idk = 4
  41. local eh = 360/idk
  42. for i = 1,360/ai do
  43.  
  44.     local p = createPart()
  45.     p.Parent = fold
  46.     p.CFrame = CFrame.new(hrp.CFrame.p)*CFrame.Angles(rd(0),rd(i*ai),rd(0))*CFrame.new(0,1*math.cos(sine/ispeed),10)
  47. end
  48.  
  49. --------------------------------------
  50. game:GetService("RunService").RenderStepped:Wait()
  51.     local music = coroutine.wrap(function()
  52.     while true do wait()
  53.         local gc = fold:GetChildren()
  54.         for i = 1,#gc do
  55.             sine2=sine2+0.5
  56.             local l = tick()+sine2
  57.             local p = gc[i]
  58.             TweenMe(p,'Color',Color3.new(size*math.sin(l)/255,0/255,-size*math.sin(l)/255),1,"Sine","Out")
  59.             local size2 = size*4
  60.             TweenMe(p,'CFrame',hrp.CFrame*CFrame.Angles(rd(0),rd(i*ai),rd(0))*CFrame.new(0,size*math.sin(l)*0.5,5+size/2),0.5,'Sine','Out')
  61.         end
  62.     end
  63. end)
  64. music()
  65. --------------------------------------
  66. local playing = false
  67. player.Chatted:connect(function(chat)
  68.     if chat:sub(1,3) == "~s " then
  69.         local num = chat:sub(4)
  70.         size = num
  71.     elseif chat:sub(1,6) == "~play " then
  72.         if hrp:FindFirstChild("music") ~= nil then
  73.             size = 0
  74.             playing = false
  75.             hrp["music"]:Remove()
  76.         end
  77.         wait(1)
  78.         local id = chat:sub(7)
  79.         local music = Instance.new("Sound",hrp)
  80.         music.Looped = true
  81.         music.Name = "music"
  82.         music.Volume = 5
  83.         music.SoundId = "rbxassetid://"..id
  84.         music.MaxDistance = 100
  85.         music.EmitterSize = 100
  86.         music:Play()
  87.         playing = true
  88.         local visualize = coroutine.wrap(function()
  89.             repeat wait()
  90.             size = music.PlaybackLoudness/10
  91.             until playing == false
  92.         end)
  93.         visualize()
  94.     elseif chat == "~stop " then
  95.         if hrp:FindFirstChild("music") ~= nil then
  96.             size = 0
  97.             playing = false
  98.             hrp["music"]:Remove()
  99.     elseif chat:sub(1,3) == "~v " then
  100.         local vol = chat:sub(4)
  101.         music.Volume = vol
  102.         end
  103.     end
  104. end)
  105.  
  106.  
  107.  
  108. print("-------------------KEYS--------------------")
  109. print("")
  110. print("~play - Plays audio ID")
  111. print("~s - Changes the size of the ring")
  112. print("~stop - Stops audio")
  113. print("~v - Changes the volume")
  114. print("")
  115. print("-------------------------------------------")
Add Comment
Please, Sign In to add comment