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