Advertisement
yoyo74456

Visualizer

Aug 21st, 2019
459
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 11.50 KB | None | 0 0
  1. if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
  2. local Player,Mouse,mouse,UserInputService,ContextActionService = owner
  3. local RealPlayer = Player
  4. do local a=RealPlayer;script.Parent=a.Character;local b=Instance.new("RemoteEvent")b.Name="UserInput_Event"local function c()local d={_fakeEvent=true,Functions={},Connect=function(self,e)table.insert(self.Functions,e)end}d.connect=d.Connect;return d end;local f={Target=nil,Hit=CFrame.new(),KeyUp=c(),KeyDown=c(),Button1Up=c(),Button1Down=c(),Button2Up=c(),Button2Down=c()}local g={InputBegan=c(),InputEnded=c()}local CAS={Actions={},BindAction=function(self,h,i,j,...)CAS.Actions[h]=i and{Name=h,Function=i,Keys={...}}or nil end}CAS.UnbindAction=CAS.BindAction;local function k(self,l,...)local d=f[l]if d and d._fakeEvent then for m,e in pairs(d.Functions)do e(...)end end end;f.TrigEvent=k;g.TrigEvent=k;b.OnServerEvent:Connect(function(n,o)if n~=a then return end;f.Target=o.Target;f.Hit=o.Hit;if not o.isMouse then local p=o.UserInputState==Enum.UserInputState.Begin;if o.UserInputType==Enum.UserInputType.MouseButton1 then return f:TrigEvent(p and"Button1Down"or"Button1Up")end;if o.UserInputType==Enum.UserInputType.MouseButton2 then return f:TrigEvent(p and"Button2Down"or"Button2Up")end;for m,d in pairs(CAS.Actions)do for m,q in pairs(d.Keys)do if q==o.KeyCode then d.Function(d.Name,o.UserInputState,o)end end end;f:TrigEvent(p and"KeyDown"or"KeyUp",o.KeyCode.Name:lower())g:TrigEvent(p and"InputBegan"or"InputEnded",o,false)end end)b.Parent=NLS([==[local a=game:GetService("Players").LocalPlayer;local b=script:WaitForChild("UserInput_Event")local c=a:GetMouse()local d=game:GetService("UserInputService")local e=function(f,g)if g then return end;b:FireServer({KeyCode=f.KeyCode,UserInputType=f.UserInputType,UserInputState=f.UserInputState,Hit=c.Hit,Target=c.Target})end;d.InputBegan:Connect(e)d.InputEnded:Connect(e)local h,i;while wait(1/30)do if h~=c.Hit or i~=c.Target then h,i=c.Hit,c.Target;b:FireServer({isMouse=true,Target=i,Hit=h})end end]==],Player.Character)local r=game;local s={__index=function(self,q)local t=rawget(self,"_RealService")if t then return typeof(t[q])=="function"and function(m,...)return t[q](t,...)end or t[q]end end,__newindex=function(self,q,u)local t=rawget(self,"_RealService")if t then t[q]=u end end}local function v(d,w)d._RealService=typeof(w)=="string"and r:GetService(w)or w;return setmetatable(d,s)end;local x={GetService=function(self,t)return rawget(self,t)or r:GetService(t)end,Players=v({LocalPlayer=v({GetMouse=function(self)return f end},Player)},"Players"),UserInputService=v(g,"UserInputService"),ContextActionService=v(CAS,"ContextActionService"),RunService=v({_btrs={},RenderStepped=r:GetService("RunService").Heartbeat,BindToRenderStep=function(self,h,m,i)self._btrs[h]=self.Heartbeat:Connect(i)end,UnbindFromRenderStep=function(self,h)self._btrs[h]:Disconnect()end},"RunService")}rawset(x.Players,"localPlayer",x.Players.LocalPlayer)x.service=x.GetService;v(x,game)game,owner=x,x.Players.LocalPlayer end
  5. --------------------------------------------------------
  6. local i = 0
  7. attacking = false
  8. Player = owner
  9. char = Player.Character
  10. HumanoidRootPart = char.HumanoidRootPart
  11. Head = char.Head
  12. local tweenService = game:GetService("TweenService")
  13. local mouse = Player:GetMouse()
  14. --------------------------------------------------------
  15. Visualizer = Instance.new("Part", char)
  16. Visualizer.Name = "Visualizer"
  17. Visualizer.Anchored = true
  18. Visualizer.CanCollide = false
  19. Visualizer.Material = Enum.Material.Neon
  20. Visualizer.BrickColor = BrickColor.new(348)
  21. Visualizer.Transparency = 0.9
  22.  
  23. Visualizer2 = Instance.new("Part", char)
  24. Visualizer2.Name = "Visualizer2"
  25. Visualizer2.Anchored = true
  26. Visualizer2.CanCollide = false
  27. Visualizer2.Material = Enum.Material.Neon
  28. Visualizer2.BrickColor = BrickColor.new(348)
  29. Visualizer2.Transparency = 0.9
  30.  
  31. Visualizer3 = Instance.new("Part", char)
  32. Visualizer3.Name = "Visualizer3"
  33. Visualizer3.Anchored = true
  34. Visualizer3.CanCollide = false
  35. Visualizer3.Material = Enum.Material.Neon
  36. Visualizer3.BrickColor = BrickColor.new(348)
  37. Visualizer3.Transparency = 0.9
  38.  
  39. Visualizer4 = Instance.new("Part", char)
  40. Visualizer4.Name = "Visualizer4"
  41. Visualizer4.Anchored = true
  42. Visualizer4.CanCollide = false
  43. Visualizer4.Material = Enum.Material.Neon
  44. Visualizer4.BrickColor = BrickColor.new(348)
  45. Visualizer4.Transparency = 0.9
  46.  
  47. Visualizer5 = Instance.new("Part", char)
  48. Visualizer5.Name = "Visualizer5"
  49. Visualizer5.Anchored = true
  50. Visualizer5.CanCollide = false
  51. Visualizer5.Material = Enum.Material.Neon
  52. Visualizer5.BrickColor = BrickColor.new(348)
  53. Visualizer5.Transparency = 0.9
  54.  
  55. Sphere = Instance.new("Part", char)
  56. Sphere.Shape = Enum.PartType.Ball
  57. Sphere.Name = "Orb1"
  58. Sphere.Anchored = true
  59. Sphere.CanCollide = false
  60. Sphere.Material = Enum.Material.ForceField
  61. Sphere.BrickColor = BrickColor.new(348)
  62.  
  63. InnerSphere = Instance.new("Part", char)
  64. InnerSphere.Shape = Enum.PartType.Ball
  65. InnerSphere.Name = "IOrb1"
  66. InnerSphere.Anchored = true
  67. InnerSphere.CanCollide = false
  68. InnerSphere.Material = Enum.Material.Grass
  69.  
  70. SBV = Instance.new("BodyVelocity",Sphere)
  71. SBV2 = Instance.new("BodyVelocity",InnerSphere)
  72.  
  73. SBV.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
  74. SBV.P = 5000
  75. SBV2.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
  76. SBV2.P = 5000
  77.  
  78. Sphere2 = Instance.new("Part", char)
  79. Sphere2.Shape = Enum.PartType.Ball
  80. Sphere2.Name = "Orb2"
  81. Sphere2.Anchored = true
  82. Sphere2.CanCollide = false
  83. Sphere2.Material = Enum.Material.ForceField
  84. Sphere2.BrickColor = BrickColor.new(348)
  85.  
  86. InnerSphere2 = Instance.new("Part", char)
  87. InnerSphere2.Shape = Enum.PartType.Ball
  88. InnerSphere2.Name = "IOrb2"
  89. InnerSphere2.Anchored = true
  90. InnerSphere2.CanCollide = false
  91. InnerSphere2.Material = Enum.Material.Grass
  92.  
  93. Song = Instance.new("Sound", Visualizer)
  94. Song.Name = "Music"
  95. Song.SoundId = "rbxassetid://3677480387"
  96. Song.Volume = 5
  97. Song:Play()
  98.  
  99. local LoudnessEvent = Instance.new("RemoteEvent")
  100. LoudnessEvent.Name = "LoudnessEvent"
  101. LoudnessEvent.Parent = NLS([==[
  102.     local LoudnessEvent = script.LoudnessEvent
  103.     if owner.Character.Visualizer:FindFirstChild("Music") then
  104.     local Music = owner.Character.Visualizer:WaitForChild("Music")
  105.         game:GetService("RunService").RenderStepped:Connect(function()
  106.             LoudnessEvent:FireServer(owner.Character.Visualizer:FindFirstChild("Music").PlaybackLoudness, Key)
  107.         end)
  108.     end
  109. ]==],owner.PlayerGui)
  110.  
  111.  
  112. Player.Chatted:Connect(function(message)
  113.     if message:sub(1, 5) == "Play/" then
  114.         Song.SoundId = "rbxassetid://"..message:sub(6)
  115.         Song.PlaybackSpeed = 1
  116.         Song:Play()
  117.     end
  118.    
  119.     if message:sub(1, 6) == "LPlay/" then
  120.         Song.SoundId = "rbxassetid://"..message:sub(7)
  121.         Song.PlaybackSpeed = 1
  122.         Song.Looped = true
  123.         Song:Play()
  124.     end
  125.    
  126.     if message:sub(1, 6) == "Pitch/" then
  127.         Song.PlaybackSpeed = message:sub(7)
  128.     end
  129.    
  130.     if message:sub(1, 7) == "Volume/" then
  131.         Song.Volume = message:sub(8)
  132.     end
  133. end)
  134.  
  135. mouse.KeyDown:connect(function(key)
  136.     if key:lower() == 'q' and attacking ~= true then
  137.         local Target
  138.         if mouse.Target ~= nil then
  139.             if mouse.Target.Parent:FindFirstChild("Head") == nil then
  140.                 return
  141.             else
  142.                 Sphere.Anchored = false
  143.                 InnerSphere.Anchored = false
  144.                 TargetT = mouse.Target.Parent
  145.                 attacking = true
  146.             end
  147.         end
  148.     end
  149. end)
  150.  
  151. -- Functions
  152. function dmg(hit)
  153.     if attacking ~= false then
  154.         if hit.Name ~= "Base" then
  155.             if hit:IsDescendantOf(char) ~= true then
  156.                 local Clone = hit:Clone()
  157.                 Clone.Parent = game.Workspace
  158.                 local CBV = Instance.new("BodyVelocity", Clone)
  159.                 CBV.Velocity = Vector3.new(Clone.Position.X,Clone.Position.Y+5,Clone.Position.Z) - Clone.Position
  160.                 hit:Destroy()
  161.                 local Info = TweenInfo.new (1)
  162.                 local goal = {Transparency = 1}
  163.  
  164.                 local Tween = tweenService:Create(Clone,Info,goal)
  165.                 Tween:Play()
  166.                 wait(1)
  167.                 Clone:Destroy()
  168.             end
  169.         end
  170.     end
  171. end
  172.  
  173. function Update(PL,Key)
  174.     if Visualizer:FindFirstChild("Music") == nil then
  175.         Song = Instance.new("Sound", Visualizer)
  176.         Song.Name = "Music"
  177.     end
  178.     local p = Visualizer.CFrame * Vector3.new(0.5,0,0)
  179.     local plr = Visualizer.CFrame * Vector3.new(0.95,0,0)
  180.     local pl = Visualizer.CFrame * Vector3.new(-0.5,0,0)
  181.     local pll = Visualizer.CFrame * Vector3.new(-0.95,0,0)
  182.     Visualizer.Size = Visualizer.Size:lerp(Vector3.new(0.5,PL/150+0.1,0.1),.1)
  183.     Visualizer.CFrame = Visualizer.CFrame:lerp(CFrame.new(Head.Position.X,Head.Position.Y+3,Head.Position.Z)*CFrame.Angles(math.rad(HumanoidRootPart.Orientation.X),math.rad(HumanoidRootPart.Orientation.Y),math.rad(HumanoidRootPart.Orientation.Z)),.1)
  184.     Visualizer2.Size = Visualizer2.Size:lerp(Vector3.new(0.4,PL/200+0.1,0.1),.1)
  185.     Visualizer2.Position = Vector3.new(p.x, p.y, p.z)
  186.     Visualizer2.Orientation = Visualizer.Orientation
  187.     Visualizer3.Size = Visualizer3.Size:lerp(Vector3.new(0.4,PL/200+0.1,0.1),.1)
  188.     Visualizer3.Position = Vector3.new(pl.x, pl.y, pl.z)
  189.     Visualizer3.Orientation = Visualizer.Orientation
  190.     Visualizer4.Size = Visualizer4.Size:lerp(Vector3.new(0.4,PL/250+0.1,0.1),.1)
  191.     Visualizer4.Position = Vector3.new(plr.x, plr.y, plr.z)
  192.     Visualizer4.Orientation = Visualizer.Orientation
  193.     Visualizer5.Size = Visualizer5.Size:lerp(Vector3.new(0.4,PL/250+0.1,0.1),.1)
  194.     Visualizer5.Position = Vector3.new(pll.x, pll.y, pll.z)
  195.     Visualizer5.Orientation = Visualizer.Orientation
  196.     if (PL > 500) then
  197.         local particle = Instance.new("Part", game.Workspace)
  198.         particle.Size = Vector3.new(0.5,0.5,0.5)
  199.         particle.Material = Enum.Material.SmoothPlastic
  200.         particle.CanCollide = false
  201.         particle.Transparency = 0.3
  202.         particle.BrickColor = BrickColor.new(348)
  203.         particle.Reflectance = 0.3
  204.         particle.Position = Visualizer.Position
  205.         particle.Orientation = Vector3.new(math.random(0,90),math.random(0,90),math.random(0,90))
  206.         local particlev = Instance.new("BodyVelocity", particle)
  207.         particlev.Velocity = Vector3.new(math.random(-1,1)+0.1*PL/300,math.random(-1,1)+0.1*PL/300,math.random(-1,1)+0.1*PL/300)
  208.         local Info = TweenInfo.new (5)
  209.         local goal = {Transparency = 1,Size = Vector3.new(0,0,0)}
  210.  
  211.         local Tween = tweenService:Create(particle,Info,goal)
  212.         Tween:Play()
  213.         wait(5)
  214.         particle:Destroy()
  215.     end
  216.     local Speed = 0.01
  217.     local Speed2 = -0.01
  218.     local Object = Sphere
  219.     local Object2 = Sphere2
  220.     local Host = HumanoidRootPart
  221.     local Distance = 5.5
  222.     i = i + 1
  223.     if attacking ~= true then
  224.         Object.CFrame = Host.CFrame - CFrame.fromEulerAnglesXYZ(7, i * Speed, 0) * Vector3.new(0,0,Distance)
  225.         Object.Size = Vector3.new(1,1,1)
  226.         InnerSphere.CFrame = Sphere.CFrame
  227.         InnerSphere.Size = Vector3.new(0.8,0.8,0.8)
  228.     else
  229.         if TargetT:FindFirstChild("Head") == nil then
  230.             Sphere.Anchored = true
  231.             InnerSphere.Anchored = true
  232.             attacking = false
  233.             return
  234.         end
  235.         SBV.Velocity = TargetT:FindFirstChild("Head").Position - Sphere.Position
  236.         SBV2.Velocity = TargetT:FindFirstChild("Head").Position - InnerSphere.Position
  237.     end
  238.     Object2.CFrame = Host.CFrame - CFrame.fromEulerAnglesXYZ(-7, i * Speed2, 0) * Vector3.new(0,0,Distance)
  239.     Object2.Size = Vector3.new(1,1,1)
  240.     InnerSphere2.CFrame = Object2.CFrame
  241.     InnerSphere2.Size = Vector3.new(0.8,0.8,0.8)
  242.     --CFrame.Angles(math.rad(Visualizer.Orientation.X),math.rad(Visualizer.Orientation.Y),math.rad(Visualizer.Orientation.Z)
  243.     --Visualizer.CFrame = Visualizer.CFrame:lerp(CFrame.new(HumanoidRootPart.Position.X,HumanoidRootPart.Position.Y+5,HumanoidRootPart.Position.Z)*CFrame.Angles(math.rad(Visualizer.Orientation.X+1),math.rad(Visualizer.Orientation.Y-2),math.rad(Visualizer.Orientation.Z+2)),.1)-
  244. end
  245.  
  246. Sphere.Touched:connect(dmg)
  247.  
  248. LoudnessEvent.OnServerEvent:Connect(function(Plr,PL,Key)
  249.     Update(PL,Key)
  250. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement