DerekWeyant

Music: Hearth Beat Visualizer

Jun 13th, 2018
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.87 KB | None | 0 0
  1. --written by kent911t =D
  2. doingwave = false
  3.  
  4. FakeHeartbeat=Instance.new('BindableEvent',script)
  5. FakeHeartbeat.Name='Heartbeat'
  6. script:WaitForChild("Heartbeat")
  7. frame = 1/60
  8. tf = 0
  9. allowframeloss = false
  10. tossremainder = false
  11. flastframe = tick()
  12. script.Heartbeat:Fire()
  13. game:GetService("RunService").Heartbeat:connect(function(s, p)
  14. tf = tf + s
  15. if frame <= tf then
  16. if allowframeloss then
  17. script.Heartbeat:Fire()
  18. flastframe = tick()
  19. else
  20. for i = 1, math.floor(tf / frame) do
  21. script.Heartbeat:Fire()
  22. end
  23. flastframe = tick()
  24. end
  25. if tossremainder then
  26. tf = 0
  27. else
  28. tf = tf - frame * math.floor(tf / frame)
  29. end
  30. end
  31. end)
  32.  
  33. swait = function(t)
  34. if t == nil then
  35. t = 1/60
  36. else
  37. if t == 0 then
  38. t = 1/60
  39. end
  40. end
  41. local s = 0
  42. local stime = tick()
  43. for i_ = 1, t * 60 do
  44. FakeHeartbeat.Event:wait(0)
  45. end
  46. return tick() - stime, workspace.DistributedGameTime
  47. end
  48.  
  49. local ScreenGui = Instance.new("ScreenGui")
  50. local TextBox = Instance.new("TextBox")
  51. local TextButton = Instance.new("TextButton")
  52.  
  53. ScreenGui.Parent = game.Players.LocalPlayer.PlayerGui
  54.  
  55. TextBox.Parent = ScreenGui
  56. TextBox.BackgroundColor3 = Color3.new(0.529412, 0.529412, 0.529412)
  57. TextBox.Position = UDim2.new(0, 0, 0, 300)
  58. TextBox.Size = UDim2.new(0, 200, 0, 50)
  59. TextBox.Font = Enum.Font.SciFi
  60. TextBox.FontSize = Enum.FontSize.Size14
  61.  
  62. TextButton.Parent = TextBox
  63. TextButton.BackgroundColor3 = Color3.new(1, 0, 0.0156863)
  64. TextButton.Position = UDim2.new(0, 200, 0, 0)
  65. TextButton.Size = UDim2.new(0, 50, 0, 50)
  66. TextButton.Font = Enum.Font.SciFi
  67. TextButton.FontSize = Enum.FontSize.Size14
  68. TextButton.Text = "OK"
  69.  
  70. -------------------------
  71.  
  72. a=Instance.new("Part", game.Players.LocalPlayer.Character)
  73. a.Name = "Visualizer"
  74. a.Anchored = false
  75. a.CanCollide = false
  76. a.Size = Vector3.new(0,0,0)
  77. a.BrickColor = BrickColor.new("Really red")
  78. a.Material = "Neon"
  79. a.Transparency = 0.5
  80. b = Instance.new("SpecialMesh")
  81. b.MeshType = "Sphere"
  82. b.Parent = a
  83.  
  84. we = Instance.new("Weld")
  85. we.Part0 = a
  86. we.Part1 = game.Players.LocalPlayer.Character.Torso
  87. we.C0 = CFrame.new(-2.5, -3, 5)*CFrame.fromEulerAnglesXYZ(0, -90, 0)
  88. we.Parent = a
  89.  
  90. c=Instance.new("Part", game.Players.LocalPlayer.Character)
  91. c.Name = "Visualizer2"
  92. c.Anchored = false
  93. c.CanCollide = false
  94. c.Size = Vector3.new(0,0,0)
  95. c.BrickColor = BrickColor.new("White")
  96. c.Material = "Neon"
  97. c.Transparency = 0
  98. d = Instance.new("SpecialMesh")
  99. d.MeshType = "Sphere"
  100. d.Parent = c
  101.  
  102. we2 = Instance.new("Weld")
  103. we2.Part0 = c
  104. we2.Part1 = game.Players.LocalPlayer.Character.Torso
  105. we2.C0 = CFrame.new(-2.5, -3, 5)*CFrame.fromEulerAnglesXYZ(0, -90, 0)
  106. we2.Parent = c
  107.  
  108. model2 = Instance.new("Model", game.Players.LocalPlayer.Character)
  109. model2.Name = "Rings"
  110.  
  111. local ri = Instance.new("Part", model2)
  112. ri.Name = "Wave"
  113. ri.Anchored = true
  114. ri.Transparency = 0
  115. ri.Size = Vector3.new(0, 0, 0)
  116. ri.CanCollide = false
  117. ri.Rotation = Vector3.new(90, 0, 0)
  118. ri.BrickColor = BrickColor.new("Really black")
  119. local mesh4 = Instance.new("SpecialMesh")
  120. mesh4.MeshType = "FileMesh"
  121. mesh4.MeshId = "http://www.roblox.com/asset/?id=3270017"
  122. mesh4.Parent = ri
  123.  
  124. local ri2 = Instance.new("Part", model2)
  125. ri2.Name = "Wave"
  126. ri2.Anchored = true
  127. ri2.Transparency = 0
  128. ri2.Size = Vector3.new(0, 0, 0)
  129. ri2.CanCollide = false
  130. ri2.Rotation = Vector3.new(90, 0, 0)
  131. ri2.BrickColor = BrickColor.new("Really black")
  132. local mesh5 = Instance.new("SpecialMesh")
  133. mesh5.MeshType = "FileMesh"
  134. mesh5.MeshId = "http://www.roblox.com/asset/?id=3270017"
  135. mesh5.Parent = ri2
  136.  
  137. for _, v in pairs(model2:GetChildren()) do
  138. local newPos = Instance.new("BodyPosition") -- making a BodyPosition to put in each ring so that the rings will stay in the right place
  139. newPos.Parent = v
  140. newPos.position = a.Position
  141. newPos.maxForce = Vector3.new(math.huge,math.huge,math.huge)
  142. local newSpin = Instance.new("BodyAngularVelocity") -- this is to make the rings spin
  143. newSpin.Parent = v
  144. local spinPower = 10000
  145. newSpin.maxTorque = Vector3.new(spinPower,spinPower,spinPower)
  146. newSpin.angularvelocity = Vector3.new(math.random(0,200)/100,math.random(0,200)/100,math.random(0,200)/100) -- making thier spin random
  147. v.CFrame = v.CFrame * CFrame.Angles(math.random(1,360),math.random(1,360),math.random(1,360)) -- starting the ring at a random rotation
  148. v.Anchored = false -- unanchoring the ring after it is set up so that it can now spin
  149. end
  150.  
  151. wave = function()
  152. if doingwave == false then
  153. doingwave = true
  154. local ioe = Instance.new("Part", game.Players.LocalPlayer.Character)
  155. ioe.Name = "Wave"
  156. ioe.Anchored = true
  157. ioe.Transparency = 0
  158. ioe.Size = Vector3.new(0, 0, 0)
  159. ioe.CanCollide = false
  160. ioe.Rotation = Vector3.new(90, 0, 0)
  161. ioe.BrickColor = BrickColor.new("Really black")
  162. local mesh = Instance.new("SpecialMesh")
  163. mesh.MeshType = "FileMesh"
  164. mesh.MeshId = "http://www.roblox.com/asset/?id=3270017"
  165. mesh.Parent = ioe
  166. mesh.Scale = Vector3.new(1.1, 1.1, 1.1)
  167. coroutine.resume(coroutine.create(function()
  168. for i = 1, 10 do
  169. swait()
  170. ioe.Position = a.Position
  171. mesh.Scale = mesh.Scale + Vector3.new(mesh.Scale.x / 3, mesh.Scale.y / 3, 0.5)
  172. ioe.Transparency = ioe.Transparency + 0.01
  173. end
  174. ioe:Destroy()
  175. doingwave = false
  176. end))
  177. else
  178. return
  179. end
  180. end
  181.  
  182. function onClicked()
  183. local id = TextBox.Text
  184. if a:FindFirstChild("Sound") then
  185. a.Sound:Destroy()
  186. end
  187. local sou = Instance.new("Sound", a)
  188. sou.Looped = true
  189. sou.Pitch = 1
  190. sou.Volume = 1
  191. sou.SoundId = ("http://www.roblox.com/asset/?id="..id)
  192. wait()
  193. sou:Play()
  194. end
  195. TextButton.MouseButton1Down:connect(onClicked)
  196.  
  197. coroutine.resume(coroutine.create(function()
  198. game:GetService("RunService").RenderStepped:connect(function()
  199. if a:FindFirstChild("Sound") ~= nil then
  200. local soundvolume = a.Sound.PlaybackLoudness
  201. b.Scale = Vector3.new(soundvolume / 20, soundvolume / 20, soundvolume / 20)
  202. d.Scale = Vector3.new(soundvolume / 60, soundvolume / 60, soundvolume / 60)
  203. mesh5.Scale = Vector3.new(soundvolume / 120, soundvolume / 120, 0.5)
  204. mesh4.Scale = Vector3.new(soundvolume / 120, soundvolume / 120, 0.5)
  205. ri.Transparency = 0
  206. ri2.Transparency = 0
  207. ri.Position = a.Position
  208. ri2.Position = a.Position
  209. if soundvolume < 150 then
  210. a.BrickColor = BrickColor.new("Black")
  211. c.BrickColor = BrickColor.new("White")
  212. elseif soundvolume >= 500 and soundvolume <= 750 then
  213. a.BrickColor = BrickColor.new("White")
  214. c.BrickColor = BrickColor.new("Black")
  215. wave()
  216. elseif soundvolume > 750 then
  217. a.BrickColor = BrickColor.random()
  218. c.BrickColor = BrickColor.new("White")
  219. elseif soundvolume <= 500 and soundvolume >= 150 then
  220. a.BrickColor = BrickColor.new("Really red")
  221. c.BrickColor = BrickColor.new("White")
  222. end
  223. else
  224. b.Scale = Vector3.new(0.01, 0.01, 0.01)
  225. d.Scale = Vector3.new(0.01, 0.01, 0.01)
  226. ri.Transparency = 1
  227. ri2.Transparency = 1
  228. end
  229. end)
  230. end))
Add Comment
Please, Sign In to add comment