View difference between Paste ID: RWv4pYZv and LM2354PZ
SHOW: | | - or go back to the newest paste.
1-
--MADE BY OneLegend (NOT THE SCRIPT) Thanks to CyberFromLU for letting me Publish! LOCAL SCRIPT: JUST RUN!
1+
2-
-------------------------------------------------------------------------------------
2+
3
Me = Players.LocalPlayer
4
Char = Me.Character
5
necko = CFrame.new(0, 1, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0) 
6
ShootColors = {"Bright yellow", "New Yeller", "Bright orange", "Neon orange", "Really red", "Bright red"}
7
PlaceId = game.PlaceId
8
9
Selected = false
10
Attacking = false
11
Accuracy = 5
12
Debounce = true
13
Hurt = false
14
Damage = {9999}
15-
Damage = {15,42}
15+
16
ContentProvider = game:GetService("ContentProvider")
17
18
V3 = Vector3.new
19
C3 = Color3.new
20
BN = BrickColor.new
21
CN = CFrame.new
22
CA = CFrame.Angles
23
MR = math.rad
24
MRA = math.random
25
MP = math.pi
26
MH = math.huge
27
UD = UDim2.new
28
29
function RC(Pos, Dir, Max, Ignore)
30
	return workspace:FindPartOnRay(Ray.new(Pos, Dir.unit * (Max or 999)), Ignore)
31
end
32
33
function RayC(Start, En, MaxDist, Ignore)
34
	return RC(Start, (En - Start), MaxDist, Ignore)
35
end
36
37
function ComputePos(pos1, pos2)
38
	return CN(pos1, V3(pos2.x, pos1.y, pos2.z))
39
end
40
41
function DetectSurface(pos, part)
42
	local surface = nil
43
	local pospos = part.CFrame
44
	local pos2 = pospos:pointToObjectSpace(pos)
45
	local siz = part.Size
46
	local shaep = part.Shape
47
	if shaep == Enum.PartType.Ball or shaep == Enum.PartType.Cylinder then
48
		surface = {"Anything", CN(pospos.p, pos)*CN(0, 0, -(pospos.p - pos).magnitude)*CA(MR(-90), 0, 0)}
49
	else
50
		if pos2.Y > ((siz.Y/2)-0.04) then
51
			surface = {"Top", CA(0, 0, 0)}
52
		elseif pos2.Y < -((siz.Y/2)-0.04) then
53
			surface = {"Bottom", CA(-MP, 0, 0)}
54
		elseif pos2.X > ((siz.X/2)-0.04) then
55
			surface = {"Right", CA(0, 0, MR(-90))}
56
		elseif pos2.X < -((siz.X/2)-0.04) then
57
			surface = {"Left", CA(0, 0, MR(90))}
58
		elseif pos2.Z > ((siz.Z/2)-0.04) then
59
			surface = {"Back", CA(MR(90), 0, 0)}
60
		elseif pos2.Z < -((siz.Z/2)-0.04) then
61
			surface = {"Front", CA(MR(-90), 0, 0)}
62
		end
63
	end
64
	return surface
65
end
66
67
function Compute(pos1, pos2)
68
	local pos3 = Vector3.new(pos2.x, pos1.y, pos2.z)
69
	return CN(pos1, pos3)
70
end
71
72
function waitChild(n, p)
73
	local c = p:findFirstChild(n)
74
	if c then return c end
75
	while true do
76
		c = p.ChildAdded:wait()
77
		if c.Name == n then return c end
78
	end
79
end
80
81
function Notime(func)
82
	coroutine.resume(coroutine.create(function()
83
		func()
84
	end))
85
end
86
87
Torso = waitChild("Torso", Char)
88
Head = waitChild("Head", Char)
89
Rarm = waitChild("Right Arm", Char)
90
Larm = waitChild("Left Arm", Char)
91
Rleg = waitChild("Right Leg", Char)
92
Lleg = waitChild("Left Leg", Char)
93
Neck = waitChild("Neck", Torso)
94
Hum = waitChild("Humanoid", Char)
95
96
RSH = waitChild("Right Shoulder", Torso)
97
LSH = waitChild("Left Shoulder", Torso)
98
RH = waitChild("Right Hip", Torso)
99
LH = waitChild("Left Hip", Torso)
100
101
RSH.Part0 = Torso
102
LSH.Part0 = Torso
103
RH.Part0 = Torso
104
LH.Part0 = Torso
105
106
Add = {
107
	Mesh = function(P, ID, Scale, Tex)
108
		local m = Instance.new("SpecialMesh")
109
		m.MeshType = "FileMesh"
110
		m.MeshId = ID or ""
111
		m.Scale = Scale or V3(1, 1, 1)
112
		m.TextureId = Tex or ""
113
		m.Parent = P
114
		return m
115
	end,
116
	Sphere = function(P, Scale)
117
		local m = Instance.new("SpecialMesh")
118
		m.MeshType = "Sphere"
119
		m.Scale = Scale or V3(1, 1, 1)
120
		m.Parent = P
121
		return m
122
	end
123
}
124
125
Sounds = {
126
	Shoot = {Id = "http://www.roblox.com/asset/?id=2697431", Pitch = 0.3, Volume = 0.5},
127
	Boom = {Id = "http://www.roblox.com/asset/?id=2692806", Pitch = 0.55, Volume = 0.4},
128
	Slash = {Id = "rbxasset://sounds//swordslash.wav", Pitch = 0.5, Volume = 0.5},
129
	Hit = {Id = "http://www.roblox.com/asset/?id=2801263", Pitch = 0.85, Volume = 0.35},
130
	Reload = {Id = "rbxasset://sounds\\metal.ogg", Pitch = 1, Volume = 0.45},
131
}
132
133
for _,v in pairs(Sounds) do
134
	ContentProvider:Preload(v.Id)
135
end
136
137
function PlaySound(Sound, bool)
138
	local s = Instance.new("Sound")
139
	s.Looped = false
140
	s.Volume = Sound.Volume
141
	s.SoundId = Sound.Id
142
	if bool then
143
		s.Pitch = MRA((Sound.Pitch*0.75)*1000, (Sound.Pitch*1.15)*1000)/1000
144
	else
145
		s.Pitch = Sound.Pitch
146
	end
147
	s.PlayOnRemove = true
148
	s.Parent = Torso
149
	Notime(function()
150
		wait()
151
		s.Parent = nil
152
	end)
153
end
154
155
function GetParts(pos, dist)
156
	local parts = {}
157
	local function o(p)
158
		for _,v in pairs(p:children()) do
159
			if v:IsA("BasePart") then
160
				if (pos - v.Position).magnitude <= dist then
161
					table.insert(parts, {v, (pos - v.Position).magnitude, v.Anchored})
162
				end
163
			end
164
			o(v)
165
		end
166
	end
167
	o(workspace)
168
	return parts
169
end
170
171
function GetHum(P)
172
	for _,v in pairs(P:children()) do
173
		if v:IsA("Humanoid") then
174
			if v.Health > 0 then
175
				return v
176
			end
177
		end
178
	end
179
end
180
181
function GetGroup(Pos, Distance, Hit)
182
	local tab = {}
183
	for _,v in pairs(workspace:children()) do
184
		local h = GetHum(v)
185
		local t = v:findFirstChild("Torso")
186
		if h and t and v ~= Hit.Parent then
187
			if (t.Position - Pos).magnitude <= Distance then
188
				table.insert(tab, {h, v, (t.Position - Pos).magnitude})
189
			end
190
		end
191
	end
192
	if Hit then
193
		local h = GetHum(Hit.Parent)
194
		if h then
195
			table.insert(tab, {h, Hit.Parent, 0})
196
		end
197
	end
198
	return tab
199
end
200
201
function Tag(hum)
202
	if PlaceId == 48513881 then
203
		local tag = Instance.new("ObjectValue")
204
		tag.Name = "creator"
205
		tag.Value = Me
206
		tag.Parent = hum
207
	end
208
end
209
210
function Part(Par, Anc, Colli, Tran, Ref, Col, Siz)
211
	local p = Instance.new("Part")
212
	p.formFactor = "Custom"
213
	p.TopSurface = 0
214
	p.BottomSurface = 0
215
	p.Transparency = Tran
216
	p.Reflectance = Ref
217
	p.Anchored = Anc
218
	p.CanCollide = Colli
219
	p.BrickColor = Col
220
	p.Size = Siz
221
	p.Locked = true
222
	p.Parent = Par
223
	p:BreakJoints()
224
	return p
225
end
226
227
function Weld(P0, P1, C0, C1)
228
	local w = Instance.new("Weld")
229
	w.Part0 = P0
230
	w.Part1 = P1
231
	if C0 then
232
		w.C0 = C0
233
	end
234
	if C1 then
235
		w.C1 = C1
236
	end
237
	w.Parent = P0
238
	return w
239
end
240
241
for _,v in pairs(Char:children()) do
242
	if v.Name == "Hand Cannon" then
243
		v:remove()
244
	end
245
end
246
247
Model = Instance.new("Model")
248
Model.Name = "Hand Cannon"
249
250
FTorso = Part(Model, false, false, 1, 0, Torso.BrickColor, V3(2, 2, 1))
251
FW = Weld(Torso, FTorso)
252
253
RAB = Part(Model, false, false, 1, 0, BN("White"), V3(0.2, 0.2, 0.2))
254
LAB = Part(Model, false, false, 1, 0, BN("White"), V3(0.2, 0.2, 0.2))
255
RLB = Part(Model, false, false, 1, 0, BN("White"), V3(0.2, 0.2, 0.2))
256
LLB = Part(Model, false, false, 1, 0, BN("White"), V3(0.2, 0.2, 0.2))
257
258
RABW = Weld(Torso, RAB, CN(), CN(-1.5, -0.5, 0))
259
LABW = Weld(Torso, LAB, CN(), CN(1.5, -0.5, 0))
260
RLBW = Weld(Torso, RLB, CN(), CN(-0.5, 1, 0))
261
LLBW = Weld(Torso, LLB, CN(), CN(0.5, 1, 0))
262
263
RAW = Weld(RAB, nil, CN(), CN(0, 0.5, 0))
264
LAW = Weld(LAB, nil, CN(), CN(0, 0.5, 0))
265
RLW = Weld(RLB, nil, CN(), CN(0, 1, 0))
266
LLW = Weld(LLB, nil, CN(), CN(0, 1, 0))
267
268
TW = Weld(Torso, nil, CN(0.7, 0.8, 1.2), CA(0, MR(180), MR(55)))
269
270
Weapon = Instance.new("Model")
271
Weapon.Name = "Cannon"
272
273
HB = Part(Weapon, false, false, 1, 0, BN("White"), V3(0.2, 0.2, 0.2))
274
HBW = Weld(Rarm, HB, CN(0, -0.7, 0), CA(0, MR(90), MR(90)))
275
HW = Weld(HB, nil)
276
277
Handle = Part(Weapon, false, false, 0, 0, BN("Dark grey"), V3(0.5, 0.5, 0.3))
278
Add.Mesh(Handle, "http://www.roblox.com/asset/?id=3270017", V3(1, 0.7, 2.2), "")
279
TW.Part1 = Handle
280
281
Main = Part(Weapon, false, false, 0, 0, BN("Dark grey"), V3(1.5, 1.5, 2.5))
282
Add.Mesh(Main, "http://www.roblox.com/asset/?id=3270017", V3(1.6, 1.6, 15), "")
283
Weld(Handle, Main, CA(0, MR(90), MR(90)), CN(1, 0, 0.2))
284
285
Main2 = Part(Weapon, false, false, 0, 0, BN("Gun metallic"), V3(1, 1, 1.5))
286
Add.Mesh(Main2, "http://www.roblox.com/asset/?id=3270017", V3(1.2, 1.2, 8), "")
287
Weld(Main, Main2, CN(), CN(0, 0, 1.7))
288
289
Handle2 = Part(Weapon, false, false, 0, 0, BN("Dark grey"), V3(0.5, 0.5, 0.3))
290
Add.Mesh(Handle2, "http://www.roblox.com/asset/?id=3270017", V3(0.7, 0.8, 2.2), "")
291
Weld(Main2, Handle2, CA(0, MR(90), MR(90)), CN(-0.65, 0, 0))
292
293
Tip = Part(Weapon, false, false, 0, 0, BN("Earth yellow"), V3(1.6, 1.6, 0.6))
294
Add.Sphere(Tip, V3(1.05, 1.05, 1))
295
Weld(Main, Tip, CN(), CN(0, 0, -1.15))
296
297
Tip4 = Part(Weapon, false, false, 0, 0, BN("Black"), V3(1.2, 1.2, 0.3))
298
Add.Mesh(Tip4, "http://www.roblox.com/asset/?id=3270017", V3(1.7, 1.7, 10), "")
299
Weld(Main, Tip4, CN(), CN(0, 0, -0.15))
300
301
for i = 1.3, 1.45, 0.1 do
302
	local Tip3 = Part(Weapon, false, false, 0, 0, BN("Dark grey"), V3(1.2, 1.2, 0.3))
303
	Add.Mesh(Tip3, "http://www.roblox.com/asset/?id=3270017", V3(i, i, 2), "")
304
	Weld(Main2, Tip3, CN(), CN(0, 0, 0.6))
305
end
306
307
for i = -0.95, 0.66, 1.55 do
308
	local Tip3 = Part(Weapon, false, false, 0, 0, BN("Dark Curry"), V3(1.2, 1.2, 0.3))
309
	Add.Mesh(Tip3, "http://www.roblox.com/asset/?id=3270017", V3(1.65, 1.65, 3), "")
310
	Weld(Main, Tip3, CN(), CN(0, 0, i))
311
end
312
313
for i = 1.3, 1.5, 0.1 do
314
	local Tip2 = Part(Weapon, false, false, 0, 0, BN("Earth yellow"), V3(1.6, 1.6, 0.6))
315
	Add.Mesh(Tip2, "http://www.roblox.com/asset/?id=3270017", V3(i, i, 2), "")
316
	Weld(Main, Tip2, CN(), CN(0, 0, 1.1))
317
end
318
319
for i = -0.3, 1, 0.15 do
320
	local p = Part(Weapon, false, false, 0.7, 0, BN("Black"), V3(0.2, 0.2, 0.2))
321
	Add.Sphere(p, V3(6, 6, 2))
322
	Weld(Main2, p, CN(0, 0, i))
323
end
324
325
function Show_Damage(P, D)
326
	local mo = Instance.new("Model")
327
	mo.Name = "- "..D
328
	local p = Part(mo, false, false, 0, 0, BN("Bright red"), V3(0.2, 0.2, 0.2))
329
	p.Name = "Head"
330
	local m = Instance.new("SpecialMesh")
331
	m.MeshType = "Brick"
332
	m.Scale = Vector3.new(4.5, 2.3, 4.5)
333
	m.Parent = p
334
	local bp = Instance.new("BodyPosition", p)
335
	bp.maxForce = V3(MH, MH, MH)
336
	bp.P = 9001
337
	bp.position = CN(P) * CN(0, 1.5, 0).p
338
	local h = Instance.new("Humanoid")
339
	h.Health = 0
340
	h.MaxHealth = 0
341
	h.Name = "asd"
342
	h.Parent = mo
343
	local nah = true
344
	mo.Parent = workspace
345
	p.CFrame = CN(P) 
346
	Notime(function()
347
		wait(1.5)
348
		for i = 0, 1, 0.05 do
349
			p.Transparency = i
350
			if nah then mo.Name = "" nah = false else mo.Name = "- "..D nah = true end
351
			wait()
352
		end
353
		mo:remove()
354
	end)
355
end
356
357
function Kill(hit)
358
	if Debounce and Hurt then
359
		local Hu = GetHum(hit.Parent)
360
		if Hu then
361
			Debounce = false
362
			local Dmg = MRA(Damage[1], Damage[2])
363
			Hu.Health = Hu.Health - Dmg
364
			Show_Damage(Tip.Position, Dmg)
365
			PlaySound(Sounds.Hit, true)
366
			Tag(Hu)
367
			local chance = MRA(1, 10)
368
			if chance >=5 then
369
				Hu.PlatformStand = true
370
				wait(0.15)
371
				hit.Velocity = (CN(Torso.CFrame * CN(0, 0.5, 0).p, hit.Position).lookVector * 45)
372
				hit.RotVelocity = V3(MRA(-10, 10), MRA(-10, 10), MRA(-10, 10))
373
				wait(0.3)
374
				Hu.PlatformStand = false
375
			end
376
		end
377
	end
378
end
379
380
Main.Touched:connect(Kill)
381
382
Weapon.Parent = Model
383
Model.Parent = Char
384
385
if script.Parent.className ~= "HopperBin" then
386
	h = Instance.new("HopperBin", Me.Backpack)
387
	h.Name = "Hand Cannon"
388
	script.Parent = h
389
end
390
391
bin = script.Parent
392
393
function Attach(t)
394
	RSH.Part0 = t
395
	LSH.Part0 = t
396
	RH.Part0 = t
397
	LH.Part0 = t
398
	RABW.Part0 = t
399
	LABW.Part0 = t
400
	LLBW.Part0 = t
401
	RLBW.Part0 = t
402
	if t == Torso then
403
		FTorso.Transparency = 1
404
	else
405
		Torso.Transparency = 1
406
	end
407
	t.Transparency = 0
408
end
409
410
function SelectAnim()
411
	RAW.Part1 = Rarm
412
	for i = 0.25, 1, 0.25 do
413
		RAW.C0 = CA(MR(-10*i), 0, MR(-5*i))
414
		wait()
415
	end
416
	for i = 0.1, 1, 0.1 do
417
		RAW.C0 = CA(MR(-10-90*i), 0, MR(-5-30*i))
418
		wait()
419
	end
420
	for i = 0.5, 1, 0.5 do
421
		RAW.C0 = CA(MR(-100-5*i), 0, MR(-35))
422
		wait()
423
	end
424
	HW.Part1 = Handle
425
	HW.C0 = CA(MR(50), 0, MR(-37))
426
	TW.Part1 = nil
427
	Attach(FTorso)
428
	LAW.Part1 = Larm
429
	for i = 0.25, 1, 0.25 do
430
		RAW.C0 = CA(MR(-105+10*i), 0, MR(-35+5*i))
431
		LAW.C0 = CA(MR(15*i), 0, MR(5*i))
432
		FW.C0 = CA(0, MR(-5*i), 0)
433
		HW.C0 = CA(MR(50-5*i), 0, MR(-37))
434
		wait()
435
	end
436
	for i = 0.06, 1, 0.06 do
437
		RAW.C0 = CA(MR(-95+95*i), MR(35*i), MR(-30+50*i))
438
		LAW.C0 = CA(MR(15+25*i), 0, MR(5+15*i)) * CN(0, -0.4*i, 0)
439
		FW.C0 = CA(0, MR(-5-30*i), 0)
440
		HW.C0 = CA(MR(45), 0, MR(-37+15*i))
441
		wait()
442
	end
443
	Hum.WalkSpeed = 10
444
	for i = 0.1, 1, 0.1 do
445
		RAW.C0 = CA(MR(15*i), MR(35+10*i), MR(20+8*i))
446
		LAW.C0 = CA(MR(40+7*i), 0, MR(20+6*i)) * CN(0, -0.4-0.2*i, 0)
447
		FW.C0 = CA(0, MR(-35-10*i), 0)
448
		HW.C0 = CA(MR(45-11*i), 0, MR(-22+15*i))
449
		wait()
450
	end
451
	for i = 0.25, 1, 0.25 do
452
		RAW.C0 = CA(MR(15+5*i), MR(45+5*i), MR(28+2*i))
453
		LAW.C0 = CA(MR(47+3*i), 0, MR(26+4*i)) * CN(0, -0.6, 0)
454
		FW.C0 = CA(0, MR(-45-5*i), 0)
455
		HW.C0 = CA(MR(34-4*i), 0, MR(-7+7*i))
456
		wait()
457
	end
458
end
459
460
function DeselAnim()
461
	for i = 0.25, 1, 0.25 do
462
		RAW.C0 = CA(MR(20-5*i), MR(50-5*i), MR(30-5*i))
463
		LAW.C0 = CA(MR(50-5*i), 0, MR(30-5*i)) * CN(0, -0.6+0.1*i, 0)
464
		FW.C0 = CA(0, MR(-50+5*i), 0)
465
		HW.C0 = CA(MR(30+5*i), 0, MR(-10*i))
466
		wait()
467
	end
468
	for i = 0.15, 1, 0.15 do
469
		RAW.C0 = CA(MR(15-30*i), MR(45-10*i), MR(25-5*i))
470
		LAW.C0 = CA(MR(45-20*i), 0, MR(25-15*i)) * CN(0, -0.5+0.2*i, 0)
471
		FW.C0 = CA(0, MR(-45+10*i), 0)
472
		HW.C0 = CA(MR(35+10*i), 0, MR(-10-15*i))
473
		wait()
474
	end
475
	for i = 0.12, 1, 0.12 do
476
		RAW.C0 = CA(MR(-15-70*i), MR(35-30*i), MR(20-30*i))
477
		LAW.C0 = CA(MR(25-25*i), 0, MR(10-10*i)) * CN(0, -0.3+0.3*i, 0)
478
		FW.C0 = CA(0, MR(-35+20*i), 0)
479
		HW.C0 = CA(MR(45+5*i), 0, MR(-25-12*i))
480
		wait()
481
	end
482
	LAW.Part1 = nil
483
	HW.C0 = CA(MR(50), 0, MR(-37))
484
	for i = 0.25, 1, 0.25 do
485
		RAW.C0 = CA(MR(-85-20*i), MR(5-5*i), MR(-10-25*i))
486
		FW.C0 = CA(0, MR(-15+15*i), 0)
487
		wait()
488
	end
489
	Attach(Torso)
490
	HW.Part1 = nil
491
	TW.Part1 = Handle
492
	Hum.WalkSpeed = 16
493
	for i = 0.15, 1, 0.15 do
494
		RAW.C0 = CA(MR(-105+95*i), 0, MR(-35+30*i))
495
		wait()
496
	end
497
	for i = 0.33, 1, 0.33 do
498
		RAW.C0 = CA(MR(-10+10*i), 0, MR(-5+5*i))
499
		wait()
500
	end
501
	RAW.Part1 = nil
502
end
503
504
--Norms:
505
--RAW.C0 = CA(MR(20), MR(50), MR(30))
506
--LAW.C0 = CA(MR(50), 0, MR(30)) * CN(0, -0.6, 0)
507
--FW.C0 = CA(0, MR(-50), 0)
508
--HW.C0 = CA(MR(30), 0, 0)
509
--
510
--
511
512
function Explode(Par, Pos, surface)
513
	Notime(function()
514
		local cf = CN(Pos) * CA(Par.CFrame:toEulerAnglesXYZ()) * surface[2] * CN(0, 1, 0)
515
		if surface[1] == "Anything" then
516
			cf = surface[2]
517
		end
518
		local col = Par.BrickColor.Color
519
		local r, g, b = col.r, col.g, col.b
520
		local col1, col2, col3 = C3(MRA(r*60, r*100)/100, MRA(g*60, g*100)/100, MRA(b*60, b*100)/100), C3(MRA(r*60, r*100)/100, MRA(g*60, g*100)/100, MRA(b*60, b*100)/100), C3(MRA(r*60, r*100)/100, MRA(g*60, g*100)/100, MRA(b*60, b*100)/100)
521
		local p = Part(workspace, true, false, 0, 0, BN(col1.r, col1.g, col1.b), V3(0.2, 0.2, 0.2))
522
		local p2 = Part(workspace, true, false, 0, 0, BN(col2.r, col2.g, col2.b), V3(0.2, 0.2, 0.2))
523
		local p3 = Part(workspace, true, false, 0, 0, BN(col3.r, col3.g, col3.b), V3(0.2, 0.2, 0.2))
524
		p.CFrame = cf
525
		p2.CFrame = cf
526
		p3.CFrame = cf
527
		local m = Add.Mesh(p, "http://www.roblox.com/asset/?id=20329976", V3(1, 1, 1))
528
		local m2 = Add.Mesh(p2, "http://www.roblox.com/asset/?id=20329976", V3(1, 1, 1))
529
		local m3 = Add.Mesh(p3, "http://www.roblox.com/asset/?id=20329976", V3(1, 1, 1))
530
		for i = -0.2, 1, 0.12 do
531
			p2.Transparency = i+0.1
532
			p.Transparency = i
533
			p3.Transparency = i+0.2
534
			m.Scale = V3(1+2.5*i, 1.4+1*i, 1+2.5*i)
535
			m2.Scale = V3(0.8+2*i, 1.2+1*i, 0.8+2*i)
536
			m3.Scale = V3(0.5+1*i, 1+1*i, 0.5+1*i)
537
			wait()
538
		end
539
		p2:remove()
540
		p3:remove()
541
		p:remove()
542
	end)
543
end
544
545
function Shoot(Pos)
546
	coroutine.resume(coroutine.create(function()
547
	local acc = Accuracy*100
548
	local Start = Main2.CFrame * CN(0, 0, -0.5).p
549
	local Face = CN(Start, Pos) * CA(MR(MRA(-acc, acc))/100, MR(MRA(-acc, acc))/100, MR(MRA(-acc, acc))/100)
550
	local Cannonball = Part(Model, true, false, 0, 0, BN("Black"), V3(1.3, 1.3, 1.3))
551
	Add.Sphere(Cannonball)
552
	Cannonball.CFrame = Face
553
	local Go = 3
554
	local Drop = 0.55/(Go*3)
555
	local Dist = 500
556
	local lastP = Start
557
	local omg = 0
558
	for i = Go, Dist, Go do
559
		Drop = Drop + 1/(Go*3)
560
		omg = omg + Drop
561
		local dropping = CA(MR(-Drop), 0, 0)
562
		if omg > 130 then
563
			dropping = CN()
564
		end
565
		Face = Face * dropping * CN(0, 0, -Go)
566
		Cannonball.CFrame = Face
567
		local Magn = (Face.p - lastP).magnitude
568
		local T = Part(Model, true, false, 0.1, 0, BN("Mid gray"), V3(0.2, 1, 0.2))
569
		local M = Instance.new("SpecialMesh",T)
570
		M.MeshType = "Head"
571
		M.Scale = V3(5, Magn, 5)
572
		T.CFrame = CN(lastP, Face.p) * CA(MR(-90), 0, 0) * CN(0, Magn/2, 0)
573
		Notime(function()
574
			wait(0.1)
575
			for i = 0.1, 1, 0.1 do
576
				T.Transparency = i+0.1
577
				M.Scale = V3(5-5*i, Magn+0.5, 5-5*i)
578
				wait()
579
			end
580
			T:remove()
581
		end)
582
		local Hit, Hitpos = RayC(lastP, Face.p, Go*2, Char)
583
		lastP = Face.p
584
		if Hit then
585
			PlaySound(Sounds.Boom, true)
586
			local s = DetectSurface(Hitpos, Hit)
587
			Explode(Hit, Hitpos, s)
588
			Cannonball.CFrame = CN(Hitpos)
589
			local hu = GetHum(Hit.Parent)
590
			if hu == nil and Hit.Parent.className ~= "Hat" and Hit.Anchored then
591
				coroutine.resume(coroutine.create(function()
592
					wait(10)
593
					for i = 0, 1, 0.04 do
594
						Cannonball.Transparency = i
595
						wait()
596
					end
597
					Cannonball:remove()
598
				end))
599
			else
600
				Cannonball:remove()
601
			end
602
			local Noobs = GetGroup(Hitpos, 5, Hit)
603
			for _,v in pairs(Noobs) do
604
				local dm = 60/((v[3]+3)/3)
605
				dm = MRA(dm*0.9, dm*1.04)
606
				v[1].Health = v[1].Health - dm
607
				local t = v[2]:findFirstChild("Head")
608
				if t then
609
					Show_Damage(t.Position, dm)
610
				end
611
				pcall(function()
612
				Tag(v[1])
613
				end)
614
			end
615
			local Parts = GetParts(Hitpos, 7)
616
			for _,v in pairs(Parts) do
617
				if v[3] == false then
618
					Notime(function()
619
						if v[1].Name == "Brick wall" then
620
							v[1]:BreakJoints()
621
							v[1].Velocity = (CN(Hitpos, v[1].Position).lookVector * (110/((v[2]+2)/3)))
622
							wait(0.1)
623
							v[1].Velocity = (CN(Hitpos, v[1].Position).lookVector * (110/((v[2]+2)/3)))
624
						else
625
							v[1].Velocity = (CN(Hitpos, v[1].Position).lookVector * (80/((v[2]+2)/3)))
626
						end
627
					end)
628
				end
629
			end
630
			break
631
		end
632
		wait()
633
	end
634
	end))
635
end
636
637
function ShootAnim(pos)
638
	RLW.Part1 = Rleg
639
	LLW.Part1 = Lleg
640
	local cf = ComputePos(Torso.Position, pos)
641
	local bp = Instance.new("BodyPosition",Torso)
642
	bp.maxForce = V3(MH, 0, MH)
643
	bp.P = 10000
644
	PlaySound(Sounds.Shoot, true)
645
	local effect = Part(Model, false, false, 0, 0, BN(ShootColors[MRA(1,#ShootColors)]), V3(0.2, 0.2, 0.2))
646
	local effect2 = Part(Model, false, false, 0, 0, BN(ShootColors[MRA(1,#ShootColors)]), V3(0.2, 0.2, 0.2))
647
	local m1 = Add.Mesh(effect, "http://www.roblox.com/asset/?id=20329976", V3(1,1,1))
648
	local m2 = Add.Mesh(effect2, "http://www.roblox.com/asset/?id=20329976", V3(1,1,1))
649
	local w1 = Weld(Main2, effect, CA(MR(-90), 0, 0), CN(0, -1, 0))
650
	local w2 = Weld(Main2, effect2, CA(MR(-90), 0, 0), CN(0, -1, 0))
651
	for i = 0, 1, 0.5 do
652
		RAW.C0 = CA(MR(20-50*i), MR(50-25*i), MR(30+45*i))
653
		LAW.C0 = CA(MR(50-10*i), 0, MR(30+20*i)) * CN(0, -0.6-0.3*i, 0)
654
		RLW.C0 = CA(MR(30*i), 0, MR(-15*i))
655
		LLW.C0 = CA(MR(10*i), 0, MR(-35*i))
656
		FW.C0 = CA(MR(5*i), MR(-50-15*i), 0)
657
		HW.C0 = CA(MR(30), MR(35*i), MR(-25*i))
658
		Neck.C0 = necko * CA(MR(10*i), 0, 0)
659
		bp.position = cf * CN(0, 0, 3*i).p
660
		m1.Scale = V3(0.5+0.6*i, 0.4+0.2*i, 0.5+0.6*i)
661
		m2.Scale = V3(0.3+0.5*i, 0.5+1*i, 0.3+0.5*i)
662
		w1.C1 = CN(0, -1-0.2*i, 0)
663
		w2.C1 = CN(0, -1-0.5*i, 0)
664
		effect.Transparency = 0.2*i
665
		effect2.Transparency = 0.2*i
666
		wait()
667
	end
668
	for i = 0.2, 1, 0.2 do
669
		RAW.C0 = CA(MR(-30-10*i), MR(25-5*i), MR(75+5*i))
670
		LAW.C0 = CA(MR(40-5*i), 0, MR(50+5*i)) * CN(0, -0.9-0.05*i, 0)
671
		RLW.C0 = CA(MR(30+5*i), 0, MR(-15))
672
		LLW.C0 = CA(MR(10+5*i), 0, MR(-35-5*i))
673
		FW.C0 = CA(MR(5+5*i), MR(-65-5*i), 0)
674
		HW.C0 = CA(MR(30), MR(35+5*i), MR(-25-5*i))
675
		Neck.C0 = necko * CA(MR(10+5*i), 0, 0)
676
		bp.position = cf * CN(0, 0, 3+1*i).p
677
		m1.Scale = V3(1+1*i, 0.7+0.9*i, 1+1*i)
678
		m2.Scale = V3(0.8+0.6*i, 1.5+1.6*i, 0.8+0.6*i)
679
		w1.C1 = CN(0, -1.2-0.6*i, 0)
680
		w2.C1 = CN(0, -1.5-1.8*i, 0)
681
		effect.Transparency = 0.2+0.9*i
682
		effect2.Transparency = 0.2+0.9*i
683
		wait()
684
	end
685
	effect:remove()
686
	effect2:remove()
687
	for i = 0.2, 1, 0.2 do
688
		bp.position = cf * CN(0, 0, 4+0.8*i).p
689
		wait()
690
	end
691
	for i = 0.08, 1, 0.06 do
692
		RAW.C0 = CA(MR(-40+50*i), MR(20+15*i), MR(80-35*i))
693
		LAW.C0 = CA(MR(35-30*i), 0, MR(55-45*i)) * CN(0, -0.95+0.5*i, 0)
694
		RLW.C0 = CA(MR(35-35*i), 0, MR(-15+25*i))
695
		LLW.C0 = CA(MR(15-15*i), 0, MR(-40+30*i))
696
		FW.C0 = CA(MR(10-7*i), MR(-70+40*i), 0)
697
		HW.C0 = CA(MR(30), MR(40-40*i), MR(-30-10*i))
698
		Neck.C0 = necko * CA(MR(15+5*i), 0, MR(20*i))
699
		bp.position = cf * CN(0, 0, 4.8+0.8*i).p
700
		wait()
701
	end
702
	bp:remove()
703
	for i = 0.33, 1, 0.33 do
704
		RAW.C0 = CA(MR(10+10*i), MR(35+5*i), MR(45-5*i))
705
		LAW.C0 = CA(MR(5), 0, MR(10)) * CN(0, -0.45+0.1*i, 0)
706
		FW.C0 = CA(MR(3-3*i), MR(-30+5*i), 0)
707
		HW.C0 = CA(MR(30), 0, MR(-40-10*i))
708
		wait()
709
	end
710
	for i = 0.12, 1, 0.12 do
711
		RAW.C0 = CA(MR(20+5*i), MR(40+5*i), MR(40+5*i))
712
		LAW.C0 = CA(MR(5), 0, MR(10)) * CN(0, -0.35-0.3*i, 0)
713
		FW.C0 = CA(0, MR(-25+5*i), 0)
714
		HW.C0 = CA(MR(30), 0, MR(-50-5*i))
715
		wait()
716
	end
717
	local b = Part(Model, false, false, 0, 0, BN("Black"), V3(1.1, 1.1, 1.1))
718
	local m = Add.Sphere(b)
719
	local w = Weld(Larm, b, CN(), CN(0, 1.4, 0))
720
	for i = 0.16, 1, 0.16 do
721
		LAW.C0 = CA(MR(5+30*i), 0, MR(10+10*i)) * CN(0, -0.65+0.65*i, 0)
722
		RAW.C0 = CA(MR(25), MR(45+3*i), MR(40))
723
		m.Scale = V3(0.5+0.5*i, 0.5+0.5*i, 0.5+0.5*i)
724
		Neck.C0 = necko * CA(MR(20-10*i), 0, MR(20-15*i))
725
		wait()
726
	end
727
	for i = 0.1, 1, 0.1 do
728
		LAW.C0 = CA(MR(35+105*i), 0, MR(20+20*i)) * CN(0, -0.9*i, 0)
729
		RAW.C0 = CA(MR(25), MR(48+6*i), MR(40))
730
		Neck.C0 = necko * CA(MR(10-10*i), 0, MR(5-35*i))
731
		wait()
732
	end
733
	for i = 0.16, 1, 0.16 do
734
		LAW.C0 = CA(MR(140-10*i), 0, MR(40-15*i)) * CN(0, -0.9-0.2*i, 0)
735
		RAW.C0 = CA(MR(25), MR(54), MR(40))
736
		Neck.C0 = necko * CA(MR(5*i), 0, MR(-30))
737
		w.C0 = CN(1.5*i, 0.55*i, 1.1*i)
738
		wait()
739
	end
740
	PlaySound(Sounds.Reload, true)
741
	b:remove()
742
	w:remove()
743
	for i = 0.2, 1, 0.2 do
744
		LAW.C0 = CA(MR(130-10*i), 0, MR(25-15*i)) * CN(0, -1.1+0.2*i, 0)
745
		RAW.C0 = CA(MR(25-10*i), MR(54), MR(40))
746
		Neck.C0 = necko * CA(MR(5-3*i), 0, MR(-30+5*i))
747
		HW.C0 = CA(MR(30), 0, MR(-55+10*i))
748
		FW.C0 = CA(0, MR(-20-5*i), 0)
749
		wait()
750
	end
751
	for i = 0.11, 1, 0.11 do
752
		LAW.C0 = CA(MR(120-60*i), 0, MR(10+15*i)) * CN(0, -0.9+0.3*i, 0)
753
		RAW.C0 = CA(MR(15+5*i), MR(54-4*i), MR(40-10*i))
754
		Neck.C0 = necko * CA(MR(2-2*i), 0, MR(-25+25*i))
755
		HW.C0 = CA(MR(30), 0, MR(-45+45*i))
756
		FW.C0 = CA(0, MR(-25-20*i), 0)
757
		RLW.C0 = CA(0, 0, MR(10-8*i))
758
		LLW.C0 = CA(0, 0, MR(-10+8*i))
759
		wait()
760
	end
761
	Neck.C0 = necko
762
	for i = 0.25, 1, 0.25 do
763
		LAW.C0 = CA(MR(60-10*i), 0, MR(25+5*i)) * CN(0, -0.6, 0)
764
		RAW.C0 = CA(MR(20), MR(50), MR(30))
765
		HW.C0 = CA(MR(30), 0, 0)
766
		FW.C0 = CA(0, MR(-45-5*i), 0)
767
		RLW.C0 = CA(0, 0, MR(2-2*i))
768
		LLW.C0 = CA(0, 0, MR(-2+2*i))
769
		wait()
770
	end
771
	RLW.Part1 = nil
772
	LLW.Part1 = nil
773
	RAW.C0 = CA(MR(20), MR(50), MR(30))
774
	LAW.C0 = CA(MR(50), 0, MR(30)) * CN(0, -0.6, 0)
775
	FW.C0 = CA(0, MR(-50), 0)
776
	HW.C0 = CA(MR(30), 0, 0)
777
	Neck.C0 = necko
778
end
779
780
function Melee()
781
	PlaySound(Sounds.Slash, true)
782
	for i = 0.25, 1, 0.25 do
783
		RAW.C0 = CA(MR(20+5*i), MR(50-5*i), MR(30+3*i))
784
		LAW.C0 = CA(MR(50), 0, MR(30+4*i)) * CN(0, -0.6-0.05*i, 0)
785
		HW.C0 = CA(MR(30), MR(5*i), 0)
786
		FW.C0 = CA(0, MR(-50-5*i), 0)
787
		wait()
788
	end
789
	for i = 0.12, 1, 0.12 do
790
		RAW.C0 = CA(MR(25+25*i), MR(45-30*i), MR(33+7*i))
791
		LAW.C0 = CA(MR(50), 0, MR(34+11*i)) * CN(0, -0.65-0.25*i, 0)
792
		HW.C0 = CA(MR(30), MR(5+25*i), 0)
793
		FW.C0 = CA(0, MR(-55-25*i), 0)
794
		wait()
795
	end
796
	for i = 0.33, 1, 0.33 do
797
		RAW.C0 = CA(MR(50+15*i), MR(15-5*i), MR(40-10*i)) * CN(0, -0.2*i, 0)
798
		LAW.C0 = CA(MR(50+10*i), 0, MR(45-5*i)) * CN(0, -0.9+0.15*i, 0)
799
		HW.C0 = CA(MR(30+2*i), MR(30+5*i), 0)
800
		FW.C0 = CA(0, MR(-80+10*i), MR(-5*i))
801
		wait()
802
	end
803
	Hurt = true
804
	Debounce = true
805
	for i = 0.07, 1, 0.07 do
806
		RAW.C0 = CA(MR(65+55*i), MR(10), MR(30-70*i)) * CN(0, -0.2-1.1*i, 0)
807
		LAW.C0 = CA(MR(60+120*i), 0, MR(40-70*i)) * CN(0, -0.75+0.7*i, 0)
808
		HW.C0 = CA(MR(32+6*i), MR(35+20*i), MR(-4*i))
809
		FW.C0 = CA(0, MR(-70+110*i), 0)
810
		wait()
811
	end
812
	for i = 0.16, 1, 0.16 do
813
		RAW.C0 = CA(MR(120+10*i), MR(10), MR(-40-5*i)) * CN(0, -1.3-0.1*i, 0)
814
		LAW.C0 = CA(MR(180+15*i), 0, MR(-30-20*i)) * CN(0, -0.05+0.1*i, 0)
815
		HW.C0 = CA(MR(38+2*i), MR(55-6*i), MR(-4-1*i))
816
		FW.C0 = CA(0, MR(40+10*i), 0)
817
		wait()
818
	end
819
	Hurt = false
820
	for i = 0.2, 1, 0.2 do
821
		RAW.C0 = CA(MR(130+5*i), MR(10), MR(-45-2*i)) * CN(0, -1.4-0.05*i, 0)
822
		LAW.C0 = CA(MR(195+5*i), 0, MR(-50-8*i)) * CN(0, 0.05+0.05*i, 0)
823
		HW.C0 = CA(MR(40), MR(49-2*i), MR(-5))
824
		FW.C0 = CA(0, MR(50+3*i), 0)
825
		wait()
826
	end
827
	wait(0.2)
828
	for i = 0.2, 1, 0.2 do
829
		RAW.C0 = CA(MR(135-10*i), MR(10+5*i), MR(-47+10*i)) * CN(0, -1.45+0.25*i, 0)
830
		LAW.C0 = CA(MR(200-10*i), 0, MR(-58+10*i)) * CN(0, 0.1-0.1*i, 0)
831
		HW.C0 = CA(MR(40), MR(47-5*i), MR(-5+5*i))
832
		FW.C0 = CA(0, MR(53-10*i), 0)
833
		wait()
834
	end
835
	for i = 0.08, 1, 0.08 do
836
		RAW.C0 = CA(MR(125-90*i), MR(15+30*i), MR(-37+57*i)) * CN(0, -1.2+1.1*i, 0)
837
		LAW.C0 = CA(MR(190-125*i), 0, MR(-48+68*i)) * CN(0, -0.5*i, 0)
838
		HW.C0 = CA(MR(40-7*i), MR(42-37*i), 0)
839
		FW.C0 = CA(0, MR(43-82*i), 0)
840
		wait()
841
	end
842
	for i = 0.2, 1, 0.2 do
843
		RAW.C0 = CA(MR(35-15*i), MR(45+5*i), MR(20+10*i)) * CN(0, -0.1+0.1*i, 0)
844
		LAW.C0 = CA(MR(65-15*i), 0, MR(20+10*i)) * CN(0, -0.5-0.1*i, 0)
845
		HW.C0 = CA(MR(33-3*i), MR(5-5*i), 0)
846
		FW.C0 = CA(0, MR(-41-9*i), 0)
847
		wait()
848
	end
849
	RLW.Part1 = nil
850
	LLW.Part1 = nil
851
	RAW.C0 = CA(MR(20), MR(50), MR(30))
852
	LAW.C0 = CA(MR(50), 0, MR(30)) * CN(0, -0.6, 0)
853
	FW.C0 = CA(0, MR(-50), 0)
854
	HW.C0 = CA(MR(30), 0, 0)
855
	Neck.C0 = necko
856
end
857
858
function onSelected(mouse)
859
	SelectAnim()
860
	Selected = true
861
	mouse.Button1Down:connect(function()
862
		if Attacking == false then
863
			Attacking = true
864
			mouse.Button1Up:wait()
865
			Shoot(mouse.Hit.p)
866
			ShootAnim(mouse.Hit.p)
867
			Attacking = false
868
		end
869
	end)
870
	mouse.KeyDown:connect(function(key)
871
		key = key:lower()
872
		if key == "q" then
873
			if Attacking == false then
874
				Attacking = true
875
				Melee()
876
				Attacking = false
877
			end
878
		end
879
	end)
880
end
881
882
function onDeselected(mouse)
883
	Selected = false
884
	DeselAnim()
885
end
886
887
bin.Selected:connect(onSelected)
888
bin.Deselected:connect(onDeselected)