Advertisement
epicdude6951

Untitled

Dec 9th, 2016
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.95 KB | None | 0 0
  1. --[[
  2. Author: 12GaugeNick
  3. File-Type: LocalScript
  4. Date: 10/16/2016
  5. Notes:
  6. *PLEASE DO NOT STEAL CREDIT FOR MY WORK!*
  7. ~Script will work on ScriptBuilder~
  8. ~Any sounds will work on this~
  9.  
  10. --]]
  11.  
  12.  
  13. local OwnerName,Owner = "SSKADFF23", game.Players.LocalPlayer
  14.  
  15. local Players = game:GetService("Players")
  16. local RunService = game:GetService("RunService")
  17. local Content = game:GetService("ContentProvider")
  18. local Market = game:GetService("MarketplaceService")
  19.  
  20. local SoundPos = 0
  21. local rad = math.rad
  22. local abs = math.abs
  23. local sin = math.sin
  24.  
  25. local ScriptComplete = false
  26. local BreakLoop = false
  27.  
  28. local Cam = workspace.CurrentCamera
  29. local Sound = Instance.new("Sound", Cam)
  30.  
  31. local SoundData = {}
  32. local ChatConnections = {}
  33. local Bars = {}
  34. local LoadedEq = {}
  35. local Songs,SIndex = {
  36. 268362040,
  37. 180687152,
  38. 212377911,
  39. 438917260,
  40. 229406882,
  41. 173125494,
  42. 365768377,
  43. 240054278,
  44. 247813691,
  45. 142963968,
  46. 161498572,
  47. 285328190,
  48. 222370123,
  49. 359339539,
  50. },0
  51.  
  52. ------------------------------------------------------------
  53. ----------------------- FUNCTIONS --------------------------
  54. ------------------------------------------------------------
  55.  
  56. function gPart(Part)
  57. for Num,Part in next,Bars do
  58. if Part == Part then
  59. return Num
  60. end
  61. end
  62. end
  63.  
  64. function fadeOut(Part)
  65. spawn(function()
  66. repeat RunService.Heartbeat:wait()
  67. Part.Transparency = Part.Transparency + .05
  68. until Part.Transparency>=1
  69. end)
  70. end
  71.  
  72. function addBar(Size, Color)
  73. local Part = Instance.new("Part", Cam)
  74. Part.Material = "Neon"
  75. Part.Transparency = .5
  76. Part.Anchored = true
  77. Part.Size = Vector3.new(.2,Size or 1,.4)
  78. Part.CanCollide = false
  79. Part.Color = Color3.new(0,Color,0)
  80. delay(10,function()
  81. Part:Destroy()
  82. end)
  83. table.insert(Bars, Part)
  84. end
  85.  
  86. function cLerp(p1,p2,percent)
  87. local p1x,p1y,p1z,p1R00,p1R01,p1R02,p1R10,p1R11,p1R12,p1R20,p1R21,p1R22=p1:components()
  88. local p2x,p2y,p2z,p2R00,p2R01,p2R02,p2R10,p2R11,p2R12,p2R20,p2R21,p2R22=p2:components()
  89. return CFrame.new(p1x+percent*(p2x-p1x),p1y+percent*(p2y-p1y),p1z+percent*(p2z-p1z),
  90. p1R00+percent*(p2R00-p1R00),p1R01+percent*(p2R01-p1R01),p1R02+percent*(p2R02-p1R02),
  91. p1R10+percent*(p2R10-p1R10),p1R11+percent*(p2R11-p1R11),p1R12+percent*(p2R12-p1R12),
  92. p1R20+percent*(p2R20-p1R20),p1R21+percent*(p2R21-p1R21),p1R22+percent*(p2R22-p1R22))
  93. end
  94.  
  95. function connectChat(Player)
  96. Player.Chatted:connect(function(Msg)
  97. if Msg:sub(1,3) == "/e " then
  98. Msg = Msg:sub(4)
  99. end
  100. if Msg:lower():sub(1,4) == "next" then
  101. playSong()
  102. end
  103. if Msg:lower():sub(1,4) == "play" then
  104. playSong(Msg:sub(6))
  105. end
  106. if Msg:lower():sub(1,9) == "nightcore" then
  107. if not Sound:FindFirstChild("PitchShiftSoundEffect") then
  108. local effect = Instance.new("PitchShiftSoundEffect",Sound)
  109. effect.Octave = 1.4
  110. else
  111. pcall(function()
  112. Sound.PitchShiftSoundEffect:Destroy()
  113. end)
  114. end
  115. end
  116. if Msg:lower():sub(1,6) == "reverb" then
  117. if not Sound:FindFirstChild("ReverbSoundEffect") then
  118. Instance.new("ReverbSoundEffect",Sound)
  119. else
  120. pcall(function()
  121. Sound.ReverbSoundEffect:Destroy()
  122. end)
  123. end
  124. end
  125. end)
  126. end
  127.  
  128. function songData(id, Data)
  129. return Market:GetProductInfo(id)[Data]
  130. end
  131.  
  132. function sIndex()
  133. if SIndex >= #Songs then
  134. SIndex = 0
  135. end
  136. SIndex = SIndex + 1
  137. return Songs[SIndex]
  138. end
  139.  
  140. function playSong(Id)
  141. BreakLoop = true
  142. Sound:Stop()
  143. Sound:ClearAllChildren()
  144. if Id == nil or not Id then
  145. Id = sIndex()
  146. end
  147. for i,v in next,Bars do
  148. v:Destroy()
  149. end
  150. repeat wait() print(#Bars) until #Bars==0
  151. BreakLoop = false
  152. Sound.SoundId = "rbxassetid://"..tostring(Id)
  153. Sound:Play()
  154. spawn(function()
  155. while wait(.05) do
  156. if BreakLoop == true then
  157. break
  158. end
  159. local Size = abs(Sound.PlaybackLoudness/70)
  160. local Trans = Sound.PlaybackLoudness
  161. local Color = (Sound.PlaybackLoudness/255)
  162. addBar(Size, Color)
  163. end
  164. end)
  165. end
  166.  
  167. ------------------------------------------------------------
  168. ------------------------ LOOPS -----------------------------
  169. ------------------------------------------------------------
  170.  
  171. for _,v in next,Songs do
  172. Content:Preload("rbxassetid://"..v)
  173. end
  174.  
  175. RunService.Heartbeat:connect(function()
  176. if ScriptComplete then
  177. for i,Part in next,Bars do
  178. if Part.Parent == Cam then
  179. local Char,Pos = workspace:FindFirstChild(OwnerName),CFrame.new(0,5,0).p
  180. if Char then
  181. Char = (Char.Torso.CFrame*CFrame.new(0,3,0)).p
  182. end
  183. Part.CFrame = cLerp(Part.CFrame,CFrame.new(Pos)*CFrame.Angles(0,rad(i*(360/#Bars)),0)*CFrame.new(#Bars/9,0,0),.07)
  184. else
  185. table.remove(Bars, i)
  186. end
  187. end
  188. end
  189. end)
  190.  
  191. ------------------------------------------------------------
  192. ------------------------ EVENTS ----------------------------
  193. ------------------------------------------------------------
  194.  
  195. Sound.Changed:connect(function(Prop)
  196. if Prop == "Parent" and Sound.Parent ~= workspace then
  197. Sound = Instance.new("Sound",workspace)
  198. BreakLoop = true
  199. playSong()
  200. end
  201. end)
  202. Sound.Ended:connect(function()
  203. BreakLoop = true
  204. playSong()
  205. end)
  206.  
  207. for _,Player in next,Players:GetChildren() do
  208. if Player.Name:lower() == OwnerName:lower() then
  209. ChatConnections[Player.UserId] = Player.UserId
  210. Owner = Player
  211. connectChat(Player)
  212. end
  213. end
  214.  
  215. Players.PlayerAdded:connect(function(Player)
  216. if Player.Name:lower() == OwnerName:lower() then
  217. ChatConnections[Player.UserId] = Player.UserId
  218. Owner = Player
  219. connectChat(Player)
  220. end
  221. end)
  222.  
  223. Players.PlayerRemoving:connect(function(Player)
  224. if ChatConnections[Player.UserId] then
  225. ChatConnections[Player.UserId] = nil
  226. end
  227. end)
  228.  
  229. if not game:FindService("NetworkServer") then
  230. connectChat(Players:WaitForChild("Player1"))
  231. end
  232.  
  233. ------------------------------------------------------------
  234. ----------------------- END SCRIPT -------------------------
  235. ------------------------------------------------------------
  236.  
  237. ScriptComplete = true
  238. playSong()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement