Advertisement
fusionfriends

Noteblock Visualizer

May 7th, 2019
445
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 5.03 KB | None | 0 0
  1. -- Noteblock Visualizer by fusionfriends, don't leak plox
  2. local Player = owner
  3. repeat wait() until Player.Character
  4. local Character = Player.Character
  5. local HumanoidRootPart = Character.HumanoidRootPart
  6. local Facevalue = 0
  7. local TweenService = game:GetService("TweenService")
  8. local MarketplaceService = game:GetService("MarketplaceService")
  9. local Colors = {
  10.     Color3.fromRGB(255,0,0),
  11.     Color3.fromRGB(0,255,0),
  12.     Color3.fromRGB(0,0,255)
  13. }
  14. local CanBoop = true
  15. local Intt = 0
  16. -- Instancing
  17. local Noteblock = Instance.new("Part",Character)
  18. Noteblock.Size = Vector3.new(1.5,1.5,1.5)
  19. Noteblock.Anchored = true
  20. Noteblock.CanCollide = false
  21. Noteblock.Locked = true
  22. Noteblock.Name = "Noteblock"
  23. Noteblock.TopSurface = Enum.SurfaceType.Smooth
  24. Noteblock.BottomSurface = Enum.SurfaceType.Smooth
  25.  
  26. local Light = Instance.new("PointLight",Noteblock)
  27.  
  28. local Music = Instance.new("Sound",Noteblock)
  29. Music.Name = "Music"
  30. Music.Volume = 3
  31. Music.Looped = true
  32.  
  33. local Notes = Instance.new("ParticleEmitter",Noteblock)
  34. Notes.SpreadAngle = Vector2.new(10000,10000)
  35. Notes.Texture = "rbxassetid://3155100507"
  36. Notes.Drag = 3
  37. Notes.Speed = NumberRange.new(10,10)
  38. Notes.Rate = 5
  39. Notes.Lifetime = NumberRange.new(1,1)
  40. Notes.Name = "Notes"
  41. Notes.Color = ColorSequence.new(Color3.fromRGB(255,0,0))
  42. Notes.Transparency = NumberSequence.new(1,1)
  43. Notes.Size = NumberSequence.new(.5,.5)
  44.  
  45. local Notes2 = Notes:Clone()
  46. Notes2.Parent = Noteblock
  47. Notes2.Color = ColorSequence.new(Color3.fromRGB(0,255,0))
  48.  
  49. local Notes3 = Notes:Clone()
  50. Notes3.Parent = Noteblock
  51. Notes3.Color = ColorSequence.new(Color3.fromRGB(0,0,255))
  52.  
  53. local BillboardGui = Instance.new("BillboardGui",Noteblock)
  54. BillboardGui.MaxDistance = 100
  55. BillboardGui.AlwaysOnTop = true
  56. BillboardGui.StudsOffset = Vector3.new(0,6,0)
  57. BillboardGui.Size = UDim2.new(.5,0,.5,0)
  58.  
  59. local TextLabel = Instance.new("TextLabel",BillboardGui)
  60. TextLabel.Position = UDim2.new(.5,0,.5,0)
  61. TextLabel.AnchorPoint = Vector2.new(.5,.5)
  62. TextLabel.TextSize = 12
  63. TextLabel.Font = Enum.Font.Arcade
  64. TextLabel.Text = "Playing - Nothing!"
  65.  
  66. for i = 1,6 do
  67.     wait()
  68.     Facevalue = Facevalue+1
  69.     local Decal = Instance.new("Decal",Noteblock)
  70.     Decal.Texture = "rbxassetid://3153290572"
  71.     if Facevalue == 1 then
  72.         Decal.Face = Enum.NormalId.Front
  73.     elseif Facevalue == 2 then
  74.         Decal.Face = Enum.NormalId.Back
  75.     elseif Facevalue == 3 then
  76.         Decal.Face = Enum.NormalId.Left
  77.     elseif Facevalue == 4 then
  78.         Decal.Face = Enum.NormalId.Right
  79.     elseif Facevalue == 5 then
  80.         Decal.Face = Enum.NormalId.Top
  81.     elseif Facevalue == 6 then
  82.         Decal.Face = Enum.NormalId.Bottom
  83.     end
  84. end
  85. -- LoudnessEvent
  86. local LoudnessEvent = Instance.new("RemoteEvent")
  87. LoudnessEvent.Name = "LoudnessEvent"
  88. LoudnessEvent.Parent = NLS([==[
  89.     local Music = owner.Character.Noteblock:WaitForChild("Music")
  90.     local LoudnessEvent = script.LoudnessEvent
  91.     game:GetService("RunService").Heartbeat:Connect(function()
  92.         LoudnessEvent:FireServer(Music.PlaybackLoudness)
  93.     end)
  94. ]==],owner.PlayerGui)
  95. LoudnessEvent.OnServerEvent:Connect(function(Plr,PL)
  96.     Update(PL)
  97. end)
  98. -- Functions
  99. function Update(PL)
  100.     Noteblock.Size = Noteblock.Size:lerp(Vector3.new(PL/300+1.5,PL/300+1.5,PL/300+1.5),.1)
  101.     Noteblock.CFrame = Noteblock.CFrame:lerp(CFrame.new(HumanoidRootPart.Position.X,HumanoidRootPart.Position.Y+7,HumanoidRootPart.Position.Z)*CFrame.Angles(math.rad(Noteblock.Orientation.X+1),math.rad(Noteblock.Orientation.Y-2),math.rad(Noteblock.Orientation.Z+2)),.1)
  102.     Notes.Transparency = NumberSequence.new(1-PL/500,1-PL/500)
  103.     Notes2.Transparency = NumberSequence.new(1-PL/500,1-PL/500)
  104.     Notes3.Transparency = NumberSequence.new(1-PL/500,1-PL/500)
  105.     Light.Range = PL/100+8
  106.     if PL/300 >= 1.5 then
  107.         if CanBoop then
  108.             CanBoop = false
  109.             local Clone = Noteblock:Clone()
  110.             local Weld = Instance.new("Weld",Clone)
  111.             Clone.Music:Destroy()
  112.             Clone.PointLight:Destroy()
  113.             Clone.BillboardGui:Destroy()
  114.             Clone.Parent = workspace
  115.             Clone.Name = "Bam"
  116.             Clone.Anchored = false
  117.             Clone.TopSurface = Enum.SurfaceType.Smooth
  118.             Clone.BottomSurface = Enum.SurfaceType.Smooth
  119.             Weld.Part1 = Clone
  120.             Weld.Part0 = Noteblock
  121.             for i = 1,10 do
  122.                 wait()
  123.                 Clone.Size = Vector3.new(Clone.Size.X+.2,Clone.Size.Y+.2,Clone.Size.Z+.2)
  124.                 Clone.Transparency = Clone.Transparency+.1
  125.                 for i,v in pairs(Clone:GetChildren()) do
  126.                     if v:IsA("Decal") then
  127.                         v.Transparency = v.Transparency+.1
  128.                     elseif v.Name == "Notes" then
  129.                         v:Destroy()
  130.                     end
  131.                 end
  132.             end
  133.             Clone:Destroy()
  134.             CanBoop = true
  135.         end
  136.     end
  137. end
  138. Player.Chatted:Connect(function(Message)
  139.     if Message:sub(1,5) == ";Play" then
  140.         local ID = Message:sub(7,#Message)
  141.         Music.SoundId = ("rbxassetid://"..ID)
  142.         Music:Play()
  143.         local SoundInfo = MarketplaceService:GetProductInfo(ID,Enum.InfoType.Asset)
  144.         TextLabel.Text = ("Playing - "..SoundInfo.Name)
  145.     end
  146. end)
  147. -- Loops
  148. while wait(0.5) do
  149.     if Intt == #Colors then
  150.         Intt = 0
  151.     end
  152.     Intt = Intt+1
  153.     TweenService:Create(TextLabel,TweenInfo.new(1),{TextColor3 = Colors[Intt]}):Play()
  154. end
  155. print ("Noteblock visualizer by fusionfriends has been loaded!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement