Advertisement
EquinoxDiscord

visualizer

Mar 25th, 2018
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.84 KB | None | 0 0
  1. local Players=game:service'Players'
  2. local Player=Players.LocalPlayer
  3. local Char=Player.Character
  4. local parts={};
  5. local skipvotes=0
  6. local prefix='!'
  7. local Width,Height,Gen,Div,Cap=.1,.1,100,70,12
  8. local animspd=.75
  9. wait(.05)
  10.  
  11. function rainb(hue)
  12. local section = hue % 1 * 3
  13. local secondary = 0.5 * math.pi * (section % 1)
  14. if section < 1 then
  15. return Color3.new(1, 1 - math.cos(secondary), 1 - math.sin(secondary))
  16. elseif section < 2 then
  17. return Color3.new(1 - math.sin(secondary), 1, 1 - math.cos(secondary))
  18. else
  19. return Color3.new(1 - math.cos(secondary), 1 - math.sin(secondary), 1)
  20. end
  21. end
  22.  
  23. pcall(function()
  24. Char.SaVisualizer:Destroy()
  25. Char.HumanoidRootPart.Sound:Destroy()
  26. end)
  27.  
  28. script.Name = 'SaVisualizer'
  29.  
  30. local Modl=Instance.new('Model', script)
  31. local HumanoidRootPart=Char:WaitForChild'HumanoidRootPart'
  32. local fp=CFrame.new(0,6,0)*CFrame.Angles(-math.rad(5),0,0)
  33. local S=Instance.new('Sound',HumanoidRootPart)
  34. S.Looped=true
  35. S.Volume=1
  36. S.EmitterSize=40
  37. local lrs=game:service'RunService'.RenderStepped
  38.  
  39. --[[
  40. local bl=Instance.new('Part')
  41. bl.Anchored=true
  42. bl.Size=Vector3.new(Width,Height,.2)
  43. bl.Material='SmoothPlastic'
  44. bl.Color=Color3.new(1,1,1)
  45. bl.Transparency=0
  46. bl.CanCollide=false
  47. bl.Anchored=true
  48. bl.CFrame=fp*CFrame.new(0,Height*3,0)
  49. local bm=Instance.new('SpecialMesh',bl)
  50. bl.MeshType='Sphere'
  51. bl.Parent=nil
  52. --]]
  53.  
  54. local Generated=false
  55. local first=true
  56. function AddParts(Number)
  57. local up=1
  58. if first then
  59. up=0
  60. first=false
  61. end
  62. local nparts=#parts
  63. Generated=false
  64. for i = 0,math.floor(tonumber(Number)) do
  65. local p=Instance.new('Part')
  66. p.Anchored=true
  67. p.Size=Vector3.new(Width,Height,.2)
  68. p.Material='SmoothPlastic'
  69. p.Color=Color3.new(1,1,1)
  70. p.Transparency=0
  71. p.CanCollide=false
  72. p.Anchored=true
  73. p.CFrame=fp*CFrame.new(0,Height*3,0)
  74. local bm=Instance.new('SpecialMesh',p)
  75. bm.MeshId='rbxasset://fonts/rightarm.mesh'
  76. bm.TextureId='rbxassetid://215418209'
  77. p.Parent=Modl
  78. --warn(nparts+i)
  79. parts[(nparts+up)+i]=p
  80. game.ItemChanged:wait()
  81. end
  82. Generated=true
  83. end
  84.  
  85. function RmvParts(Number)
  86. if Generated then
  87. local nparts=#parts
  88. warn(nparts)
  89. for i = 0, Number do
  90. local n=nparts-i
  91. local per=parts[n]
  92. parts[n]=nil
  93. per:Destroy()
  94. lrs:wait()
  95. end
  96. warn(#parts)
  97. end
  98. end
  99.  
  100. function Sound(Id)
  101. skipvotes=0
  102. S:Stop()
  103. S.SoundId='rbxassetid://'..Id
  104. S:Play()
  105. end
  106. --326631346
  107. function OnChat(P, Message)
  108. m=Message:lower()
  109. if m:sub(0,#prefix+3)== prefix..'snd' and P==Player then
  110. local id=tonumber(m:sub(6))
  111. print(id)
  112. local snd=Sound(id)
  113. elseif m:sub(0,#prefix+3)== prefix..'add' and P==Player then
  114. local num=tonumber(m:sub(6))
  115. warn(num)
  116. AddParts(num)
  117. elseif m:sub(0,#prefix+3)== prefix..'rmv' and P==Player then
  118. local num=tonumber(m:sub(6))
  119. warn(num)
  120. RmvParts(num)
  121. elseif m:sub(0,#prefix+3)== prefix..'spd' and P==Player then
  122. local num=tonumber(m:sub(6))
  123. warn(num)
  124. animspd=num or .8
  125. elseif m:sub(0,#prefix+4)== prefix..'stop' and P==Player then
  126. S:Pause()
  127. elseif m:sub(0,#prefix+6)== prefix..'replay' and P==Player then
  128. --S:Stop()
  129. S:Play()
  130. elseif m:sub(0,#prefix+4)== prefix..'play' and P==Player then
  131. S:Resume()
  132. elseif m:sub(0,#prefix+5)== prefix..'vskip' then
  133. skipvotes=skipvotes+1
  134. if skipvotes>= math.floor(Players.NumPlayers/3) then
  135. skipvotes=0
  136. S:Stop()
  137. end
  138. end
  139. end
  140.  
  141. function Connect(P)
  142. P.Chatted:connect(function(Message)
  143. OnChat(P, Message)
  144. end)
  145. end
  146.  
  147. function HandleParts(Plb_l,Clr,Spd)
  148. for index, Part in next, parts do
  149. local neg=-(Width*index)+(Width*(#parts/2))
  150. Part.CFrame=Part.CFrame:lerp(CFrame.Angles(0,0,0)*fp*CFrame.new(neg,Height*5,0),.1)
  151. if Generated then
  152. Part.Anchored=true
  153. if index==0 then
  154. Part.Mesh.VertexColor=Part.Mesh.VertexColor:lerp(Vector3.new(Clr.r,Clr.g,Clr.b),.6)
  155. Part.Mesh.Scale=Part.Mesh.Scale:lerp(Vector3.new(Width+.1,.1+Plb_l,.01),Spd/3.5)
  156. elseif index ~= 0 then
  157. spawn(function()
  158. wait(((index/200)*1.1))
  159. --Part.Mesh.VertexColor=parts[index-1].Mesh.VertexColor
  160. Part.Mesh.VertexColor=Part.Mesh.VertexColor:lerp(parts[index-1].Mesh.VertexColor,.6)
  161. end)
  162. Part.Mesh.Scale=Part.Mesh.Scale:lerp(Vector3.new(Width+.1,parts[index-1].Mesh.Scale.Y,.01),Spd)
  163. end
  164. end
  165. end
  166. end
  167.  
  168. lrs:connect(function()
  169. local Color = rainb(tick()/20)
  170. local Var=S.PlaybackLoudness
  171. --local Spd = .15+((.15*100)/Var)
  172. --warn(Spd,(.85*100)/Var)
  173. --if Spd > .75 then
  174. -- Spd=.7
  175. --end
  176. if not S.IsPlaying or S.SoundId=='rbxassetid://0' then
  177. local mul=200
  178. Var=(mul-.1)+math.sin(tick()*2)*mul
  179. --print(Var)
  180. end
  181. HandleParts(Var/Div,Color,animspd)
  182. end)
  183.  
  184. Players.PlayerAdded:connect(function(P)
  185. Connect(P)
  186. end)
  187.  
  188. for Index, P in next, Players:GetPlayers() do
  189. Connect(P)
  190. end
  191. --485859421
  192. AddParts(Gen)
  193. Sound(1035328286)--265675215//337053183//244769293
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement