Advertisement
vL4d_4eVer

vis

Dec 3rd, 2018
741
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 11.87 KB | None | 0 0
  1. script.Parent = owner.PlayerGui
  2. local plr = owner
  3. local char = plr.Character
  4. local plrg = plr.PlayerGui
  5. local rut = char.HumanoidRootPart
  6. local h = char.Head
  7. local id = "rbxassetid://1300680050"
  8. local vol = .5
  9. local pitch = 1
  10. local timepos
  11. local tweens = game:GetService("TweenService")
  12. local debrs = game:GetService("Debris")
  13. local cos = math.cos
  14. local sin = math.sin
  15. local change = .05
  16. local sine = 0
  17. local rad = math.rad
  18. local scr = Instance.new("ScreenGui",plrg) scr.Name = "VisGui"
  19. local song = Instance.new("Sound",char) song.Volume = vol song.Pitch = pitch song.SoundId = id song.Name = "VisSong" song.Looped = true
  20. local rem = Instance.new("RemoteEvent",plrg) rem.Name = "VisEvent"
  21. local verifyofexisting = Instance.new("Glue",char) verifyofexisting.Name = "Verified"
  22. local vispart
  23. local defcf = rut.CFrame * CFrame.new(2,2,2)
  24. local tlerp = function(part,tablee,leinght,easingstyle,easingdirec)
  25.     local info = TweenInfo.new(
  26.     leinght,
  27.     easingstyle,
  28.     easingdirec,
  29.     0,
  30.     false,
  31.     0
  32.     )
  33.     local lerp = tweens:Create(part,info,tablee)
  34.     lerp:Play()
  35. end
  36. function createvpart()
  37. vispart = Instance.new("Part")
  38. vispart.Anchored = true
  39. vispart.CanCollide = false
  40. vispart.Size = Vector3.new(1,1,1)
  41. vispart.Material = "Neon"
  42. vispart.CFrame = defcf
  43. vispart.Parent = rut
  44. vispart:BreakJoints()
  45. end
  46. local client = NLS([[
  47. local startertext = "Press Alt to toggle command bar, type 'Help(Might be low case)' to get help and 'Close' to close help window."
  48. local plr = game:GetService("Players").LocalPlayer
  49. local char = plr.Character
  50. local rut = char.HumanoidRootPart
  51. local plrg = plr.PlayerGui
  52. local mouse = plr:GetMouse()
  53. local colour = Color3.new(0,1,0)
  54. local gui = plrg:WaitForChild("VisGui")
  55. local rem = plrg:WaitForChild("VisEvent")
  56. local song = char:WaitForChild("VisSong")
  57. local help = false
  58. local using = false
  59. local reverse = false
  60. local scaling = 110
  61. local colorchangespeed = 2
  62.  
  63. local tweens = game:GetService("TweenService")
  64. local tlerp = function(part,tablee,leinght,easingstyle,easingdirec)
  65.     local info = TweenInfo.new(
  66.     leinght,
  67.     easingstyle,
  68.     easingdirec,
  69.     0,
  70.     false,
  71.     0
  72.     )
  73.     local lerp = tweens:Create(part,info,tablee)
  74.     lerp:Play()
  75. end
  76.  
  77. local tbox = Instance.new("TextBox",gui)
  78. tbox.Size = UDim2.new(.2,0,.075,0)
  79. tbox.BorderSizePixel = 0
  80. tbox.TextScaled = true
  81. tbox.BackgroundColor3 = Color3.new(.15,.15,.15)
  82. tbox.TextColor3 = Color3.new(1,1,1)
  83. tbox.Position = UDim2.new(.8,0,.925,0)
  84. tbox.Text = startertext
  85.  
  86. local size = 1/9
  87. local helpframe = Instance.new("Frame",tbox)
  88. helpframe.Size = UDim2.new(1,0,7,0)
  89. helpframe.Position = UDim2.new(0,0,1,0)
  90. helpframe.BorderSizePixel = 0
  91. helpframe.BackgroundColor3 = Color3.new(.175,.175,.175)
  92.  
  93. local labl1 = Instance.new("TextLabel",helpframe)
  94. labl1.BorderSizePixel = 0
  95. labl1.BackgroundTransparency = 1
  96. labl1.TextScaled = true
  97. labl1.Text = "Play *id* - Plays a song with chosen id."
  98. labl1.TextColor3 = Color3.new(1,1,1)
  99. labl1.Size = UDim2.new(1,0,size,0)
  100.  
  101. local labl2 = Instance.new("TextLabel",helpframe)
  102. labl2.BorderSizePixel = 0
  103. labl2.BackgroundTransparency = 1
  104. labl2.TextScaled = true
  105. labl2.Text = "Volume *num* - Sets the volume of the song."
  106. labl2.TextColor3 = Color3.new(1,1,1)
  107. labl2.Size = UDim2.new(1,0,size,0)
  108. labl2.Position = UDim2.new(0,0,size,0)
  109.  
  110. local labl3 = Instance.new("TextLabel",helpframe)
  111. labl3.BorderSizePixel = 0
  112. labl3.BackgroundTransparency = 1
  113. labl3.TextScaled = true
  114. labl3.Text = "Pitch *num* - Sets the pitch of the song."
  115. labl3.TextColor3 = Color3.new(1,1,1)
  116. labl3.Size = UDim2.new(1,0,size,0)
  117. labl3.Position = UDim2.new(0,0,size*2,0)
  118.  
  119. local labl4 = Instance.new("TextLabel",helpframe)
  120. labl4.BorderSizePixel = 0
  121. labl4.BackgroundTransparency = 1
  122. labl4.TextScaled = true
  123. labl4.Text = "Play - Plays the song."
  124. labl4.TextColor3 = Color3.new(1,1,1)
  125. labl4.Size = UDim2.new(1,0,size,0)
  126. labl4.Position = UDim2.new(0,0,size*3,0)
  127.  
  128. local labl5 = Instance.new("TextLabel",helpframe)
  129. labl5.BorderSizePixel = 0
  130. labl5.BackgroundTransparency = 1
  131. labl5.TextScaled = true
  132. labl5.Text = "Stop - Stops the song."
  133. labl5.TextColor3 = Color3.new(1,1,1)
  134. labl5.Size = UDim2.new(1,0,size,0)
  135. labl5.Position = UDim2.new(0,0,size*4,0)
  136.  
  137. local labl6 = Instance.new("TextLabel",helpframe)
  138. labl6.BorderSizePixel = 0
  139. labl6.BackgroundTransparency = 1
  140. labl6.TextScaled = true
  141. labl6.Text = "Pause - Pauses the song."
  142. labl6.TextColor3 = Color3.new(1,1,1)
  143. labl6.Size = UDim2.new(1,0,size,0)
  144. labl6.Position = UDim2.new(0,0,size*5,0)
  145.  
  146. local labl7 = Instance.new("TextLabel",helpframe)
  147. labl7.BorderSizePixel = 0
  148. labl7.BackgroundTransparency = 1
  149. labl7.TextScaled = true
  150. labl7.Text = "Resume - Resumes the song."
  151. labl7.TextColor3 = Color3.new(1,1,1)
  152. labl7.Size = UDim2.new(1,0,size,0)
  153. labl7.Position = UDim2.new(0,0,size*6,0)
  154.  
  155. local labl8 = Instance.new("TextLabel",helpframe)
  156. labl8.BorderSizePixel = 0
  157. labl8.BackgroundTransparency = 1
  158. labl8.TextScaled = true
  159. labl8.Text = "Reverse - Reverses the side of the visualiser."
  160. labl8.TextColor3 = Color3.new(1,1,1)
  161. labl8.Size = UDim2.new(1,0,size,0)
  162. labl8.Position = UDim2.new(0,0,size*7,0)
  163.  
  164. local labl9 = Instance.new("TextLabel",helpframe)
  165. labl9.BorderSizePixel = 0
  166. labl9.BackgroundTransparency = 1
  167. labl9.TextScaled = true
  168. labl9.Text = "Scale *num* - Changes the scaling of the part, lesser - bigger size of the part, standart: "..scaling.."."
  169. labl9.TextColor3 = Color3.new(1,1,1)
  170. labl9.Size = UDim2.new(1,0,size,0)
  171. labl9.Position = UDim2.new(0,0,size*8,0)
  172.  
  173. function showhelp()
  174. help = true
  175. using = true
  176. for i = 0,1,.05 do
  177. tbox.Position = tbox.Position:Lerp(UDim2.new(.8,0,.4,0),i)
  178. wait()
  179. end
  180. using = false
  181. end
  182. function closehelp()
  183. using = true
  184. for i = 0,1,.05 do
  185. tbox.Position = tbox.Position:Lerp(UDim2.new(.8,0,.925,0),i)
  186. wait()
  187. end
  188. using = false
  189. help = false
  190. end
  191.  
  192. tbox.FocusLost:Connect(function()
  193.  
  194. if tbox.Text:lower():sub(1,5) == "play " then
  195. rem:FireServer("id",tbox.Text:lower():sub(6,#tbox.Text))
  196. end
  197.  
  198. if tbox.Text:lower():sub(1,7) == "volume " then
  199. rem:FireServer("volume",tbox.Text:lower():sub(8,#tbox.Text))
  200. end
  201.  
  202. if tbox.Text:lower():sub(1,6) == "pitch " then
  203. rem:FireServer("pitch",tbox.Text:lower():sub(7,#tbox.Text))
  204. end
  205.  
  206. if tbox.Text:lower():sub(1,6) == "scale " then
  207. scaling = tbox.Text:lower():sub(7,#tbox.Text)
  208. end
  209.  
  210. if tbox.Text:lower() == "play" then
  211. rem:FireServer("play")
  212. end
  213.  
  214. if tbox.Text:lower() == "stop" then
  215. rem:FireServer("stop")
  216. end
  217.  
  218. if tbox.Text:lower() == "pause" then
  219. rem:FireServer("pause")
  220. end
  221.  
  222. if tbox.Text:lower() == "resume" then
  223. rem:FireServer("resume")
  224. end
  225.  
  226. if tbox.Text:lower() == "help" and not using and not help then
  227. showhelp()
  228. end
  229.  
  230. if tbox.Text:lower() == "close" and not using and help then
  231. closehelp()
  232. end
  233.  
  234. if tbox.Text:lower() == "reverse" and not reverse then
  235. reverse = true
  236. elseif tbox.Text:lower() == "reverse" and reverse then
  237. reverse = false
  238. end
  239.  
  240. tbox.Text = startertext
  241. end)
  242.  
  243. mouse.KeyDown:Connect(function(key)
  244. if string.byte(key) == 52 then
  245. tbox:CaptureFocus()
  246. end
  247.  
  248. end)
  249.  
  250. local cc = coroutine.wrap(function()
  251. while true do
  252. tlerp(rut,{Color = Color3.new(1,0,0)},colorchangespeed,Enum.EasingStyle.Linear,Enum.EasingDirection.InOut)
  253. wait(colorchangespeed)
  254. tlerp(rut,{Color = Color3.new(1,.4,0)},colorchangespeed,Enum.EasingStyle.Linear,Enum.EasingDirection.InOut)
  255. wait(colorchangespeed)
  256. tlerp(rut,{Color =  Color3.new(1,1,0)},colorchangespeed,Enum.EasingStyle.Linear,Enum.EasingDirection.InOut)
  257. wait(colorchangespeed)
  258. tlerp(rut,{Color =  Color3.new(0,1,0)},colorchangespeed,Enum.EasingStyle.Linear,Enum.EasingDirection.InOut)
  259. wait(colorchangespeed)
  260. tlerp(rut,{Color =  Color3.new(0,1,1)},colorchangespeed,Enum.EasingStyle.Linear,Enum.EasingDirection.InOut)
  261. wait(colorchangespeed)
  262. tlerp(rut,{Color =  Color3.new(0,0,1)},colorchangespeed,Enum.EasingStyle.Linear,Enum.EasingDirection.InOut)
  263. wait(colorchangespeed)
  264. tlerp(rut,{Color =  Color3.new(1,0,.4)},colorchangespeed,Enum.EasingStyle.Linear,Enum.EasingDirection.InOut)
  265. wait(colorchangespeed)
  266. end
  267. end)
  268. cc()
  269. while true do
  270. --pcall(function()
  271. if plr.Character ~= nil then
  272. char = plr.Character
  273. song = char:FindFirstChild("VisSong")
  274. if song then
  275. rem:FireServer("resize",song.PlaybackLoudness/scaling,Color3.fromRGB(rut.Color.r*(song.PlaybackLoudness/5),rut.Color.g*(song.PlaybackLoudness/5),rut.Color.b*(song.PlaybackLoudness/5)),reverse)
  276. end
  277. end
  278. --end)
  279. wait()
  280. end
  281. ]],plrg)
  282. function wave(pospart)
  283. local wavetime = math.random(3,6)/10
  284. local col = pospart.Color
  285. local endlocalwavesize = Vector3.new(pospart.Size.x/1.5,pospart.Size.y*3.5,pospart.Size.z*3.5)
  286. local cff = pospart.CFrame
  287. local eff = Instance.new("Part")
  288. eff.Size = Vector3.new(pospart.Size.x/10,pospart.Size.y,pospart.Size.z)
  289. eff.CFrame = cff
  290. eff.Color = col
  291. eff.Anchored = true
  292. eff.CanCollide = false
  293. eff.Material = "Neon"
  294. eff.Parent = rut
  295. local mesh = Instance.new("SpecialMesh",eff)
  296. mesh.MeshType = "Sphere"
  297. tlerp(eff,{Size = endlocalwavesize,Transparency = 1, CFrame = cff * CFrame.Angles(rad(math.random(-180,180)),rad(math.random(-180,180)),rad(math.random(-180,180)))},wavetime,Enum.EasingStyle.Linear,Enum.EasingDirection.InOut)
  298. debrs:AddItem(eff,wavetime)
  299. end
  300. createvpart()
  301. song:Play()
  302. rem.OnServerEvent:Connect(function(plr,type,num,colour,reversed)
  303. pcall(function()
  304. if type == "resize" then
  305. char = owner.Character
  306. verifyofexisting = char:FindFirstChild("Verified")
  307. if not verifyofexisting or not verifyofexisting.Parent then
  308. defcf = rut.CFrame * CFrame.new(2,2,2)
  309. char = owner.Character
  310. rut = char.HumanoidRootPart
  311. h = char.Head
  312. verifyofexisting = Instance.new("Glue",char) verifyofexisting.Name = "Verified"
  313. song = Instance.new("Sound",char) song.Volume = vol song.Pitch = pitch song.SoundId = id song.Name = "VisSong" song.Looped = true
  314. song.TimePosition = timepos
  315. song:Play()
  316. createvpart()
  317. end
  318. sine = sine +change
  319. if not vispart or not vispart.Parent then
  320. createvpart()
  321. end
  322. if num > 5 then
  323. local rand = math.random(1,2)
  324. if rand == 1 then
  325. wave(vispart)
  326. end
  327. end
  328. if not reversed then
  329. defcf = rut.CFrame * CFrame.new(2,2,2) * CFrame.new(cos(sine/3),-cos(sine/3),sin(sine/3)) * CFrame.new(num/2,num,num/2)  * CFrame.Angles(num/1,num/1,-num/1)
  330. else
  331. defcf = rut.CFrame * CFrame.new(-2,2,2) * CFrame.new(cos(sine/3),-cos(sine/3),sin(sine/3)) * CFrame.new(-num/2,num,num/2)  * CFrame.Angles(num/1,-num/1,num/1)
  332. end
  333. if not song or not song.Parent then
  334.     song = Instance.new("Sound",char) song.Volume = vol song.Pitch = pitch song.SoundId = id song.Name = "VisSong" song.Looped = true
  335.     song.TimePosition = timepos
  336.     song:Play()
  337. end
  338. timepos = song.TimePosition
  339. song.Volume = vol
  340. vispart:ClearAllChildren()
  341. vispart.Material = "Neon"
  342. vispart.Transparency = 0
  343. vispart.Anchored = true
  344. vispart.CanCollide = false
  345. vispart.Size = vispart.Size:Lerp(Vector3.new(num,num,num),.35)
  346. vispart.Color = vispart.Color:Lerp(colour,.35)
  347. if (rut.Position-vispart.Position).Magnitude >50+num then
  348. defcf = rut.CFrame * CFrame.new(2,2,2)
  349. vispart.CFrame = defcf
  350. end
  351. vispart.CFrame = vispart.CFrame:Lerp(defcf,.1)
  352. end
  353. if type == "id" then
  354. song.SoundId = "rbxassetid://"..tonumber(num)
  355. id = "rbxassetid://"..tonumber(num)
  356. if not song or not song.Parent then
  357.     song = Instance.new("Sound",char) song.Volume = vol song.Pitch = pitch song.SoundId = id song.Name = "VisSong" song.Looped = true
  358.     song:Play() song.TimePosition = timepos
  359. end
  360. song:Play()
  361. end
  362. if type == "volume" then
  363. song.Volume = tonumber(num)
  364. vol = tonumber(num)
  365. end
  366. if type == "pitch" then
  367. song.Pitch = tonumber(num)
  368. pitch = tonumber(num)
  369. end
  370. if type == "play" then
  371. if not song or not song.Parent then
  372.     song = Instance.new("Sound",char) song.Volume = vol song.Pitch = pitch song.SoundId = id song.Name = "VisSong" song.Looped = true
  373.     song:Play() song.TimePosition = timepos
  374. end
  375. song.TimePosition = 0
  376. song:Play()
  377. end
  378. if type == "stop" then
  379. song:Stop()
  380. end
  381. if type == "pause" then
  382. song:Pause()
  383. end
  384. if type == "resume" then
  385. song:Resume()
  386. end
  387. if type == "wave" then
  388. wave(vispart)
  389. end
  390. end)
  391. end)
  392. script.Parent = plrg
  393. script.Name = "VisScript"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement