Advertisement
metilol

Untitled

Apr 13th, 2018
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --// Initializing \\--
  2. local S = setmetatable({},{__index = function(s,i) return game:service(i) end})
  3. local Plrs = S.Players
  4. local Plr = Plrs.LocalPlayer
  5. local Char = Plr.Character
  6. local Torso = Char.Torso
  7. local Mouse = Plr:GetMouse()
  8.  
  9. --// Shortcut Variables \\--
  10. local CF = {N=CFrame.new,A=CFrame.Angles,fEA=CFrame.fromEulerAnglesXYZ}
  11. local C3 = {N=Color3.new,RGB=Color3.fromRGB,HSV=Color3.fromHSV,tHSV=Color3.toHSV}
  12. local V3 = {N=Vector3.new,FNI=Vector3.FromNormalId,A=Vector3.FromAxis}
  13. local M = {C=math.cos,R=math.rad,S=math.sin,P=math.pi,RNG=math.random,MRS=math.randomseed,H=math.huge,RRNG = function(min,max,div) return math.rad(math.random(min,max)/(div or 1)) end}
  14. local De = S.Debris
  15. local WS = workspace
  16. local Lght = S.Lighting
  17. local RS = S.ReplicatedStorage
  18. local IN = Instance.new
  19. --// Instance Creation Functions \\--
  20.  
  21. function Sound(parent,id,pitch,volume,looped,effect,autoPlay)
  22. local Sound = IN("Sound")
  23. Sound.SoundId = "rbxassetid://".. tostring(id or 0)
  24. Sound.Pitch = pitch or 1
  25. Sound.Volume = volume or 1
  26. Sound.Looped = looped or false
  27. if(autoPlay)then
  28. coroutine.wrap(function()
  29. repeat wait() until Sound.IsLoaded
  30. Sound.Playing = autoPlay or false
  31. end)()
  32. end
  33. if(not looped and effect)then
  34. Sound.Stopped:connect(function()
  35. Sound.Volume = 0
  36. Sound:destroy()
  37. end)
  38. elseif(effect)then
  39. warn("Sound can't be looped and a sound effect!")
  40. end
  41. Sound.Parent =parent or Torso
  42. return Sound
  43. end
  44. function Part(parent,color,material,size,cframe,anchored,cancollide)
  45. local part = IN("Part")
  46. part[typeof(color) == 'BrickColor' and 'BrickColor' or 'Color'] = color or C3.N(0,0,0)
  47. part.Material = material or Enum.Material.SmoothPlastic
  48. part.TopSurface,part.BottomSurface=10,10
  49. part.Size = size or V3.N(1,1,1)
  50. part.CFrame = cframe or CF.N(0,0,0)
  51. part.Anchored = anchored or true
  52. part.CanCollide = cancollide or false
  53. part.Parent = parent or Char
  54. return part
  55. end
  56. function Mesh(parent,meshtype,meshid,textid,scale,offset)
  57. local part = IN("SpecialMesh")
  58. part.MeshId = meshid or ""
  59. part.TextureId = textid or ""
  60. part.Scale = scale or V3.N(1,1,1)
  61. part.Offset = offset or V3.N(0,0,0)
  62. part.MeshType = meshtype or Enum.MeshType.Sphere
  63. part.Parent = parent
  64. return part
  65. end
  66.  
  67. NewInstance = function(instance,parent,properties)
  68. local inst = Instance.new(instance,parent)
  69. if(properties)then
  70. for i,v in next, properties do
  71. pcall(function() inst[i] = v end)
  72. end
  73. end
  74. return inst;
  75. end
  76.  
  77. local Frame_Speed = 60 -- The frame speed for swait. 1 is automatically divided by this
  78.  
  79. local Effects = IN("Folder",Char)
  80. Effects.Name = "Effects"
  81. --// Artificial HB \\--
  82.  
  83. local ArtificialHB = IN("BindableEvent", script)
  84. ArtificialHB.Name = "Heartbeat"
  85.  
  86. script:WaitForChild("Heartbeat")
  87.  
  88. local tf = 0
  89. local allowframeloss = false
  90. local tossremainder = false
  91. local lastframe = tick()
  92. local frame = 1/Frame_Speed
  93. ArtificialHB:Fire()
  94.  
  95. game:GetService("RunService").Heartbeat:connect(function(s, p)
  96. tf = tf + s
  97. if tf >= frame then
  98. if allowframeloss then
  99. script.Heartbeat:Fire()
  100. lastframe = tick()
  101. else
  102. for i = 1, math.floor(tf / frame) do
  103. ArtificialHB:Fire()
  104. end
  105. lastframe = tick()
  106. end
  107. if tossremainder then
  108. tf = 0
  109. else
  110. tf = tf - frame * math.floor(tf / frame)
  111. end
  112. end
  113. end)
  114.  
  115. function swait(num)
  116. if num == 0 or num == nil then
  117. ArtificialHB.Event:wait()
  118. else
  119. for i = 0, num do
  120. ArtificialHB.Event:wait()
  121. end
  122. end
  123. end
  124.  
  125.  
  126. --// Effect Function(s) \\--
  127.  
  128. function Bezier(startpos, pos2, pos3, endpos, t)
  129. local A = startpos:lerp(pos2, t)
  130. local B = pos2:lerp(pos3, t)
  131. local C = pos3:lerp(endpos, t)
  132. local lerp1 = A:lerp(B, t)
  133. local lerp2 = B:lerp(C, t)
  134. local cubic = lerp1:lerp(lerp2, t)
  135. return cubic
  136. end
  137.  
  138. function Effect(data)
  139. local FX = data.Effect or 'Resize-AndFade'
  140. local Parent = data.Parent or Effects
  141. local Color = data.Color or C3.N(0,0,0)
  142. local Size = data.Size or V3.N(1,1,1)
  143. local MoveDir = data.MoveDirection or nil
  144. local MeshData = data.Mesh or nil
  145. local SndData = data.Sound or nil
  146. local Frames = data.Frames or 45
  147. local Manual = data.Manual or nil
  148. local Material = data.Material or nil
  149. local CFra = data.CFrame or Torso.CFrame
  150. local Settings = data.FXSettings or {}
  151. local Snd,Prt,Msh;
  152. if(Manual and typeof(Manual) == 'Instance' and Manual:IsA'BasePart')then
  153. Prt = Manual
  154. else
  155. Prt = Part(Parent,Color,Material,Size,CFra,true,false)
  156. end
  157. if(typeof(MeshData) == 'table')then
  158. Msh = Mesh(Prt,MeshData.MeshType,MeshData.MeshId,MeshData.TextureId,MeshData.Scale,MeshData.Offset)
  159. elseif(typeof(MeshData) == 'Instance')then
  160. Msh = MeshData:Clone()
  161. Msh.Parent = Prt
  162. end
  163. if(typeof(SndData) == 'table' or typeof(SndData) == 'Instance')then
  164. Snd = Sound(Prt,SndData.SoundId,SndData.Pitch,SndData.Volume,false,false,true)
  165. end
  166. if(Snd)then
  167. repeat wait() until Snd.Playing and Snd.IsLoaded and Snd.TimeLength > 0
  168. Frames = Snd.TimeLength * Frame_Speed/Snd.Pitch
  169. end
  170. local MoveSpeed = nil;
  171. if(MoveDir)then
  172. MoveSpeed = (CFra.p - MoveDir).magnitude/Frames
  173. end
  174. local Inc = M.RNG()-M.RNG()
  175. local Thingie = 0
  176. local Thingie2 = M.RNG(50,100)/100
  177.  
  178. coroutine.wrap(function()
  179. if(FX ~= 'Arc')then
  180. for i = 1, Frames do
  181. if(FX == 'Resize-AndFade')then
  182. if(not Settings.EndSize)then
  183. Settings.EndSize = V3.N(0,0,0)
  184. end
  185. local grow = (typeof(Settings.EndSize) == 'Vector3' and Settings.EndSize-Size or typeof(Settings.EndSize) == 'number' and V3.N(Settings.EndSize))
  186. Prt.Size = Prt.Size - grow/Frames
  187. Prt.Transparency = (i/Frames)
  188. elseif(FX == 'Resize+AndFade')then
  189. if(not Settings.EndSize)then
  190. Settings.EndSize = Size*2
  191. end
  192. local grow = (typeof(Settings.EndSize) == 'Vector3' and Settings.EndSize-Size or typeof(Settings.EndSize) == 'number' and V3.N(Settings.EndSize))
  193. Prt.Size = Prt.Size + grow/Frames
  194. Prt.Transparency = (i/Frames)
  195. elseif(FX == 'Fade')then
  196. Prt.Transparency = (i/Frames)
  197. end
  198. if(Settings.RandomizeCFrame)then
  199. Prt.CFrame = Prt.CFrame * CF.A(M.RRNG(-360,360),M.RRNG(-360,360),M.RRNG(-360,360))
  200. end
  201. if(MoveDir and MoveSpeed)then
  202. local Orientation = Prt.Orientation
  203. Prt.CFrame = CF.N(Prt.Position,MoveDir)*CF.N(0,0,-MoveSpeed)
  204. Prt.Orientation = Orientation
  205. end
  206. if(swait and typeof(swait) == 'function')then
  207. swait()
  208. else
  209. wait()
  210. end
  211. end
  212. Prt:destroy()
  213. else
  214. local start,third,fourth,endP = Settings.Start,Settings.Third,Settings.Fourth,Settings.End
  215. if(not Settings.End and Settings.Home)then endP = Settings.Home.CFrame end
  216. local quarter = third or start:lerp(endP, 0.25) * CF.N(M.RNG(-25,25),M.RNG(0,25),M.RNG(-25,25))
  217. local threequarter = fourth or start:lerp(endP, 0.75) * CF.N(M.RNG(-25,25),M.RNG(0,25),M.RNG(-25,25))
  218. assert(start ~= nil,"You need to specify a start point!")
  219. assert(endP ~= nil,"You need to specify an end point!")
  220. for i = 0, 1, Settings.Speed or 0.01 do
  221. if(Settings.Home)then
  222. endP = Settings.Home.CFrame
  223. end
  224. Prt.CFrame = Bezier(start, quarter, threequarter, endP, i)
  225. if(swait and typeof(swait) == 'function')then
  226. swait()
  227. else
  228. wait()
  229. end
  230. end
  231. if(Settings.RemoveOnGoal)then
  232. Prt:destroy()
  233. end
  234. end
  235. end)()
  236. return Prt,Msh,Snd
  237. end
  238.  
  239.  
  240. function SoulSteal(whom)
  241. local torso = (whom:FindFirstChild'Head' or whom:FindFirstChild'Torso' or whom:FindFirstChild'UpperTorso' or whom:FindFirstChild'LowerTorso' or whom:FindFirstChild'HumanoidRootPart')
  242. print(torso)
  243. if(torso and torso:IsA'BasePart')then
  244. local Model = Instance.new("Model",Effects)
  245. Model.Name = whom.Name..""
  246. whom:Remove()
  247. local Soul = Part(Model,Color3.new(math.random(), math.random(), math.random(), math.random(), math.random(), math.random()),'Neon',V3.N(.5,.5,.5),torso.CFrame,true,false)
  248. Soul.Name = 'Head'
  249. NewInstance("Humanoid",Model,{Health=0,MaxHealth=0})
  250. Effect{
  251. Effect="Arc",
  252. Manual = Soul,
  253. FXSettings={
  254. Start=torso.CFrame,
  255. Home = Torso,
  256. RemoveOnGoal = true,
  257. }
  258. }
  259. local lastPoint = Soul.CFrame.p
  260.  
  261. for i = 0, 1, 0.01 do
  262. local point = CFrame.new(lastPoint, Soul.Position) * CFrame.Angles(-math.pi/2, 0, 0)
  263. local mag = (lastPoint - Soul.Position).magnitude
  264. Effect{
  265. Effect = "Fade",
  266. CFrame = point * CF.N(0, mag/2, 0),
  267. Size = V3.N(.5,mag+.5,.5),
  268. Color = Soul.BrickColor
  269. }
  270. lastPoint = Soul.CFrame.p
  271. swait()
  272. end
  273. for i = 1, 5 do
  274. Effect{
  275. Effect="Fade",
  276. Color = Color3.new(math.random(), math.random(), math.random(), math.random(), math.random(), math.random()),
  277. MoveDirection = (Torso.CFrame*CFrame.new(M.RNG(-40,40),M.RNG(-40,40),M.RNG(-40,40))).p
  278. }
  279. end
  280. end
  281. end
  282. Mouse.MouseClick:connect(function(k)
  283. if(Mouse.Target and Mouse.Target.Parent and Mouse.Target.Parent:FindFirstChildOfClass'Humanoid' and Mouse.Target.Parent:FindFirstChildOfClass'Humanoid'.Health > 0)then
  284. SoulSteal(Mouse.Target.Parent)
  285. end
  286. end
  287. end)
  288. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement