Advertisement
squidingtin

Audio Visualizer Ring [LOUD] V2.5

Apr 27th, 2018
200
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. -------------------------------------- game:GetService("RunService").RenderStepped:Wait()
  50. local music = coroutine.wrap(function()
  51. while true do wait()
  52. local gc = fold:GetChildren()
  53. for i = 1,#gc do
  54. sine2=sine2+0.5
  55. local l = tick()+sine2
  56. local p = gc[i]
  57. TweenMe(p,'Color',Color3.new(size*math.sin(l)/255,0/255,-size*math.sin(l)/255),1,"Sine","Out")
  58. local size2 = size*4
  59. 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')
  60. end
  61. end
  62. end)
  63. music()
  64. --------------------------------------
  65. local playing = false
  66. player.Chatted:connect(function(chat)
  67.     if chat:sub(1,3) == "~s " then
  68.         local num = chat:sub(4)
  69.         size = num
  70.     elseif chat:sub(1,6) == "~play " then
  71.         if hrp:FindFirstChild("music") ~= nil then
  72.             size = 0
  73.             playing = false
  74.             hrp["music"]:Remove()
  75.         end
  76.         wait(1)
  77.         local id = chat:sub(7)
  78.         local music = Instance.new("Sound",hrp)
  79.         music.Looped = true
  80.         music.Name = "music"
  81.         music.Volume = 5
  82.         music.SoundId = "rbxassetid://"..id
  83.         music.MaxDistance = 100
  84.         music.EmitterSize = 100
  85.         music:Play()
  86.         playing = true
  87.         local visualize = coroutine.wrap(function()
  88.             repeat wait()
  89.             size = music.PlaybackLoudness/10
  90.             until playing == false
  91.         end)
  92.         visualize()
  93.     elseif chat == "~stop" then
  94.         if hrp:FindFirstChild("music") ~= nil then
  95.             size = 0
  96.             playing = false
  97.             hrp["music"]:Remove()
  98.         end
  99.     end
  100. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement