DatOneTrap

Untitled

May 6th, 2020
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.83 KB | None | 0 0
  1. --[[ Player Functions ]]--
  2.  
  3. plr = game.Players:WaitForChild(_G.target)
  4. char = plr.Character
  5.  
  6. --[[ Color Functions ]]--
  7.  
  8. local h = math.random(0, 100)
  9. local color = Color3.fromHSV(h / 100, 1, 0.9)
  10. local lastbeat = 0
  11. local lastloud = 0
  12. local PlaybackSound = 0
  13.  
  14. --[[ Create Part ]]--
  15.  
  16. local Create = LoadLibrary("RbxUtility").Create
  17. Create = function(Parent, Material, Reflectance, Transparency, Col, Name, Size)
  18.  
  19. local Part = Create("Part")
  20. {
  21. Parent = Parent,
  22. Reflectance = Reflectance,
  23. Transparency = Transparency,
  24. CanCollide = false,
  25. Locked = true,
  26. BrickColor = BrickColor.new(tostring(Col)),
  27. Name = Name,
  28. Size = Size,
  29. Material = Material,
  30. }
  31. end
  32.  
  33. function CreatePart(parent, transparency, reflectance, material, brickcolor)
  34. local p = Instance.new("Part")
  35. p.TopSurface = 0
  36. p.BottomSurface = 0
  37. p.Parent = parent
  38. p.Size = Vector3.new(0.1,0.1,0.1)
  39. p.Transparency = transparency
  40. p.Reflectance = reflectance
  41. p.CanCollide = false
  42. p.Locked = true
  43. p.BrickColor = BrickColor.new(tostring(brickcolor))
  44. p.Material = material
  45. return p
  46. end
  47.  
  48. --[[ Folder ]]--
  49.  
  50. local visuals = Instance.new("Folder")
  51. visuals.Parent = char
  52.  
  53. --[[ Cube ]]--
  54.  
  55. local cube = CreatePart(visuals, 0, 0, "Neon")
  56. cube.Anchored = true
  57. cube.CanCollide = false
  58. cube.Locked = true
  59. cube.CFrame = char.HumanoidRootPart.CFrame
  60.  
  61. --[[ Particles ]]--
  62.  
  63. local partic = Instance.new("ParticleEmitter")
  64. partic.Acceleration = Vector3.new(0, 5, 0)
  65. partic.Speed = NumberRange.new(250)
  66. partic.Lifetime = NumberRange.new(3)
  67. partic.Enabled = false
  68. partic.Rate = 25
  69. partic.Texture = "rbxassetid://380602004" --243664672
  70. partic.LightEmission = 5
  71. partic.LightInfluence = 1
  72. partic.Transparency = NumberSequence.new({NumberSequenceKeypoint.new(0, 0), NumberSequenceKeypoint.new(1, 1)})
  73. partic.Size = NumberSequence.new({NumberSequenceKeypoint.new(0, 1), NumberSequenceKeypoint.new(1, 0)})
  74. partic.Drag = 15
  75. partic.Parent = cube
  76.  
  77. --[[ Sound ]]--
  78.  
  79. local sound = Instance.new("Sound")
  80. sound.SoundId = "rbxassetid://2862170886"
  81. sound.Parent = char["HumanoidRootPart"]
  82. sound.Volume = 3
  83. sound.Name = "Music"
  84. sound.Looped = true
  85. sound:Play()
  86.  
  87. plr.Chatted:connect(function(msg)
  88.  
  89. if msg:sub(1, 7):lower()=='/e play' then
  90. local val = Instance.new("NumberValue", char)
  91. val.Value = tonumber(msg:sub(8))
  92. local id = val.Value
  93. sound:Stop()
  94. sound.SoundId = 'rbxassetid://'..id
  95. sound:Play()
  96. sound.Looped = true
  97.  
  98. elseif msg:sub(1, 8):lower()=='/e pitch' then
  99. local val2 = Instance.new("NumberValue", char)
  100. val2.Value = tonumber(msg:sub(9))
  101. local Pitch = val2.Value
  102. sound.Pitch = Pitch
  103.  
  104. elseif msg:sub(1, 6):lower()=='/e vol' then
  105. local val3 = Instance.new("NumberValue", char)
  106. val3.Value = tonumber(msg:sub(7))
  107. local Volume = val3.Value
  108. sound.Volume = Volume
  109.  
  110. elseif msg:sub(1, 7):lower()=='/e stop' then
  111. sound:Stop()
  112.  
  113. end
  114.  
  115. end)
  116.  
  117. --[[ Remote ]]--
  118.  
  119. local Remote = Instance.new("RemoteEvent", char)
  120. Remote.Name = "Event"
  121.  
  122. --[[ Visual ]]--
  123.  
  124. local speed = 3
  125. local num = 0
  126. local change = 2 / speed
  127.  
  128. local Y = 0
  129. local X = 0
  130. local Z = 0
  131.  
  132. Remote.OnServerEvent:connect(function(plr, Playback)
  133.  
  134. local beat = math.abs(PlaybackSound - lastloud)
  135. if beat > lastbeat then
  136. lastbeat = beat
  137. else
  138. lastbeat = lastbeat - 10
  139. if lastbeat < 0 then
  140. lastbeat = 0
  141. end
  142. end
  143.  
  144. h = (h + beat / 250) % 100
  145. lastloud = PlaybackSound
  146.  
  147. num = num + change
  148.  
  149. Y = Y + 0.5 + Playback/2500
  150. X = X + 0.5 + Playback/250
  151. Z = Z + 0.5 + Playback/25
  152.  
  153. cube.CFrame = cube.CFrame:lerp(char["HumanoidRootPart"].CFrame * CFrame.new(0, 8 + math.cos(num / 5), 0) * CFrame.fromEulerAnglesXYZ(math.rad(X), math.rad(Y), math.rad(Z)), 0.25)
  154.  
  155. cube.Color = cube.Color:lerp(Color3.fromHSV(h / 100, 1, 1), 1)
  156.  
  157. cube.Size = cube.Size:lerp(Vector3.new(2 + Playback/500, 2 + Playback/500, 2 + Playback/500), 0.25)
  158.  
  159. if Playback >= 425 then
  160.  
  161. partic.Speed = NumberRange.new(5 + Playback/1000)
  162. partic.Enabled = true
  163. partic.Rate = 25 + Playback/1000
  164. partic.Lifetime = NumberRange.new(1 + Playback/1000)
  165. partic.Drag = 5 - Playback/100
  166. partic.Acceleration = Vector3.new(0, -5 / Playback/-250, 0)
  167. partic.Size = NumberSequence.new({NumberSequenceKeypoint.new(0, 0 + Playback/1000), NumberSequenceKeypoint.new(1, 0.25 + Playback/1000)})
  168. partic.Color = ColorSequence.new(Color3.fromHSV(h / 100, 1, 1), Color3.fromHSV(h / 100, 1, 1))
  169. partic.RotSpeed = NumberRange.new(0 - sound.PlaybackLoudness/-250, 0 + sound.PlaybackLoudness/250)
  170. partic.SpreadAngle = Vector2.new(-25 - sound.PlaybackLoudness/-25, 25 + sound.PlaybackLoudness/25)
  171. partic.Rotation = NumberRange.new(-25 - Playback, 10 + Playback)
  172. partic.RotSpeed = NumberRange.new(-25 - Playback, 10 + Playback)
  173.  
  174. for i = 0.5, 1 do
  175.  
  176. local part1 = CreatePart(visuals, 1, 1, "Neon")
  177. part1.Anchored = false
  178. part1.Material = Enum.Material.Neon
  179. part1.CanCollide = false
  180. part1.Locked = true
  181.  
  182. local weld1 = Instance.new("Weld")
  183. weld1.Part0 = part1
  184. weld1.Part1 = cube
  185. weld1.Parent = part1
  186.  
  187. local part2 = CreatePart(visuals, 1, 1, "Neon")
  188. part2.Anchored = false
  189. part2.Material = Enum.Material.Neon
  190. part2.Size = Vector3.new(0.25, 1.5, 0.25)
  191. part2.CanCollide = false
  192. part2.Locked = true
  193.  
  194. local partm2 = Instance.new("SpecialMesh")
  195. partm2.MeshType = Enum.MeshType.Sphere
  196. partm2.Scale = Vector3.new(1, 1, 1)
  197. partm2.Parent = part2
  198.  
  199. local weld2 = Instance.new("Weld")
  200. weld2.Part0 = part2
  201. weld2.Part1 = cube
  202. weld2.Parent = part2
  203.  
  204. weld1.C1 = weld1.C1:lerp(CFrame.fromEulerAnglesXYZ(math.rad(X), math.rad(Y), math.rad(Z)), 0.25)
  205.  
  206. weld2.C1 = weld2.C1:lerp(CFrame.fromEulerAnglesXYZ(math.rad(5 * X), math.rad(5 * Y), math.rad(5 * Z)), 0.25)
  207.  
  208. part1.Color = part1.Color:lerp(Color3.fromHSV(h / 100, 0.5, 0.5), 1)
  209.  
  210. part2.Color = part2.Color:lerp(Color3.fromHSV(h / 100, 0.5, 0.5), 1)
  211.  
  212. pcall(function()
  213.  
  214. if Playback >= 100 then
  215.  
  216. for i = 1, 15 do
  217.  
  218. part1.Size = part1.Size:lerp(Vector3.new(cube.Size.X + Playback/150, cube.Size.Y + Playback/150, cube.Size.Z + Playback/150), 0.05 + Playback/5000)
  219.  
  220. part1.Transparency = i / 15
  221.  
  222. partm2.Scale = partm2.Scale:lerp(Vector3.new(cube.Size.X + Playback/100, cube.Size.Y + Playback/100, cube.Size.Z + Playback/100), 0.02 + Playback/5000)
  223.  
  224. part2.Transparency = i / 15
  225.  
  226. wait()
  227.  
  228. end
  229.  
  230. part1:Destroy()
  231.  
  232. part2:Destroy()
  233.  
  234. end
  235.  
  236. end)
  237.  
  238. end
  239.  
  240. else
  241.  
  242. partic.Enabled = false
  243.  
  244. end
  245.  
  246. PlaybackSound = Playback
  247.  
  248. end)
  249.  
  250. --[[ Debounce ]]--
  251.  
  252. function debounce(func)
  253. local isRunning = false
  254. return function(...)
  255. if not isRunning then
  256. isRunning = true
  257.  
  258. func(...)
  259.  
  260. isRunning = false
  261. end
  262. end
  263. end
Add Comment
Please, Sign In to add comment