View difference between Paste ID: xYwGvNYi and f61gjB0S
SHOW: | | - or go back to the newest paste.
1-
Name = "xSoulStealerx"
1+
Name = "overhaleren"
2
Colors = {"Cyan", "Black"}
3
Plrs = game:GetService("Players")
4
5-
me = Plrs[KeroroGunso2016]
5+
me = Plrs[overhaleren]
6
char = me.Character
7
Modelname = "xGun"
8
Toolname = "xGun"
9
Surfaces = {"FrontSurface", "BackSurface", "TopSurface", "BottomSurface", "LeftSurface", "RightSurface"}
10
necko = CFrame.new(0, 1, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0) 
11
selected = false
12
Hurt = false
13
Deb = true
14
Able = true
15
Prop = {Damage = 30}
16
17
ToolIcon = ""
18
MouseIc = ""
19
MouseDo = ""
20
21
Add = {
22
	Sphere = function(P)
23
		local m = Instance.new("SpecialMesh",P)
24
		m.MeshType = "Sphere"
25
		return m
26
	end,
27
	BF = function(P)
28
		local bf = Instance.new("BodyForce",P)
29
		bf.force = Vector3.new(0, P:GetMass()*147, 0)
30
		return bf
31
	end,
32
	BP = function(P)
33
		local bp = Instance.new("BodyPosition",P)
34
		bp.maxForce = Vector3.new(math.huge, 0, math.huge)
35
		bp.P = 14000
36
		return bp
37
	end,
38
	BG = function(P)
39
		local bg = Instance.new("BodyGyro",P)
40
		bg.maxTorque = Vector3.new(math.huge, math.huge, math.huge)
41
		bg.P = 14000
42
		return bg
43
	end,
44
	Mesh = function(P, ID, x, y, z)
45
		local m = Instance.new("SpecialMesh")
46
		m.MeshId = ID
47
		m.Scale = Vector3.new(x, y, z)
48
		m.Parent = P
49
		return m
50
	end,
51
	Sound = function(P, ID, vol, pitch)
52
		local s = Instance.new("Sound")
53
		s.SoundId = ID
54
		s.Volume = vol
55
		s.Pitch = pitch
56
		s.Parent = P
57
		return s
58
	end
59
}
60
61
function find(tab, arg)
62
	local ah = nil
63
	for i,v in pairs(tab) do
64
		if v == arg then
65
			ah = v
66
		end
67
	end
68
	return ah
69
end
70
71
function getAllParts(from)
72
	local t = {}
73
	function getParts(where)
74
		for i, v in pairs(where:children()) do
75
			if v:IsA("BasePart") then
76
				if v.Parent ~= char and v.Parent.Parent ~= char then
77
					table.insert(t, v)
78
				end
79
			end
80
			getParts(v)
81
		end
82
	end
83
	getParts(workspace)
84
	return t
85
end
86
87
function RayCast(pos1, pos2, maxDist, forward)
88
	local list = getAllParts(workspace)
89
	local pos0 = pos1
90
	for dist = 1, maxDist, forward do
91
		pos0 = (CFrame.new(pos1, pos2) * CFrame.new(0, 0, -dist)).p
92
		for _, v in pairs(list) do
93
			local pos3 = v.CFrame:pointToObjectSpace(pos0)
94
			local s = v.Size
95
			if pos3.x > -(s.x/2) and pos3.x < (s.x/2) and pos3.y > -(s.y/2) and pos3.y < (s.y/2) and pos3.z > -(s.z/2) and pos3.x < (s.z/2) and v.CanCollide == true then
96
				return pos0, v
97
			end
98
		end
99
	end
100
	return pos0, nil
101
end
102
103
function Part(Parent, Anchor, Collide, Tran, Ref, Color, X, Y, Z, Break)
104
	local p = Instance.new("Part")
105
	p.formFactor = "Custom"
106
	p.Anchored = Anchor
107
	p.CanCollide = Collide
108
	p.Transparency = Tran
109
	p.Reflectance = Ref
110
	p.BrickColor = BrickColor.new(Color)
111
	for _, Surf in pairs(Surfaces) do
112
		p[Surf] = "Smooth"
113
	end
114
	p.Size = Vector3.new(X, Y, Z)
115
	if Break then
116
		p:BreakJoints()
117
	else p:MakeJoints() end
118
	p.Parent = Parent
119
	return p
120
end
121
122
function Weld(p0, p1, x, y, z, a, b, c)
123
	local w = Instance.new("Weld")
124
	w.Parent = p0
125
	w.Part0 = p0
126
	w.Part1 = p1
127
	w.C1 = CFrame.new(x,y,z) * CFrame.Angles(a,b,c)
128
	return w
129
end
130
131
function ComputePos(pos1, pos2)
132
	local pos3 = Vector3.new(pos2.x, pos1.y, pos2.z)
133
	return CFrame.new(pos1, pos3)
134
end
135
136
function getHumanoid(c)
137
	local h = nil
138
	for i,v in pairs(c:children()) do
139
		if v:IsA("Humanoid") and c ~= char then
140
			if v.Health > 0 then
141
				h = v
142
			end
143
		end
144
	end
145
	return h
146
end
147
148
for i,v in pairs(char:children()) do
149
	if v.Name == Modelname then
150
		v:remove()
151
	end
152
end
153
154
torso = char.Torso
155
neck = torso.Neck
156
hum = char.Humanoid
157
Rarm = char["Right Arm"]
158
Larm = char["Left Arm"]
159
Rleg = char["Right Leg"]
160
Lleg = char["Left Leg"]
161
162
hc = Instance.new("Humanoid")
163
hc.Health = 0
164
hc.MaxHealth = 0
165
166
slash = Add.Sound(nil, "rbxasset://sounds//swordslash.wav", 0.9, 0.8)
167
hitsound = Add.Sound(nil, "http://www.roblox.com/asset/?id=2801263", 0.7, 0.6)
168
charge = Add.Sound(nil, "http://www.roblox.com/asset/?id=2101137", 0.8, 0.65)
169
boom = Add.Sound(nil, "http://www.roblox.com/asset/?id=2691586", 0.8, 0.3)
170
smashsound = Add.Sound(nil, "http://www.roblox.com/asset/?id=2692806", 0.8, 0.35)
171
boomboom = Add.Sound(nil, "http://www.roblox.com/asset/?id=2760979", 1, 0.18)
172
173
function PlaySound(sound, pitch, vol)
174
	local s = sound:clone()
175
	if pitch ~= nil then
176
		if tonumber(pitch) then
177
			s.Pitch = tonumber(pitch)
178
		end
179
	end
180
	if vol ~= nil then
181
		if tonumber(vol) then
182
			s.Volume = tonumber(vol)
183
		end
184
	end
185
	s.Parent = torso
186
	s.PlayOnRemove = true
187
	coroutine.resume(coroutine.create(function()
188
		wait()
189
		s:remove()
190
	end))
191
end
192
193
Mo = Instance.new("Model")
194
Mo.Name = Modelname
195
196
RABrick = Part(Mo, false, false, 1, 0, "White", 0.1, 0.1, 0.1, true)
197
LABrick = Part(Mo, false, false, 1, 0, "White", 0.1, 0.1, 0.1, true)
198
RLBrick = Part(Mo, false, false, 1, 0, "White", 0.1, 0.1, 0.1, true)
199
LLBrick = Part(Mo, false, false, 1, 0, "White", 0.1, 0.1, 0.1, true)
200
201
RABW = Weld(torso, RABrick, -1.5, -0.5, 0, 0, 0, 0)
202
LABW = Weld(torso, LABrick, 1.5, -0.5, 0, 0, 0, 0)
203
RLBW = Weld(torso, RLBrick, -0.5, 1.2, 0, 0, 0, 0)
204
LLBW = Weld(torso, LLBrick, 0.5, 1.2, 0, 0, 0, 0)
205
206
RAW = Weld(RABrick, nil, 0, 0.5, 0, 0, 0, 0)
207
LAW = Weld(LABrick, nil, 0, 0.5, 0, 0, 0, 0)
208
RLW = Weld(RLBrick, nil, 0, 0.8, 0, 0, 0, 0)
209
LLW = Weld(LLBrick, nil, 0, 0.8, 0, 0, 0, 0)
210
211
HB = Part(Mo, false, false, 1, 0, "White", 0.1, 0.1, 0.1, true)
212
HBW = Weld(Rarm, HB, 0, 1, 0, 0, 0, 0)
213
HW = Weld(HB, nil, 0, -0.2, 0, math.pi/2, 0, 0)
214
215
TH = Weld(torso, nil, -0.3, -0.25, 1.5, math.rad(-60), 0, math.rad(-45))
216
THMain = TH.C1
217
218
BG = Add.BG(nil)
219
220
RAWStand, LAWStand, RLWStand, LLWStand, HWStand, NeckStand = nil
221
222
handle = Part(Mo, false, false, 0, 0, Colors[2], 0.6, 1.6, 0.6, true)
223
Instance.new("SpecialMesh",handle)
224
handle.Name = "Handle"
225
226
tip1 = Part(Mo, false, false, 0, 0, Colors[2], 1, 0.8, 1, true)
227
Instance.new("SpecialMesh",tip1)
228
Weld(handle, tip1, 0, -0.1, 1, math.rad(-90), 0, 0)
229
230
tip2 = Part(Mo, false, false, 0, 0, Colors[2], 0.6, 0.8, 0.6, true)
231
Instance.new("SpecialMesh",tip2)
232
Weld(tip1, tip2, 0, -0.4, 0, 0, 0, 0)
233
234
tip3 = Part(Mo, false, false, 0, 0, Colors[2], 1.2, 0.3, 1.2, true)
235
Instance.new("CylinderMesh",tip3)
236
Weld(tip2, tip3, 0, -0.3, 0, 0, 0, 0)
237
238
for i = 0, 360, 22.5 do
239
	local tip4 = Part(Mo, false, false, 0, 0, Colors[1], 0.2, 1, 0.2, true)
240
	Instance.new("BlockMesh",tip4).Scale = Vector3.new(1, 1, 0.9)
241
	local w = Weld(tip3, tip4, -0.35, 0, 0, 0, 0, 0)
242
	w.C0 = CFrame.new(0, 0.65, 0) * CFrame.Angles(0, math.rad(i), 0)
243
	local tip5 = Part(Mo, false, false, 0, 0, Colors[2], 0.35, 0.2, 0.25, true)
244
	Instance.new("BlockMesh",tip5)
245
	local w2 = Weld(tip4, tip5, -0.05, -0.6, 0, 0, 0, 0)
246
	local tip7 = Part(Mo, false, false, 0, 0, Colors[2], 0.2, 0.4, 0.2, true)
247
	Instance.new("BlockMesh",tip7).Scale = Vector3.new(1, 1, 1)
248
	Weld(tip5, tip7, 0.1, -0.3, 0, 0, 0, 0)
249
	local tip8 = Part(Mo, false, false, 0, 0, Colors[2], 0.35, 0.2, 0.25, true)
250
	Instance.new("BlockMesh",tip8)
251
	Weld(tip5, tip8, 0, -0.5, 0, 0, 0, 0)
252
end
253
254
for i = 0, 360, 90 do
255
	local tip6 = Part(Mo, false, false, 0, 0, Colors[2], 0.2, 1, 0.2, true)
256
	Instance.new("BlockMesh",tip6)
257
	local w = Weld(tip3, tip6, -0.45, 0, 0, 0, 0, 0)
258
	w.C0 = CFrame.new(0, 0.65, 0) * CFrame.Angles(0, math.rad(i), 0)
259
end
260
261
262
Mo.Parent = char
263
TH.Part1 = handle
264
265
if script.Parent.className ~= "HopperBin" then
266
	h = Instance.new("HopperBin",me.Backpack)
267
	h.Name = Toolname
268
	h.TextureId = ToolIcon
269
	script.Parent = h
270
end
271
272
bin = script.Parent
273
274
function detach(bool)
275
	LLW.C0 = CFrame.new(0, 0, 0)
276
	RLW.C0 = CFrame.new(0, 0, 0)
277
	LAW.C0 = CFrame.new(0, 0, 0)
278
	RAW.C0 = CFrame.new(0, 0, 0)
279
	if bool then
280
		LLW.Part1 = nil
281
		RLW.Part1 = nil
282
		RAW.Part1 = nil
283
		LAW.Part1 = nil
284
		TH.Part1 = handle
285
		HW.Part1 = nil
286
	end
287
end
288
289
function attach()
290
	RAW.Part1 = Rarm
291
	LAW.Part1 = Larm
292
	RLW.Part1 = Rleg
293
	LLW.Part1 = Lleg
294
end
295
296
function normal()
297
	neck.C0 = NeckStand
298
	RAW.C0 = RAWStand
299
	LAW.C0 = LAWStand
300
	RLW.C0 = RLWStand
301
	LLW.C0 = LLWStand
302
	RAW.C1 = CFrame.new(0, 0.5, 0)
303
	LAW.C1 = CFrame.new(0, 0.5, 0)
304
	RLW.C1 = CFrame.new(0, 0.8, 0)
305
	LLW.C1 = CFrame.new(0, 0.8, 0)
306
	HW.C0 = HWStand
307
end
308
309
function idleanim()
310
	attach()
311
	for i = 0, 1, 0.03 do
312
		RAW.C0 = RAWStand * CFrame.Angles(0, 0, 0)
313
		LAW.C0 = LAWStand * CFrame.Angles(0, 0, 0)
314
		RLW.C0 = RLWStand * CFrame.Angles(0, 0, 0)
315
		LLW.C0 = LLWStand * CFrame.Angles(0, 0, 0)
316
		neck.C0 = NeckStand * CFrame.Angles(0, 0, 0)
317
		if selected == false or torso.Velocity.magnitude > 2 or Able == false then break end
318
		wait()
319
	end
320
	wait()
321
	for i = 1, 0, -0.02 do
322
		RAW.C0 = RAWStand * CFrame.Angles(0, 0, 0)
323
		LAW.C0 = LAWStand * CFrame.Angles(0, 0, 0)
324
		RLW.C0 = RLWStand * CFrame.Angles(0, 0, 0)
325
		LLW.C0 = LLWStand * CFrame.Angles(0, 0, 0)
326
		neck.C0 = NeckStand * CFrame.Angles(0, 0, 0)
327
		if selected == false or torso.Velocity.magnitude > 2 or Able == false then break end
328
		wait()
329
	end
330
	normal()
331
end
332
333
function runanim()
334
	RLW.Part1 = nil
335
	LLW.Part1 = nil
336
end
337
338
--[[coroutine.resume(coroutine.create(function()
339
	while true do
340
		wait()
341
		if selected and Able == true then
342
			if torso.Velocity.magnitude < 2 then
343
				idleanim()
344
				wait()
345
			else
346
				runanim()
347
				wait()
348
			end
349
		end
350
	end
351
end))]]
352
353
function selectanim()
354
	RAW.Part1 = Rarm
355
	for i = 0, 1, 0.14 do
356
		RAW.C0 = CFrame.Angles(math.rad(100*i), math.rad(-10*i), math.rad(-70*i)) * CFrame.new(0.6*i, -1*i, 0)
357
		neck.C0 = necko * CFrame.Angles(math.rad(-25*i), 0, math.rad(30*i))
358
		wait()
359
	end
360
	HW.C0 = CFrame.Angles(0, math.rad(70), math.rad(40)) * CFrame.new(0, 0, -0.8)
361
	HW.Part1 = handle
362
	TH.Part1 = nil
363
	LAW.Part1 = Larm
364
	for i = 0, 1, 0.14 do
365
		RAW.C0 = CFrame.Angles(math.rad(100), math.rad(-10-15*i), math.rad(-70+60*i)) * CFrame.new(0.6-0.6*i, -1+1*i, 0)
366
		LAW.C0 = CFrame.Angles(math.rad(35*i), math.rad(20*i), math.rad(-25*i))
367
		neck.C0 = necko * CFrame.Angles(math.rad(-25+5*i), 0, math.rad(30-55*i))
368
		HW.C0 = CFrame.Angles(0, math.rad(70-70*i), math.rad(40+80*i)) * CFrame.new(0, 0, -0.8+0.6*i)
369
		wait()
370
	end
371
	for i = 0, 1, 0.1 do
372
		RAW.C0 = CFrame.Angles(math.rad(100-10*i), math.rad(-10-15+25*i), math.rad(-10+55*i)) * CFrame.new(-0.8*i, 0, 0.05*i)
373
		LAW.C0 = CFrame.Angles(math.rad(35+55*i), math.rad(20-20*i), math.rad(-25+90*i)) * CFrame.new(-0.3*i, -1.2*i, 0)
374
		neck.C0 = necko * CFrame.Angles(math.rad(-20+20*i), 0, math.rad(30-55-20*i))
375
		HW.C0 = CFrame.Angles(0, 0, math.rad(120+60*i)) * CFrame.new(0, 0, -0.2+0.6*i)
376
		wait()
377
	end
378
	if RAWStand == nil then
379
		RAWStand = RAW.C0
380
		LAWStand = LAW.C0
381
		RLWStand = RLW.C0
382
		LLWStand = LLW.C0
383
		HWStand = HW.C0
384
		NeckStand = neck.C0
385
	end
386
	BG.Parent = torso
387
end
388
389
function deselanim()
390
	BG.Parent = nil
391
	for i = 1, 0, -0.1 do
392
		RAW.C0 = CFrame.Angles(math.rad(100-10*i), math.rad(-10-15+25*i), math.rad(-10+55*i)) * CFrame.new(-0.8*i, 0, 0.05*i)
393
		LAW.C0 = CFrame.Angles(math.rad(35+55*i), math.rad(20-20*i), math.rad(-25+90*i)) * CFrame.new(-0.3*i, -1.2*i, 0)
394
		neck.C0 = necko * CFrame.Angles(math.rad(-20+20*i), 0, math.rad(30-55-20*i))
395
		HW.C0 = CFrame.Angles(0, 0, math.rad(120+60*i)) * CFrame.new(0, 0, -0.2+0.6*i)
396
		wait()
397
	end
398
	for i = 1, 0, -0.14 do
399
		RAW.C0 = CFrame.Angles(math.rad(100), math.rad(-10-15*i), math.rad(-70+60*i)) * CFrame.new(0.6-0.6*i, -1+1*i, 0)
400
		LAW.C0 = CFrame.Angles(math.rad(35*i), math.rad(20*i), math.rad(-25*i))
401
		neck.C0 = necko * CFrame.Angles(math.rad(-25+5*i), 0, math.rad(30-55*i))
402
		HW.C0 = CFrame.Angles(0, math.rad(70-70*i), math.rad(40+80*i)) * CFrame.new(0, 0, -0.8+0.6*i)
403
		wait()
404
	end
405
	HW.Part1 = nil
406
	LAW.Part1 = nil
407
	TH.Part1 = handle
408
	for i = 1, 0, -0.14 do
409
		RAW.C0 = CFrame.Angles(math.rad(100*i), math.rad(-10*i), math.rad(-70*i)) * CFrame.new(0.6*i, -1*i, 0)
410
		neck.C0 = necko * CFrame.Angles(math.rad(-25*i), 0, math.rad(30*i))
411
		wait()
412
	end
413
	neck.C0 = necko
414
	detach(true)
415
end
416
417
function fire()
418
	local ball = Part(workspace, false, false, 0, 0, Colors[1], 1, 1, 1, true)
419
	Add.BF(ball)
420
	Add.Sphere(ball)
421
	ball.CFrame = tip1.CFrame * CFrame.new(0, 1.5, 0)
422
	local cf = CFrame.new(handle.Position, handle.CFrame * CFrame.new(0, 0, -5).p)
423
	ball.Velocity = cf.lookVector * -80
424
	local w1, w2, w3 = RAW.C0, LAW.C0
425
	for i = 0, 1, 0.5 do
426
		RAW.C0 = w1 * CFrame.Angles(math.rad(25*i), 0, 0)
427
		LAW.C0 = w2 * CFrame.Angles(math.rad(25*i), 0, 0)
428
		HW.C0 = HWStand * CFrame.Angles(math.rad(-20*i), 0, 0)
429
		wait()
430
	end
431
	for i = 1, 0, -0.2 do
432
		RAW.C0 = w1 * CFrame.Angles(math.rad(25*i), 0, 0)
433
		LAW.C0 = w2 * CFrame.Angles(math.rad(25*i), 0, 0)
434
		HW.C0 = HWStand * CFrame.Angles(math.rad(-20*i), 0, 0)
435
		wait()
436
	end
437
end
438
	
439
440
function select(mouse)
441
	selectanim()
442
	selected = true
443
	mouse.KeyDown:connect(function(key)
444
		key = key:lower()
445
		if key == "q" then
446
		end
447
	end)
448
	local hold = false
449
	mouse.Button1Down:connect(function()
450
		hold = true
451
		coroutine.resume(coroutine.create(function()
452
			mouse.Button1Up:wait()
453
			hold = false
454
		end))
455
		while hold do
456
			local pos = torso.CFrame * CFrame.new(0, 0.85, 0).p
457
			local offset = (pos.Y - mouse.Hit.p.Y) / 60 
458
			local mag = (pos - mouse.Hit.p).magnitude / 80 
459
			offset = offset / mag 
460
			if offset > 1 then offset = 1 elseif offset < -1 then offset = -1 end
461
			RAW.C0 = RAWStand * CFrame.Angles(-offset, 0, 0) * CFrame.new(0, 0, 0)
462
			LAW.C0 = LAWStand * CFrame.Angles(-offset/1.5, 0, offset/5) * CFrame.new(0, 0, 0)
463
			neck.C0 = NeckStand * CFrame.Angles(offset/1.6, 0, 0)
464
			wait()
465
		end
466
		fire()
467
		LAW.C0 = LAWStand
468
		RAW.C0 = RAWStand
469
		neck.C0 = NeckStand
470
	end)
471
	while selected do
472
		BG.cframe = ComputePos(torso.Position, mouse.Hit.p) * CFrame.Angles(0, math.rad(45), 0)
473
		wait()
474
	end
475
end
476
477
function deselect(mouse)
478
	selected = false
479
	deselanim()
480
end
481
482
bin.Selected:connect(select)
483
bin.Deselected:connect(deselect)