KrYn0MoRe

visualiser

Apr 23rd, 2020
901
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 10.19 KB | None | 0 0
  1. local plr = owner
  2. repeat wait() until plr.Character
  3. local char = plr.Character
  4. local tors = char:FindFirstChild("Torso") or char:FindFirstChild("UpperTorso") or char:FindFirstChild("HumanoidRootPart") or char:FindFirstChild("Head")
  5.  
  6. script.Name = "KrY's Vis Main V2"
  7. --script.Parent = plr
  8.  
  9. local folder = Instance.new("Folder")
  10. folder.Name = "KrY's Vis Folder"
  11. folder.Parent = script
  12.  
  13. local remote = Instance.new("RemoteEvent")
  14. remote.Name = "KrY's Vis Remote V2"
  15. remote.Parent = plr['PlayerGui']
  16.  
  17. local cube = Instance.new("Part")
  18. cube.Size = Vector3.new(3,3,3)
  19. cube.Anchored = true
  20. cube.CanCollide = false
  21. cube.Material = Enum.Material.Neon
  22. local cube2 = cube:Clone()
  23. local cube3 = cube:Clone()
  24. local cube4 = cube:Clone()
  25. local cube5 = cube:Clone()
  26. cube.Parent = folder
  27. cube2.Parent = folder
  28. cube3.Parent = folder
  29. cube4.Parent = folder
  30. cube5.Name = 'vis cube'
  31. cube5.Transparency = 1
  32. cube5.Size = Vector3.new()
  33. cube5.Parent = folder
  34.  
  35. for i,v in pairs(folder:GetChildren()) do
  36.     if v:IsA("BasePart") and v:CanSetNetworkOwnership() then
  37.         v:SetNetworkOwner(plr)
  38.     end
  39. end
  40.  
  41. local cubeval = Instance.new("ObjectValue")
  42. cubeval.Name = 'cubeval'
  43. cubeval.Value = cube5
  44. cubeval.Parent = remote
  45.  
  46. local song = Instance.new("Sound")
  47. song.Name = "KrY's Vis V2"
  48. song.Volume = 1
  49. song.Looped = true
  50. song.Parent = cube5
  51.  
  52. sizing = false
  53. sizing2 = false
  54. sizing3 = false
  55. sizing4 = false
  56. getting = false
  57. bassing = {}
  58. songidthing = 0
  59. volume = 1
  60. speed = 1
  61. looped = true
  62. can_reload = true
  63. last_time = 0
  64. originalrad = 0
  65. originalspot = 0
  66. loudness = 0
  67. speedness = 0
  68. mode = 5
  69. prefix = "/"
  70. origin_size = Vector3.new(3,3,3)
  71. max_size = Vector3.new(4.5,4.5,4.5)
  72.  
  73. coroutine.resume(coroutine.create(function()
  74.     while true do
  75.         pcall(function()
  76.             if not song or not song.Parent and can_reload then
  77.                 song = Instance.new("Sound")
  78.                 song.Name = "KrY's Vis V2"
  79.                 song.SoundId = "rbxassetid://" .. songidthing
  80.                 song.Volume = volume
  81.                 song.Looped = looped
  82.                 song.PlaybackSpeed = speed
  83.                 song.TimePosition = last_time
  84.                 song.Parent = cube5
  85.                 song:Play()
  86.             end
  87.             if song and song.Parent then
  88.                 song.Name = "KrY's Vis V2"
  89.                 song.Volume = volume
  90.                 song.Looped = looped
  91.                 song.PlaybackSpeed = speed
  92.                 last_time = song.TimePosition
  93.                 song:Resume()
  94.             end
  95.         end)
  96.         game:GetService("RunService").Heartbeat:Wait(1/30)
  97.     end
  98.     coroutine.yield()
  99. end))
  100.  
  101. remote.OnServerEvent:Connect(function(plr,loud,speed)
  102.     loudness = loud
  103.     speedness = speed
  104. end)
  105.  
  106. codestuffs = [[
  107.     local remote = script.Parent
  108.     local cube = remote['cubeval'].Value
  109.     local song = cube:WaitForChild("KrY's Vis V2")
  110.    
  111.     cube.ChildRemoved:Connect(function(obj)
  112.         if obj == song then
  113.             song = cube:WaitForChild("KrY's Vis V2")
  114.         end
  115.     end)
  116.    
  117.     game:GetService("RunService").RenderStepped:Connect(function()
  118.         if song and song.Parent then
  119.             wait(.1)
  120.             remote:FireServer(song.PlaybackLoudness, song.PlaybackSpeed)
  121.         end
  122.     end)
  123. ]]
  124.  
  125. NLS(codestuffs, remote)
  126.  
  127. local resize = function(part)
  128.     local division_size = loudness/500
  129.     local make_size = origin_size+Vector3.new(division_size,division_size,division_size)
  130.     if make_size.Y > max_size.Y then
  131.         make_size = max_size
  132.     end
  133.     game:GetService("TweenService"):Create(part,TweenInfo.new(0.1),{Size = make_size}):Play()
  134. end
  135.  
  136. mrd1 = math.random(300,400)
  137. mrd2 = math.random(600,700)
  138. mrd3 = math.random(400,600)
  139.  
  140. function other(p)
  141.     game:GetService("TweenService"):Create(p,TweenInfo.new(0.5),{Color = Color3.new(loudness / mrd1,loudness / mrd2,loudness / mrd3)}):Play()
  142. end
  143.  
  144. function add_bass_shadow(part)
  145.     if not bassing[part] then else return end
  146.     bassing[part] = true
  147.     local shadow = part:Clone()
  148.     shadow.Transparency = 0.6
  149.     shadow.Material = Enum.Material.ForceField
  150.     shadow.Size = shadow.Size*1.6
  151.     local sphere = Instance.new("SpecialMesh")
  152.     sphere.MeshType = Enum.MeshType.Sphere
  153.     sphere.Parent = shadow
  154.     local emit = Instance.new("ParticleEmitter")
  155.     emit.Rotation = NumberRange.new(0, 360)
  156.     emit.Color = ColorSequence.new(Color3.new(1, 0.878431, 0.431373),part.Color)
  157.     emit.LightEmission = 0.6
  158.     emit.Texture = "rbxassetid://203216563"
  159.     emit.Transparency = NumberSequence.new(0.5,0.75,1)
  160.     emit.Size = NumberSequence.new(0.3125,0.5625,0.60509598255157,0.5,0.3821650147438)
  161.     emit.Lifetime = NumberRange.new(0.5, 0.75)
  162.     emit.Rate = 25
  163.     emit.RotSpeed = NumberRange.new(-500, 500)
  164.     emit.SpreadAngle = Vector2.new(360, 360)
  165.     emit.Speed = NumberRange.new(2, 3)
  166.     emit.Rotation = NumberRange.new(0, 360)
  167.     emit.LockedToPart = true
  168.     emit.Parent = shadow
  169.     shadow.Parent = part.Parent
  170.     coroutine.resume(coroutine.create(function()
  171.         emit.Enabled = true
  172.         wait(0.1)
  173.         emit.Enabled = false
  174.         bassing[part] = false
  175.         coroutine.yield()
  176.     end))
  177.     game:GetService("TweenService"):Create(shadow,TweenInfo.new(0.2),{Size = shadow.Size*2.1,Transparency = 1}):Play()
  178.     game:GetService("Debris"):AddItem(shadow,2)
  179. end
  180.  
  181. function repos(p,t,s1,s2,s3)
  182.     originalrad = originalrad + ((speedness / 100) * (loudness / 100))
  183.     local division_size = loudness/300
  184.     local pos_size = Vector3.new(division_size,division_size,division_size)
  185.     local make_size = origin_size+Vector3.new(division_size,division_size,division_size)
  186.     local bass = false
  187.     if pos_size.Y > max_size.Y then
  188.         pos_size = max_size
  189.     end
  190.     if make_size.Y > max_size.Y then
  191.         bass = true
  192.         make_size = max_size
  193.     end
  194.     local _s1,_s2,_s3 = s1,s2,s3
  195.     if s1 > 0 then
  196.         _s1 = _s1 + pos_size.Y
  197.     elseif 0 > s1 then
  198.         _s1 = _s1 - pos_size.Y
  199.     end
  200.     if s2 > 0 then
  201.         _s2 = _s2 + pos_size.Y
  202.     elseif 0 > s2 then
  203.         _s2 = _s2 - pos_size.Y
  204.     end
  205.     if  s3 > 0 then
  206.         _s3 = _s3 + pos_size.Y
  207.     elseif 0 > s3 then
  208.         _s3 = _s3 - pos_size.Y
  209.     end
  210.     if t then
  211.         p.CFrame = t.CFrame + Vector3.new(_s1,_s2,_s3)
  212.     end
  213.     if bass and p ~= cube5 then
  214.         add_bass_shadow(p)
  215.     end
  216.     if mode == 1 then
  217.         p.CFrame = p.CFrame*CFrame.Angles(originalrad,0,originalrad)
  218.     elseif mode == 2 then
  219.         p.CFrame = p.CFrame*CFrame.Angles(originalrad,originalrad,originalrad)
  220.     elseif mode == 3 then
  221.         p.CFrame = p.CFrame*CFrame.Angles(originalrad,originalrad,0)
  222.     elseif mode == 4 then
  223.         p.CFrame = p.CFrame*CFrame.Angles(0,originalrad,originalrad)
  224.     elseif mode == 5 then
  225.         p.CFrame = p.CFrame*CFrame.Angles(0,originalrad,0)
  226.     elseif mode == 6 then
  227.         p.CFrame = p.CFrame*CFrame.Angles(0,0,originalrad)
  228.     elseif mode == 6 then
  229.         p.CFrame = p.CFrame*CFrame.Angles(originalrad,0,0)
  230.     end
  231.     p.CFrame = p.CFrame*CFrame.new(0,.75,0)
  232. end
  233.  
  234. function downsize(parts)
  235.     for _,part in pairs(parts) do
  236.         part.Size = origin_size
  237.         part.CFrame = part.CFrame*CFrame.Angles(0,0,0)
  238.     end
  239. end
  240.  
  241. function get()
  242.     spawn(function()
  243.         if not getting then else return end
  244.         getting = true
  245.         repeat wait() until plr.Character
  246.         char = plr.Character
  247.         tors = char:FindFirstChild("Torso") or char:FindFirstChild("UpperTorso") or char:FindFirstChild("HumanoidRootPart") or char:FindFirstChild("Head")
  248.         getting = false
  249.     end)
  250. end
  251.  
  252. coroutine.resume(coroutine.create(function()
  253.     while true do
  254.         get()
  255.         if song.IsPlaying then
  256.             resize(cube)
  257.             other(cube)
  258.             resize(cube2)
  259.             other(cube2)
  260.             resize(cube3)
  261.             other(cube3)
  262.             resize(cube4)
  263.             other(cube4)
  264.         elseif not song.IsPlaying then
  265.             downsize({cube,cube2,cube3,cube4})
  266.         end
  267.         repos(cube,tors,5,0,0)
  268.         repos(cube2,tors,0,0,-5)
  269.         repos(cube3,tors,-5,0,0)
  270.         repos(cube4,tors,0,0,5)
  271.         repos(cube5,tors,0,0,0)
  272.         game:GetService("RunService").Heartbeat:Wait(1/30)
  273.     end
  274.     coroutine.yield()
  275. end))
  276.  
  277. plr.Chatted:Connect(function(msg)
  278. --
  279. if msg:lower():sub(1,4) == "vol" ..prefix then
  280.     local choice = msg:sub(5)
  281.     if tonumber(choice) then
  282.         volume = choice
  283.         song.Volume = choice
  284.     end
  285. end
  286. --
  287. if msg:lower():sub(1,7) == "/e vol" ..prefix then
  288.     local choice = msg:sub(8)
  289.     if tonumber(choice) then
  290.         volume = choice
  291.         song.Volume = choice
  292.     end
  293. end
  294. --
  295. if msg:lower():sub(1,5) == "loop" ..prefix then
  296.     local choice = msg:sub(6)
  297.     if choice == "false" then
  298.         looped = false
  299.         song.Looped = false
  300.     elseif choice == "true" then
  301.         looped = true
  302.         song.Looped = true
  303.     end
  304. end
  305. --
  306. if msg:lower():sub(1,8) == "/e loop" ..prefix then
  307.     local choice = msg:sub(9)
  308.     if choice == "false" then
  309.         looped = false
  310.         song.Looped = false
  311.     elseif choice == "true" then
  312.         looped = true
  313.         song.Looped = true
  314.     end
  315. end
  316. --
  317. if msg:lower():sub(1,5) == "pass" ..prefix then
  318.     local choice = msg:sub(6)
  319.     if choice == "false" then
  320.         can_reload = false
  321.     elseif choice == "true" then
  322.         can_reload = true
  323.     end
  324. end
  325. --
  326. if msg:lower():sub(1,8) == "/e pass" ..prefix then
  327.     local choice = msg:sub(9)
  328.     if choice == "false" then
  329.         can_reload = false
  330.     elseif choice == "true" then
  331.         can_reload = true
  332.     end
  333. end
  334. --
  335. if msg:lower():sub(1,5) == "play" ..prefix then
  336.     songidthing = msg:sub(6)
  337.     if tonumber(songidthing) then
  338.         last_time = 0
  339.         song.TimePosition = 0
  340.         song.SoundId = 'rbxassetid://' .. songidthing
  341.         --song:Destroy()
  342.     end
  343. end
  344. --
  345. if msg:lower():sub(1,8) == "/e play" ..prefix then
  346.     songidthing = msg:sub(9)
  347.     if tonumber(songidthing) then
  348.         last_time = 0
  349.         song.TimePosition = 0
  350.         song.SoundId = 'rbxassetid://' .. songidthing
  351.         --song:Destroy()
  352.     end
  353. end
  354. --
  355. if msg:lower():sub(1,5) == "stop" ..prefix then
  356.     song:Stop()
  357. end
  358. --
  359. if msg:lower():sub(1,8) == "/e stop" ..prefix then
  360.     song:Stop()
  361. end
  362. --
  363. if msg:lower():sub(1,6) == "pause" ..prefix then
  364.     song:Pause()
  365. end
  366. --
  367. if msg:lower():sub(1,9) == "/e pause" ..prefix then
  368.     song:Pause()
  369. end
  370. --
  371. if msg:lower():sub(1,7) == "resume" ..prefix then
  372.     song:Resume()
  373. end
  374. --
  375. if msg:lower():sub(1,10) == "/e resume" ..prefix then
  376.     song:Resume()
  377. end
  378. --
  379. if msg:lower():sub(1,6) == "speed" ..prefix then
  380.     local choice = msg:lower():sub(7)
  381.     if tonumber(choice) then
  382.         speed = choice
  383.         song.PlaybackSpeed = tonumber(speed)
  384.     end
  385. end
  386. --
  387. if msg:lower():sub(1,9) == "/e speed" ..prefix then
  388.     local choice = msg:lower():sub(10)
  389.     if tonumber(choice) then
  390.         speed = choice
  391.         song.PlaybackSpeed = tonumber(speed)
  392.     end
  393. end
  394. --
  395. if msg:lower():sub(1,6) == "style" ..prefix then
  396.     local choice = msg:lower():sub(7)
  397.     if tonumber(choice) and (choice == "1" or choice == "2" or choice == "3" or choice == "4" or choice == "5" or choice == "6") then
  398.         mode = tonumber(choice)
  399.     end
  400. end
  401. --
  402. if msg:lower():sub(1,9) == "/e style" ..prefix then
  403.     local choice = msg:lower():sub(10)
  404.     if tonumber(choice) and (choice == "1" or choice == "2" or choice == "3" or choice == "4" or choice == "5" or choice == "6") then
  405.         mode = tonumber(choice)
  406.     end
  407. end
  408. --
  409. end)
Add Comment
Please, Sign In to add comment