View difference between Paste ID: RtH6ajSi and hgpSPyPd
SHOW: | | - or go back to the newest paste.
1
--[[
2
Fabrique Nationale Herstal Project-90 Personal Defence Weapon. Commonly known as the P90.
3
The P90 uses the highly capable 5.7x28mm round, that can travel at near rifle speeds, and have 
4
twice the penetration. The P90 also uses unique 50 round magazines.
5
Designed in compliance to a request put out for a PDW by the US Military.
6
Sight0 = Iron Sights
7
Sight1 = EoTech Holographic
8
Sight2 = AimPoint Red Dot Scope
9
--]]
10
11
12
if script == nil then return end
13
14
15
Player = game:GetService("Players").LocalPlayer
16
Char = Player.Character
17
animate = Char:findFirstChild("Animate")
18
if animate then
19
animate:Destroy()
20
end
21
22
Name = "FN P90"
23
MC = BrickColor.new("Really black")
24
Spread = 900000
25
Attachment = true
26
Sight = 1
27
Mode = 0
28
MR = 0.01
29
MagSize = 50
30
Chamber = 2
31
Jammed = false
32
Reliability = 280
33
selected = false
34
Holstered = true
35
canDual = true
36
dual = false
37
Button1Down = false
38-
damage = 30
38+
damage = 10000000000
39
canFire = true
40
canFire2 = false
41
readyTime = 0.07
42
automatic = true
43
burst = false
44
burstCount = 0
45
burstCountMax = 3
46
canSilence = true
47
silenced = false
48
canZoom = true
49
zoom = false
50
switchToSingle = true
51
switchToBurst = true
52
switchToAutomatic = true
53
54
55
ammoGui = Instance.new("ScreenGui")
56
ammoGui.Name = Name
57
local frame = Instance.new("Frame")
58
frame.Name = "Frame"
59
frame.Size = UDim2.new(0, 165, 0, 60)
60
frame.Position = UDim2.new(0, 0, 1, -400)
61
frame.BackgroundColor3 = Color3.new(1, 1, 1)
62
frame.BorderColor3 = Color3.new(0, 0, 0)
63
frame.Parent = ammoGui
64
local label = Instance.new("TextLabel")
65
label.Name = "Weapon"
66
label.Text = "Weapon: " ..Name
67
label.Size = UDim2.new(1, 0, 0, 20)
68
label.Position = UDim2.new(0, 0, 0, 0)
69
label.BackgroundColor3 = Color3.new(1, 0, 0)
70
label.BorderColor3 = Color3.new(0, 0, 0)
71
label.Parent = frame
72
local label = Instance.new("TextLabel")
73
label.Name = "MagazinePrefix"
74
label.Text = "    Magazine:"
75
label.TextXAlignment = "Left"
76
label.Size = UDim2.new(1, 0, 0, 20)
77
label.Position = UDim2.new(0, 0, 0, 20)
78
label.BackgroundColor3 = Color3.new(1, 1, 1)
79
label.BorderColor3 = Color3.new(0, 0, 0)
80
label.Parent = frame
81
local label = Instance.new("TextLabel")
82
label.Name = "Magazine"
83
label.Text = "0/0"
84
label.TextXAlignment = "Right"
85
label.Size = UDim2.new(1, 0, 0, 20)
86
label.Position = UDim2.new(0, -10, 0, 20)
87
label.BackgroundTransparency = 1
88
label.BorderSizePixel = 0
89
label.Parent = frame
90
local label = Instance.new("TextLabel")
91
label.Name = "AmmoPrefix"
92
label.Text = "    5.7x28mm:"
93
label.TextXAlignment = "Left"
94
label.Size = UDim2.new(1, 0, 0, 20)
95
label.Position = UDim2.new(0, 0, 0, 40)
96
label.BackgroundColor3 = Color3.new(1, 1, 1)
97
label.BorderColor3 = Color3.new(0, 0, 0)
98
label.Parent = frame
99
local label = Instance.new("TextLabel")
100
label.Name = "Ammo"
101
label.Text = "0/0"
102
label.TextXAlignment = "Right"
103
label.Size = UDim2.new(1, 0, 0, 20)
104
label.Position = UDim2.new(0, -10, 0, 40)
105
label.BackgroundTransparency = 1
106
label.BorderSizePixel = 0
107
label.Parent = frame
108
109
110
function updateGui()
111
	if selected == false then return end
112
	if Player:FindFirstChild("PlayerGui") == nil then Instance.new("PlayerGui").Parent = Player end
113
	if Player.PlayerGui:FindFirstChild(Name) == nil then
114
		ammoGui:Clone().Parent = Player.PlayerGui
115
	end
116
	Player.PlayerGui[Name].Frame.Magazine.Text = tostring(magazine.Value).. "/" ..tostring(magazineMax.Value)
117
	Player.PlayerGui[Name].Frame.Ammo.Text = tostring(ammo.Value).. "/" ..tostring(ammoMax.Value)
118
end
119
120
121
function makeParts(format)
122
	local model = Instance.new("Model")
123
	model.Name = Name
124
	local pm2 = Instance.new("Part")
125
	pm2.Material = "SmoothPlastic"
126
	pm2.Name = "WeldPoint"
127
	pm2.formFactor = "Symmetric"
128
	pm2.Size = Vector3.new(1, 1, 1)
129
	pm2.BrickColor = MC
130
	pm2.Reflectance = MR
131
	pm2.Transparency = 1
132
	pm2.CanCollide = false
133
	pm2.Locked = true
134
	pm2.TopSurface = 0
135
	pm2.BottomSurface = 0
136
	pm2.Parent = model
137
	if format ~= nil then
138
		local w = Instance.new("Weld")
139
		w.Part0 = pm2
140
		if format == "RightHand" then
141
			w.Part1 = Player.Character:FindFirstChild("Right Arm")
142
			w.C0 = CFrame.new(0, 0.2, 0.71)
143
			w.C1 = CFrame.new()
144
		elseif format == "LeftHand" then
145
			w.Part1 = Player.Character:FindFirstChild("Left Arm")
146
			w.C0 = CFrame.new(0, 0.2, 0.71)
147
			w.C1 = CFrame.new()
148
			model.Name = Name.. " (Left)"
149
		elseif format == "RightHolster" then
150
			w.Part1 = Player.Character:FindFirstChild("Torso")
151
			w.C0 = CFrame.new(0.6, 0.4, -0.5) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
152
			w.C1 = CFrame.fromEulerAnglesXYZ(0, 0, math.rad(-20))
153
			model.Name = Name.. " (Holstered)"
154
		elseif format == "LeftHolster" then
155
			w.Part1 = Player.Character:FindFirstChild("Torso")
156
			w.C0 = CFrame.new(0.85, 0.4, -0.5) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
157
			w.C1 = CFrame.fromEulerAnglesXYZ(0, 0, math.rad(-5))
158
			model.Name = Name.. " (Holstered, Left)"
159
		end
160
		w.Parent = pm2
161
		model.Parent = Player.Character
162
	end	
163
	local pm = Instance.new("Part")
164
	pm.Material = "SmoothPlastic"
165
	pm.Name = "Handle"
166
	pm.formFactor = "Symmetric"
167
	pm.Size = Vector3.new(1, 1, 1)
168
	pm.BrickColor = MC
169
	pm.Reflectance = MR
170
	pm.Transparency = 1
171
	pm.CanCollide = false
172
	pm.Locked = true
173
	pm.TopSurface = 0
174
	pm.BottomSurface = 0
175
	pm.Parent = model
176
	local w = Instance.new("Weld")
177
	w.Part0 = pm
178
	w.Part1 = pm2
179
	w.C0 = CFrame.new(0, 0, 0)
180
	w.C1 = CFrame.new()
181
	w.Parent = pm
182
	local s = Instance.new("Sound")
183
	s.Name = "Fire"
184
	s.SoundId = "http://www.roblox.com/Asset/?id=433519775"
185
	s.Volume = 2
186
	s.Pitch = 1
187
	s.Looped = false
188
	s.Parent = pm
189
	local s = Instance.new("Sound")
190
	s.Name = "Fire2"
191
	s.SoundId = "http://roblox.com/asset/?id=433519775"
192
	s.Volume = 2
193
	s.Pitch = 1
194
	s.Looped = false
195
	s.Parent = pm		
196
	local s = Instance.new("Sound")
197
	s.Name = "Reload"
198
	s.SoundId = "http://www.roblox.com/Asset/?id=10209636"
199
	s.Volume = 1
200
	s.Pitch = 3
201
	s.Looped = false
202
	s.Parent = pm
203
	local s = Instance.new("Sound")
204
	s.Name = "Empty"
205
	s.SoundId = "http://www.roblox.com/asset/?id=2697295"
206
	s.Volume = 1
207
	s.Pitch = 5
208
	s.Looped = false
209
	s.Parent = pm
210
	local s = Instance.new("Sound")
211
	s.Name = "Lock"
212
	s.SoundId = "http://www.roblox.com/Asset/?id=10209845"
213
	s.Volume = 1
214
	s.Pitch = 3
215
	s.Looped = false
216
	s.Parent = pm
217
	local s = Instance.new("Sound")
218
	s.Name = "Jam"
219
	s.SoundId = "http://www.roblox.com/Asset/?id=10209636"
220
	s.Volume = 1
221
	s.Pitch = 2
222
	s.Looped = false
223
	s.Parent = pm			
224
	local s = Instance.new("Sound")
225
	s.Name = "Release"
226
	s.SoundId = "http://www.roblox.com/Asset/?id=10209813"
227
	s.Volume = 1
228
	s.Pitch = 4
229
	s.Looped = false
230
	s.Parent = pm
231
	local s = Instance.new("Sound")
232
	s.Name = "Switch"
233
	s.SoundId = "http://www.roblox.com/asset/?id=2697295"
234
	s.Volume = 1
235
	s.Pitch = 10
236
	s.Looped = false
237
	s.Parent = pm
238
	local p = Instance.new("Part")
239
	p.Material = "SmoothPlastic"
240
	p.Name = "ShellOut"
241
	p.formFactor = "Symmetric"
242
	p.Size = Vector3.new(1, 1, 1)
243
	p.Transparency = 1
244
	p.Locked = true
245
	p.CanCollide = false
246
	p.TopSurface = 0
247
	p.BottomSurface = 0
248
	p.Parent = model
249
	local w = Instance.new("Weld")
250
	w.Part0 = p
251
	w.Part1 = pm
252
	w.C0 = CFrame.new(0.5, 0, 0.5) * CFrame.fromEulerAnglesXYZ(0, math.rad(45), 0)
253
	w.C1 = CFrame.new()
254
	w.Parent = p
255
	local pc = Instance.new("Part")
256
	pc.Material = "SmoothPlastic"
257
	pc.Name = "Magazine"
258
	pc.formFactor = "Symmetric"
259
	pc.Size = Vector3.new(1, 1, 1)
260
	pc.BrickColor = BrickColor.new("New Yeller")
261
	pc.CanCollide = false
262
	pc.Locked = true
263
	pc.TopSurface = 0
264
	pc.BottomSurface = 0
265
	pc.Parent = model
266
	local m = Instance.new("BlockMesh")
267
	m.Scale = Vector3.new(0.24, 1.1, 0.15)
268
	m.Parent = pc
269
	local w = Instance.new("Weld")
270
	w.Part0 = pc
271
	w.Part1 = pm
272
	w.C0 = CFrame.new(0, 0.6, 0)
273
	w.C1 = CFrame.new()
274
	w.Parent = pc
275
	local pb = Instance.new("Part")
276
	pb.Material = "SmoothPlastic"
277
	pb.Name = "Bolt"
278
	pb.CanCollide = false
279
	pb.formFactor = "Symmetric"
280
	pb.Size = Vector3.new(1, 1, 1)
281
	pb.BrickColor = BrickColor.new("Dark stone grey")
282
	pb.Locked = true
283
	pb.TopSurface = 0
284
	pb.BottomSurface = 0
285
	pb.Parent = model
286
	local m = Instance.new("BlockMesh")
287
	m.Scale = Vector3.new(0.25, 0.4, 0.1)
288
	m.Parent = pb
289
	local w = Instance.new("Weld")
290
	w.Part0 = pb
291
	w.Part1 = pm
292
	w.C0 = CFrame.new(0, 0.8, -0.125)
293
	w.C1 = CFrame.new()
294
	w.Parent = pb
295
	local p = Instance.new("Part")
296
	p.Material = "SmoothPlastic"
297
	p.Name = "BoltPart"
298
	p.CanCollide = false
299
	p.formFactor = "Symmetric"
300
	p.Size = Vector3.new(1, 1, 1)
301
	p.BrickColor = BrickColor.new("Medium stone grey")
302
	p.Locked = true
303
	p.TopSurface = 0
304
	p.BottomSurface = 0
305
	p.Parent = model
306
	local m = Instance.new("BlockMesh")
307
	m.Scale = Vector3.new(0.26, 0.1, 0.1)
308
	m.Parent = p
309
	local w = Instance.new("Weld")
310
	w.Part0 = p
311
	w.Part1 = pb
312
	w.C0 = CFrame.new(0, 0.2, 0)
313
	w.C1 = CFrame.new()
314
	w.Parent = p	
315
	local p = Instance.new("Part")
316
	p.Material = "SmoothPlastic"
317
	p.Name = "Base"
318
	p.CanCollide = false
319
	p.formFactor = "Symmetric"
320
	p.Size = Vector3.new(1, 1, 1)
321
	p.BrickColor = MC
322
	p.Reflectance = MR
323
	p.Locked = true
324
	p.TopSurface = 0
325
	p.BottomSurface = 0
326
	p.Parent = model
327
	local m = Instance.new("BlockMesh")
328
	m.Scale = Vector3.new(0.26, 0.6, 0.6)
329
	m.Parent = p
330
	local w = Instance.new("Weld")
331
	w.Part0 = p
332
	w.Part1 = pm
333
	w.C0 = CFrame.new(0, -0.18, -0.2)
334
	w.C1 = CFrame.new()
335
	w.Parent = p
336
	local p = Instance.new("Part")
337
	p.Material = "SmoothPlastic"
338
	p.Name = "Base"
339
	p.CanCollide = false
340
	p.formFactor = "Symmetric"
341
	p.Size = Vector3.new(1, 1, 1)
342
	p.BrickColor = MC
343
	p.Reflectance = MR
344
	p.Locked = true
345
	p.TopSurface = 0
346
	p.BottomSurface = 0
347
	p.Parent = model
348
	local m = Instance.new("BlockMesh")
349
	m.Scale = Vector3.new(0.28, 0.65, 0.3)
350
	m.Parent = p
351
	local w = Instance.new("Weld")
352
	w.Part0 = p
353
	w.Part1 = pm
354
	w.C0 = CFrame.new(0, -0.15, -0.05)
355
	w.C1 = CFrame.new()
356
	w.Parent = p
357
	local p = Instance.new("Part")
358
	p.Material = "SmoothPlastic"
359
	p.Name = "Base"
360
	p.CanCollide = false
361
	p.formFactor = "Symmetric"
362
	p.Size = Vector3.new(1, 1, 1)
363
	p.BrickColor = MC
364
	p.Reflectance = MR
365
	p.Locked = true
366
	p.TopSurface = 0
367
	p.BottomSurface = 0
368
	p.Parent = model
369
	local m = Instance.new("BlockMesh")
370
	m.Scale = Vector3.new(0.28, 0.9, 0.15)
371
	m.Parent = p
372
	local w = Instance.new("Weld")
373
	w.Part0 = p
374
	w.Part1 = pm
375
	w.C0 = CFrame.new(0, 0.25, -0.125)
376
	w.C1 = CFrame.new()
377
	w.Parent = p
378
	local p = Instance.new("Part")
379
	p.Material = "SmoothPlastic"
380
	p.Name = "Base"
381
	p.CanCollide = false
382
	p.formFactor = "Symmetric"
383
	p.Size = Vector3.new(1, 1, 1)
384
	p.BrickColor = MC
385
	p.Reflectance = MR
386
	p.Locked = true
387
	p.TopSurface = 0
388
	p.BottomSurface = 0
389
	p.Parent = model
390
	local m = Instance.new("BlockMesh")
391
	m.Scale = Vector3.new(0.24, 0.4, 0.15)
392
	m.Parent = p
393
	local w = Instance.new("Weld")
394
	w.Part0 = p
395
	w.Part1 = pm
396
	w.C0 = CFrame.new(0, 0.9, -0.125)
397
	w.C1 = CFrame.new()
398
	w.Parent = p
399
	local p = Instance.new("Part")
400
	p.Material = "SmoothPlastic"
401
	p.Name = "Base"
402
	p.CanCollide = false
403
	p.formFactor = "Symmetric"
404
	p.Size = Vector3.new(1, 1, 1)
405
	p.BrickColor = MC
406
	p.Reflectance = MR
407
	p.Locked = true
408
	p.TopSurface = 0
409
	p.BottomSurface = 0
410
	p.Parent = model
411
	local m = Instance.new("BlockMesh")
412
	m.Scale = Vector3.new(0.28, 0.15, 0.6)
413
	m.Parent = p
414
	local w = Instance.new("Weld")
415
	w.Part0 = p
416
	w.Part1 = pm
417
	w.C0 = CFrame.new(0, 1.148, 0.02)
418
	w.C1 = CFrame.new()
419
	w.Parent = p	
420
	local pg = Instance.new("Part")
421
	pg.Material = "SmoothPlastic"
422
	pg.Name = "Grip"
423
	pg.CanCollide = false
424
	pg.formFactor = "Symmetric"
425
	pg.Size = Vector3.new(1, 1, 1)
426
	pg.BrickColor = MC
427
	pg.Reflectance = MR
428
	pg.Locked = true
429
	pg.TopSurface = 0
430
	pg.BottomSurface = 0
431
	pg.Parent = model
432
	local m = Instance.new("BlockMesh")
433
	m.Scale = Vector3.new(0.24, 0.3, 0.3)
434
	m.Parent = pg
435
	local w = Instance.new("Weld")
436
	w.Part0 = pg
437
	w.Part1 = pm
438
	w.C0 = CFrame.new(0, 0.1, -0.35)
439
	w.C1 = CFrame.new()
440
	w.Parent = pg
441
	local pq = Instance.new("Part")
442
	pq.Material = "SmoothPlastic"
443
	pq.Name = "Grip"
444
	pq.CanCollide = false
445
	pq.formFactor = "Symmetric"
446
	pq.Size = Vector3.new(1, 1, 1)
447
	pq.BrickColor = MC
448
	pq.Reflectance = MR
449
	pq.Locked = true
450
	pq.TopSurface = 0
451
	pq.BottomSurface = 0
452
	pq.Parent = model
453
	local m = Instance.new("BlockMesh")
454
	m.Scale = Vector3.new(0.24, 0.3, 0.15)
455
	m.Parent = pq
456
	local w = Instance.new("Weld")
457
	w.Part0 = pq
458
	w.Part1 = pg
459
	w.C0 = CFrame.new(0, 0.15, -0.05) * CFrame.fromEulerAnglesXYZ(math.rad(12), 0, 0)
460
	w.C1 = CFrame.new()
461
	w.Parent = pq
462
	local pw = Instance.new("Part")
463
	pw.Material = "SmoothPlastic"
464
	pw.Name = "Grip"
465
	pw.CanCollide = false
466
	pw.formFactor = "Symmetric"
467
	pw.Size = Vector3.new(1, 1, 1)
468
	pw.BrickColor = MC
469
	pw.Reflectance = MR
470
	pw.Locked = true
471
	pw.TopSurface = 0
472
	pw.BottomSurface = 0
473
	pw.Parent = model
474
	local m = Instance.new("BlockMesh")
475
	m.Scale = Vector3.new(0.24, 0.2, 0.15)
476
	m.Parent = pw
477
	local w = Instance.new("Weld")
478
	w.Part0 = pw
479
	w.Part1 = pq
480
	w.C0 = CFrame.new(0, 0.22, -0.03) * CFrame.fromEulerAnglesXYZ(math.rad(-12), 0, 0)
481
	w.C1 = CFrame.new()
482
	w.Parent = pw
483
	local p = Instance.new("Part")
484
	p.Material = "SmoothPlastic"
485
	p.Name = "Grip"
486
	p.CanCollide = false
487
	p.formFactor = "Symmetric"
488
	p.Size = Vector3.new(1, 1, 1)
489
	p.BrickColor = MC
490
	p.Reflectance = MR
491
	p.Locked = true
492
	p.TopSurface = 0
493
	p.BottomSurface = 0
494
	p.Parent = model
495
	local m = Instance.new("BlockMesh")
496
	m.Scale = Vector3.new(0.24, 0.2, 0.15)
497
	m.Parent = p
498
	local w = Instance.new("Weld")
499
	w.Part0 = p
500
	w.Part1 = pw
501
	w.C0 = CFrame.new(0, 0.14, -0.03) * CFrame.fromEulerAnglesXYZ(math.rad(-25), 0, 0)
502
	w.C1 = CFrame.new()
503
	w.Parent = p
504
	local p = Instance.new("Part")
505
	p.Material = "SmoothPlastic"
506
	p.Name = "Grip"
507
	p.CanCollide = false
508
	p.formFactor = "Symmetric"
509
	p.Size = Vector3.new(1, 1, 1)
510
	p.BrickColor = MC
511
	p.Reflectance = MR
512
	p.Locked = true
513
	p.TopSurface = 0
514
	p.BottomSurface = 0
515
	p.Parent = model
516
	local m = Instance.new("BlockMesh")
517
	m.Scale = Vector3.new(0.24, 0.18, 0.3)
518
	m.Parent = p
519
	local w = Instance.new("Weld")
520
	w.Part0 = p
521
	w.Part1 = pg
522
	w.C0 = CFrame.new(0, 0.54, 0.05)
523
	w.C1 = CFrame.new()
524
	w.Parent = p
525
	local p = Instance.new("Part")
526
	p.Material = "SmoothPlastic"
527
	p.Name = "Grip"
528
	p.CanCollide = false
529
	p.formFactor = "Symmetric"
530
	p.Size = Vector3.new(1, 1, 1)
531
	p.BrickColor = MC
532
	p.Reflectance = MR
533
	p.Locked = true
534
	p.TopSurface = 0
535
	p.BottomSurface = 0
536
	p.Parent = model
537
	local m = Instance.new("BlockMesh")
538
	m.Scale = Vector3.new(0.24, 0.1, 0.18)
539
	m.Parent = p
540
	local w = Instance.new("Weld")
541
	w.Part0 = p
542
	w.Part1 = pg
543
	w.C0 = CFrame.new(0, 1.08, 0.05)
544
	w.C1 = CFrame.new()
545
	w.Parent = p	
546
	local p = Instance.new("Part")
547
	p.Material = "SmoothPlastic"
548
	p.Name = "Trigger"
549
	p.CanCollide = false
550
	p.formFactor = "Symmetric"
551
	p.Size = Vector3.new(1, 1, 1)
552
	p.BrickColor = BrickColor.new("Dark stone grey")
553
	p.Locked = true
554
	p.TopSurface = 0
555
	p.BottomSurface = 0
556
	p.Parent = model
557
	local m = Instance.new("BlockMesh")
558
	m.Scale = Vector3.new(0.18, 0.18, 0.15)
559
	m.Parent = p
560
	local w = Instance.new("Weld")
561
	w.Part0 = p
562
	w.Part1 = pg
563
	w.C0 = CFrame.new(0, 0.6, 0.08)
564
	w.C1 = CFrame.new()
565
	w.Parent = p
566
	local p = Instance.new("Part")
567
	p.Material = "SmoothPlastic"
568
	p.Name = "Grip"
569
	p.CanCollide = false
570
	p.formFactor = "Symmetric"
571
	p.Size = Vector3.new(1, 1, 1)
572
	p.BrickColor = MC
573
	p.Reflectance = MR
574
	p.Locked = true
575
	p.TopSurface = 0
576
	p.BottomSurface = 0
577
	p.Parent = model
578
	local m = Instance.new("BlockMesh")
579
	m.Scale = Vector3.new(0.24, 0.18, 0.05)
580
	m.Parent = p
581
	local w = Instance.new("Weld")
582
	w.Part0 = p
583
	w.Part1 = pg
584
	w.C0 = CFrame.new(0, 0.62, 0.01)
585
	w.C1 = CFrame.new()
586
	w.Parent = p
587
	local pe = Instance.new("Part")
588
	pe.Material = "SmoothPlastic"
589
	pe.Name = "Grip"
590
	pe.CanCollide = false
591
	pe.formFactor = "Symmetric"
592
	pe.Size = Vector3.new(1, 1, 1)
593
	pe.BrickColor = MC
594
	pe.Reflectance = MR
595
	pe.Locked = true
596
	pe.TopSurface = 0
597
	pe.BottomSurface = 0
598
	pe.Parent = model
599
	local m = Instance.new("BlockMesh")
600
	m.Scale = Vector3.new(0.24, 0.15, 0.18)
601
	m.Parent = pe
602
	local w = Instance.new("Weld")
603
	w.Part0 = pe
604
	w.Part1 = pg
605
	w.C0 = CFrame.new(0, 0.76, -0.055)
606
	w.C1 = CFrame.new()
607
	w.Parent = pe
608
	local pr = Instance.new("Part")
609
	pr.Material = "SmoothPlastic"
610
	pr.Name = "Grip"
611
	pr.CanCollide = false
612
	pr.formFactor = "Symmetric"
613
	pr.Size = Vector3.new(1, 1, 1)
614
	pr.BrickColor = MC
615
	pr.Reflectance = MR
616
	pr.Locked = true
617
	pr.TopSurface = 0
618
	pr.BottomSurface = 0
619
	pr.Parent = model
620
	local m = Instance.new("BlockMesh")
621
	m.Scale = Vector3.new(0.24, 0.1, 0.18)
622
	m.Parent = pr
623
	local w = Instance.new("Weld")
624
	w.Part0 = pr
625
	w.Part1 = pe
626
	w.C0 = CFrame.new(0, 0.07, -0.025) * CFrame.fromEulerAnglesXYZ(math.rad(-30), 0, 0)
627
	w.C1 = CFrame.new()
628
	w.Parent = pr
629
	local pt = Instance.new("Part")
630
	pt.Material = "SmoothPlastic"
631
	pt.Name = "Grip"
632
	pt.CanCollide = false
633
	pt.formFactor = "Symmetric"
634
	pt.Size = Vector3.new(1, 1, 1)
635
	pt.BrickColor = MC
636
	pt.Reflectance = MR
637
	pt.Locked = true
638
	pt.TopSurface = 0
639
	pt.BottomSurface = 0
640
	pt.Parent = model
641
	local m = Instance.new("BlockMesh")
642
	m.Scale = Vector3.new(0.24, 0.1, 0.18)
643
	m.Parent = pt
644
	local w = Instance.new("Weld")
645
	w.Part0 = pt
646
	w.Part1 = pr
647
	w.C0 = CFrame.new(0, 0.05, -0.015) * CFrame.fromEulerAnglesXYZ(math.rad(-30), 0, 0)
648
	w.C1 = CFrame.new()
649
	w.Parent = pt
650
	local p = Instance.new("Part")
651
	p.Material = "SmoothPlastic"
652
	p.Name = "Grip"
653
	p.CanCollide = false
654
	p.formFactor = "Symmetric"
655
	p.Size = Vector3.new(1, 1, 1)
656
	p.BrickColor = MC
657
	p.Reflectance = MR
658
	p.Locked = true
659
	p.TopSurface = 0
660
	p.BottomSurface = 0
661
	p.Parent = model
662
	local m = Instance.new("BlockMesh")
663
	m.Scale = Vector3.new(0.24, 0.2, 0.18)
664
	m.Parent = p
665
	local w = Instance.new("Weld")
666
	w.Part0 = p
667
	w.Part1 = pt
668
	w.C0 = CFrame.new(0, 0.1, -0.015) * CFrame.fromEulerAnglesXYZ(math.rad(-30), 0, 0)
669
	w.C1 = CFrame.new()
670
	w.Parent = p											
671
	local p1 = Instance.new("Part")
672
	p1.Material = "SmoothPlastic"
673
	p1.Name = "Rail"
674
	p1.CanCollide = false
675
	p1.formFactor = "Symmetric"
676
	p1.Size = Vector3.new(1, 1, 1)
677
	p1.BrickColor = MC
678
	p1.Reflectance = MR
679
	p1.Locked = true
680
	p1.TopSurface = 0
681
	p1.BottomSurface = 0
682
	p1.Parent = model
683
	local m = Instance.new("BlockMesh")
684
	m.Scale = Vector3.new(0.28, 0.45, 0.15)
685
	m.Parent = p1
686
	local w = Instance.new("Weld")
687
	w.Part0 = p1
688
	w.Part1 = pm
689
	w.C0 = CFrame.new(0, 0.2, -0.635) * CFrame.fromEulerAnglesXYZ(math.rad(-80), 0, 0)
690
	w.C1 = CFrame.new()
691
	w.Parent = p1	
692
	local p2 = Instance.new("Part")
693
	p2.Material = "SmoothPlastic"
694
	p2.Name = "Rail"
695
	p2.CanCollide = false
696
	p2.formFactor = "Symmetric"
697
	p2.Size = Vector3.new(1, 1, 1)
698
	p2.BrickColor = MC
699
	p2.Reflectance = MR
700
	p2.Locked = true
701
	p2.TopSurface = 0
702
	p2.BottomSurface = 0
703
	p2.Parent = model
704
	local m = Instance.new("BlockMesh")
705
	m.Scale = Vector3.new(0.28, 0.3, 0.15)
706
	m.Parent = p2
707
	local w = Instance.new("Weld")
708
	w.Part0 = p2
709
	w.Part1 = p1
710
	w.C0 = CFrame.new(0, 0.15, 0.15) * CFrame.fromEulerAnglesXYZ(math.rad(85), 0, 0)
711
	w.C1 = CFrame.new()
712
	w.Parent = p2
713
	local p = Instance.new("Part")
714
	p.Material = "SmoothPlastic"
715
	p.Name = "Rail"
716
	p.CanCollide = false
717
	p.formFactor = "Symmetric"
718
	p.Size = Vector3.new(1, 1, 1)
719
	p.BrickColor = MC
720
	p.Reflectance = MR
721
	p.Locked = true
722
	p.TopSurface = 0
723
	p.BottomSurface = 0
724
	p.Parent = model
725
	local m = Instance.new("BlockMesh")
726
	m.Scale = Vector3.new(0.28, 0.3, 0.15)
727
	m.Parent = p
728
	local w = Instance.new("Weld")
729
	w.Part0 = p
730
	w.Part1 = p2
731
	w.C0 = CFrame.new(0, 0.25, -0.01) * CFrame.fromEulerAnglesXYZ(math.rad(-5), 0, 0)
732
	w.C1 = CFrame.new()
733
	w.Parent = p
734
	local p = Instance.new("Part")
735
	p.Material = "SmoothPlastic"
736
	p.Name = "SightRail"
737
	p.CanCollide = false
738
	p.formFactor = "Symmetric"
739
	p.Size = Vector3.new(1, 1, 1)
740
	p.BrickColor = MC
741
	p.Reflectance = MR
742
	p.Locked = true
743
	p.TopSurface = 0
744
	p.BottomSurface = 0
745
	p.Parent = model
746
	local m = Instance.new("BlockMesh")
747
	m.Scale = Vector3.new(0.24, 0.57, 0.15)
748
	m.Parent = p
749
	local w = Instance.new("Weld")
750
	w.Part0 = p
751
	w.Part1 = p2
752
	w.C0 = CFrame.new(0, 0.11, 0.02) * CFrame.fromEulerAnglesXYZ(math.rad(-5), 0, 0)
753
	w.C1 = CFrame.new()
754
	w.Parent = p
755
	local p = Instance.new("Part")
756
	p.Material = "SmoothPlastic"
757
	p.Name = "Hole"
758
	p.formFactor = "Symmetric"
759
	p.Size = Vector3.new(1, 1, 1)
760
	p.BrickColor = BrickColor.new("Really black")
761
	p.Reflectance = 0
762
	p.CanCollide = false
763
	p.Locked = true
764
	p.TopSurface = 0
765
	p.BottomSurface = 0
766
	p.Parent = model
767
	local m = Instance.new("CylinderMesh")
768
	m.Scale = Vector3.new(0.09, 0.2402, 0.09)
769
	m.Parent = p
770
	local w = Instance.new("Weld")
771
	w.Part0 = p
772
	w.Part1 = pm
773
	w.C0 = CFrame.new(0, 1.2, -0.125)
774
	w.C1 = CFrame.new()
775
	w.Parent = p
776
	local p = Instance.new("Part")
777
	p.Material = "SmoothPlastic"
778
	if silenced == false then
779
		p.Name = "Muzzle"
780
	else
781
		p.Name = "Muzzle 2"
782
	end
783
	p.formFactor = "Symmetric"
784
	p.Size = Vector3.new(1, 1, 1)
785
	p.BrickColor = BrickColor.new("Black")
786
	p.Reflectance = 0.06
787
	p.CanCollide = false
788
	p.Locked = true
789
	p.TopSurface = 0
790
	p.BottomSurface = 0
791
	p.Parent = model
792
	local m = Instance.new("CylinderMesh")
793
	m.Scale = Vector3.new(0.11, 0.9, 0.11)
794
	m.Offset = Vector3.new(0, 0.52, 0)
795
	m.Parent = p
796
	local w = Instance.new("Weld")
797
	w.Part0 = p
798
	w.Part1 = pm
799
	w.C0 = CFrame.new(0, 1.38, -0.125)
800
	w.C1 = CFrame.new()
801
	w.Parent = p
802
	local s = Instance.new("Smoke")
803
	s.Enabled = false
804
	s.Name = "Smoke"
805
	s.RiseVelocity = -5
806
	s.Opacity = 0.3
807
	s.Color = Color3.new(75 / 225, 75 / 225, 75 / 225)
808
	s.Size = 1
809
	s.Parent = p
810
	local f = Instance.new("Fire")
811
	f.Enabled = false
812
	f.Name = "Fire"
813
	f.Heat = -35
814
	f.Size = 1
815
	f.Parent = p
816
	local p = Instance.new("Part")
817
	p.Material = "SmoothPlastic"
818
	if silenced == false then
819
		p.Name = "Silencer"
820
		p.Transparency = 1
821
	else
822
		p.Name = "Muzzle"
823
		p.Transparency = 0
824
	end
825
	p.formFactor = "Symmetric"
826
	p.Size = Vector3.new(1, 1, 1)
827
	p.BrickColor = BrickColor.new("Really black")
828
	p.Reflectance = 0
829
	p.CanCollide = false
830
	p.Locked = true
831
	p.TopSurface = 0
832
	p.BottomSurface = 0
833
	p.Parent = model
834
	local m = Instance.new("CylinderMesh")
835
	m.Scale = Vector3.new(0.2, 0.7, 0.2)
836
	m.Parent = p
837
	local w = Instance.new("Weld")
838
	w.Part0 = p
839
	w.Part1 = pm
840
	w.C0 = CFrame.new(0, 1.6, -0.125)
841
	w.C1 = CFrame.new()
842
	w.Parent = p
843
	local p = Instance.new("Part")
844
	p.Material = "SmoothPlastic"
845
	p.Name = "Silencer1"
846
	if silenced == false then
847
		p.Transparency = 1
848
	else
849
		p.Transparency = 0
850
	end
851
	p.formFactor = "Symmetric"
852
	p.Size = Vector3.new(1, 1, 1)
853
	p.BrickColor = BrickColor.new("Black")
854
	p.Reflectance = 0
855
	p.CanCollide = false
856
	p.Locked = true
857
	p.TopSurface = 0
858
	p.BottomSurface = 0
859
	p.Parent = model
860
	local m = Instance.new("CylinderMesh")
861
	m.Scale = Vector3.new(0.21, 0.6, 0.21)
862
	m.Parent = p
863
	local w = Instance.new("Weld")
864
	w.Part0 = p
865
	w.Part1 = pm
866
	w.C0 = CFrame.new(0, 1.6, -0.125)
867
	w.C1 = CFrame.new()
868
	w.Parent = p	
869
	if Sight == 0 then
870
		local p = Instance.new("Part")
871
		p.Material = "SmoothPlastic"
872
		p.Name = "FrontSight"
873
		p.CanCollide = false
874
		p.formFactor = "Symmetric"
875
		p.Size = Vector3.new(1, 1, 1)
876
		p.BrickColor = MC
877
		p.Reflectance = MR
878
		p.Locked = true
879
		p.TopSurface = 0
880
		p.BottomSurface = 0
881
		p.Parent = model
882
		local m = Instance.new("BlockMesh")
883
		m.Scale = Vector3.new(0.08, 0.08, 0.15)
884
		m.Parent = p
885
		local w = Instance.new("Weld")
886
		w.Part0 = p
887
		w.Part1 = p2
888
		w.C0 = CFrame.new(0, 0.28, 0.08) * CFrame.fromEulerAnglesXYZ(math.rad(-5), 0, 0)
889
		w.C1 = CFrame.new()
890
		w.Parent = p
891
		local p = Instance.new("Part")
892
		p.Material = "SmoothPlastic"
893
		p.Name = "RearSight"
894
		p.CanCollide = false
895
		p.formFactor = "Symmetric"
896
		p.Size = Vector3.new(1, 1, 1)
897
		p.BrickColor = MC
898
		p.Reflectance = MR
899
		p.Locked = true
900
		p.TopSurface = 0
901
		p.BottomSurface = 0
902
		p.Parent = model
903
		local m = Instance.new("BlockMesh")
904
		m.Scale = Vector3.new(0.08, 0.08, 0.15)
905
		m.Parent = p
906
		local w = Instance.new("Weld")
907
		w.Part0 = p
908
		w.Part1 = p2
909
		w.C0 = CFrame.new(0.08, -0.1, 0.08) * CFrame.fromEulerAnglesXYZ(math.rad(-5), 0, 0)
910
		w.C1 = CFrame.new()
911
		w.Parent = p
912
		local p = Instance.new("Part")
913
		p.Material = "SmoothPlastic"
914
		p.Name = "RearSight"
915
		p.CanCollide = false
916
		p.formFactor = "Symmetric"
917
		p.Size = Vector3.new(1, 1, 1)
918
		p.BrickColor = MC
919
		p.Reflectance = MR
920
		p.Locked = true
921
		p.TopSurface = 0
922
		p.BottomSurface = 0
923
		p.Parent = model
924
		local m = Instance.new("BlockMesh")
925
		m.Scale = Vector3.new(0.08, 0.08, 0.15)
926
		m.Parent = p
927
		local w = Instance.new("Weld")
928
		w.Part0 = p
929
		w.Part1 = p2
930
		w.C0 = CFrame.new(-0.08, -0.1, 0.08) * CFrame.fromEulerAnglesXYZ(math.rad(-5), 0, 0)
931
		w.C1 = CFrame.new()
932
		w.Parent = p					
933
	elseif Sight == 1 then
934
		local c = Instance.new("Part")
935
		c.Material = "SmoothPlastic"
936
		c.Name = "SightCube"
937
		c.CanCollide = false
938
		c.formFactor = "Symmetric"
939
		c.Size = Vector3.new(1, 1, 1)
940
		c.BrickColor = MC
941
		c.Reflectance = MR
942
		c.Transparency = 0.4
943
		c.Locked = true
944
		c.TopSurface = 0
945
		c.BottomSurface = 0
946
		c.Parent = model
947
		local m = Instance.new("BlockMesh")
948
		m.Scale = Vector3.new(0.25, 0.25, 0.25)
949
		m.Parent = c
950
		local w = Instance.new("Weld")
951
		w.Part0 = c
952
		w.Part1 = p2
953
		w.C0 = CFrame.new(0, 0, 0.18) * CFrame.fromEulerAnglesXYZ(math.rad(-5), 0, 0)
954
		w.C1 = CFrame.new()
955
		w.Parent = c
956
		local p = Instance.new("Part")
957
		p.Material = "SmoothPlastic"
958
		p.Name = "SightBottom"
959
		p.CanCollide = false
960
		p.formFactor = "Symmetric"
961
		p.Size = Vector3.new(1, 1, 1)
962
		p.BrickColor = MC
963
		p.Reflectance = MR
964
		p.Locked = true
965
		p.TopSurface = 0
966
		p.BottomSurface = 0
967
		p.Parent = model
968
		local m = Instance.new("BlockMesh")
969
		m.Scale = Vector3.new(0.2, 0.38, 0.18)
970
		m.Parent = p
971
		local w = Instance.new("Weld")
972
		w.Part0 = p
973
		w.Part1 = c
974
		w.C0 = CFrame.new(0, 0.08, -0.12)
975
		w.C1 = CFrame.new()
976
		w.Parent = p		
977
		local p = Instance.new("Part")
978
		p.Material = "SmoothPlastic"
979
		p.Name = "Image"
980
		p.CanCollide = false
981
		p.formFactor = "Symmetric"
982
		p.Size = Vector3.new(1, 1, 1)
983
		p.BrickColor = MC
984
		p.Transparency = 1
985
		p.Locked = true
986
		p.TopSurface = 0
987
		p.BottomSurface = 0
988
		p.Parent = model
989
		local d = Instance.new("Decal")
990
		d.Face = "Top"
991
		d.Texture = "http://www.roblox.com/asset/?id=29712167"
992
		d.Parent = p
993
		local m = Instance.new("BlockMesh")
994
		m.Scale = Vector3.new(0.1, 0.001, 0.1)
995
		m.Parent = p
996
		local w = Instance.new("Weld")
997
		w.Part0 = p
998
		w.Part1 = c
999
		w.C0 = CFrame.new(0, 0, 0)
1000
		w.C1 = CFrame.new()
1001
		w.Parent = p				
1002
		local p = Instance.new("Part")
1003
		p.Material = "SmoothPlastic"
1004
		p.Name = "SightBox"
1005
		p.CanCollide = false
1006
		p.formFactor = "Symmetric"
1007
		p.Size = Vector3.new(1, 1, 1)
1008
		p.BrickColor = MC
1009
		p.Reflectance = MR
1010
		p.Locked = true
1011
		p.TopSurface = 0
1012
		p.BottomSurface = 0
1013
		p.Parent = model
1014
		local m = Instance.new("BlockMesh")
1015
		m.Scale = Vector3.new(0.05, 0.25, 0.25)
1016
		m.Offset = Vector3.new(0.1, 0, 0)
1017
		m.Parent = p
1018
		local w = Instance.new("Weld")
1019
		w.Part0 = p
1020
		w.Part1 = c
1021
		w.C0 = CFrame.new(0, 0, 0)
1022
		w.C1 = CFrame.new()
1023
		w.Parent = p
1024
		local p = Instance.new("Part")
1025
		p.Material = "SmoothPlastic"
1026
		p.Name = "SightBox"
1027
		p.CanCollide = false
1028
		p.formFactor = "Symmetric"
1029
		p.Size = Vector3.new(1, 1, 1)
1030
		p.BrickColor = MC
1031
		p.Reflectance = MR
1032
		p.Locked = true
1033
		p.TopSurface = 0
1034
		p.BottomSurface = 0
1035
		p.Parent = model
1036
		local m = Instance.new("BlockMesh")
1037
		m.Scale = Vector3.new(0.05, 0.25, 0.25)
1038
		m.Offset = Vector3.new(-0.1, 0, 0)
1039
		m.Parent = p
1040
		local w = Instance.new("Weld")
1041
		w.Part0 = p
1042
		w.Part1 = c
1043
		w.C0 = CFrame.new(0, 0, 0)
1044
		w.C1 = CFrame.new()
1045
		w.Parent = p
1046
		local p = Instance.new("Part")
1047
		p.Material = "SmoothPlastic"
1048
		p.Name = "SightBox"
1049
		p.CanCollide = false
1050
		p.formFactor = "Symmetric"
1051
		p.Size = Vector3.new(1, 1, 1)
1052
		p.BrickColor = MC
1053
		p.Reflectance = MR
1054
		p.Locked = true
1055
		p.TopSurface = 0
1056
		p.BottomSurface = 0
1057
		p.Parent = model
1058
		local m = Instance.new("BlockMesh")
1059
		m.Scale = Vector3.new(0.25, 0.25, 0.05)
1060
		m.Offset = Vector3.new(0, 0, -0.1)
1061
		m.Parent = p
1062
		local w = Instance.new("Weld")
1063
		w.Part0 = p
1064
		w.Part1 = c
1065
		w.C0 = CFrame.new(0, 0, 0)
1066
		w.C1 = CFrame.new()
1067
		w.Parent = p
1068
		local p = Instance.new("Part")
1069
		p.Material = "SmoothPlastic"
1070
		p.Name = "SightBox"
1071
		p.CanCollide = false
1072
		p.formFactor = "Symmetric"
1073
		p.Size = Vector3.new(1, 1, 1)
1074
		p.BrickColor = MC
1075
		p.Reflectance = MR
1076
		p.Locked = true
1077
		p.TopSurface = 0
1078
		p.BottomSurface = 0
1079
		p.Parent = model
1080
		local m = Instance.new("BlockMesh")
1081
		m.Scale = Vector3.new(0.25, 0.25, 0.05)
1082
		m.Offset = Vector3.new(0, 0, 0.1)
1083
		m.Parent = p
1084
		local w = Instance.new("Weld")
1085
		w.Part0 = p
1086
		w.Part1 = c
1087
		w.C0 = CFrame.new(0, 0, 0)
1088
		w.C1 = CFrame.new()
1089
		w.Parent = p
1090
	elseif Sight == 2 then
1091
		canZoom = true
1092
		local l = Instance.new("Part") -- Aimpoint Scope
1093
		l.Material = "SmoothPlastic"
1094
		l.Name = "SightBottom"
1095
		l.CanCollide = false
1096
		l.formFactor = "Symmetric"
1097
		l.Size = Vector3.new(1, 1, 1)
1098
		l.BrickColor = MC
1099
		l.Reflectance = MR
1100
		l.Locked = true
1101
		l.TopSurface = 0
1102
		l.BottomSurface = 0
1103
		l.Parent = model
1104
		local m = Instance.new("BlockMesh")
1105
		m.Scale = Vector3.new(0.2, 0.4, 0.18)
1106
		m.Parent = l
1107
		local w = Instance.new("Weld")
1108
		w.Part0 = l
1109
		w.Part1 = p2
1110
		w.C0 = CFrame.new(0, 0.1, 0.08) * CFrame.fromEulerAnglesXYZ(math.rad(-5), 0, 0)
1111
		w.C1 = CFrame.new()
1112
		w.Parent = l
1113
		canZoom = true
1114
		local p = Instance.new("Part")
1115
		p.Material = "SmoothPlastic"
1116
		p.Name = "Scope"
1117
		p.formFactor = "Symmetric"
1118
		p.Size = Vector3.new(1, 1, 1)
1119
		p.BrickColor = MC
1120
		p.Reflectance = MR
1121
		p.CanCollide = false
1122
		p.Locked = true
1123
		p.TopSurface = 0
1124
		p.BottomSurface = 0
1125
		p.Parent = model	
1126
		local m = Instance.new("CylinderMesh")
1127
		m.Scale = Vector3.new(0.28, 0.5, 0.28)
1128
		m.Parent = p
1129
		local w = Instance.new("Weld")
1130
		w.Part0 = p
1131
		w.Part1 = l
1132
		w.C0 = CFrame.new(0, 0, 0.16)
1133
		w.C1 = CFrame.new()
1134
		w.Parent = p
1135
		local p = Instance.new("Part")
1136
		p.Material = "SmoothPlastic"
1137
		p.Name = "ScopeInt"
1138
		p.formFactor = "Symmetric"
1139
		p.Size = Vector3.new(1, 1, 1)
1140
		p.BrickColor = BrickColor.new("White")
1141
		p.Reflectance = 0.3
1142
		p.CanCollide = false
1143
		p.Locked = true
1144
		p.TopSurface = 0
1145
		p.BottomSurface = 0
1146
		p.Parent = model	
1147
		local m = Instance.new("CylinderMesh")
1148
		m.Scale = Vector3.new(0.26, 0.604, 0.26)
1149
		m.Parent = p
1150
		local w = Instance.new("Weld")
1151
		w.Part0 = p
1152
		w.Part1 = l
1153
		w.C0 = CFrame.new(0, 0, 0.16)
1154
		w.C1 = CFrame.new()
1155
		w.Parent = p		
1156
		local p = Instance.new("Part")
1157
		p.Material = "SmoothPlastic"
1158
		p.Name = "Scope"
1159
		p.formFactor = "Symmetric"
1160
		p.Size = Vector3.new(1, 1, 1)
1161
		p.BrickColor = MC
1162
		p.Reflectance = MR
1163
		p.CanCollide = false
1164
		p.Locked = true
1165
		p.TopSurface = 0
1166
		p.BottomSurface = 0
1167
		p.Parent = model	
1168
		local m = Instance.new("CylinderMesh")
1169
		m.Scale = Vector3.new(0.3, 0.1, 0.3)
1170
		m.Parent = p
1171
		local w = Instance.new("Weld")
1172
		w.Part0 = p
1173
		w.Part1 = l
1174
		w.C0 = CFrame.new(0, -0.25, 0.16)
1175
		w.C1 = CFrame.new()
1176
		w.Parent = p
1177
		local p = Instance.new("Part")
1178
		p.Material = "SmoothPlastic"
1179
		p.Name = "Scope"
1180
		p.formFactor = "Symmetric"
1181
		p.Size = Vector3.new(1, 1, 1)
1182
		p.BrickColor = MC
1183
		p.Reflectance = MR
1184
		p.CanCollide = false
1185
		p.Locked = true
1186
		p.TopSurface = 0
1187
		p.BottomSurface = 0
1188
		p.Parent = model	
1189
		local m = Instance.new("CylinderMesh")
1190
		m.Scale = Vector3.new(0.3, 0.1, 0.3)
1191
		m.Parent = p
1192
		local w = Instance.new("Weld")
1193
		w.Part0 = p
1194
		w.Part1 = l
1195
		w.C0 = CFrame.new(0, 0.25, 0.16)
1196
		w.C1 = CFrame.new()
1197
		w.Parent = p				
1198
		local p = Instance.new("Part")
1199
		p.Material = "SmoothPlastic"
1200
		p.Name = "Scope"
1201
		p.formFactor = "Symmetric"
1202
		p.Size = Vector3.new(1, 1, 1)
1203
		p.BrickColor = MC
1204
		p.Reflectance = MR
1205
		p.CanCollide = false
1206
		p.Locked = true
1207
		p.TopSurface = 0
1208
		p.BottomSurface = 0
1209
		p.Parent = model	
1210
		local m = Instance.new("CylinderMesh")
1211
		m.Scale = Vector3.new(0.12, 0.5, 0.12)
1212
		m.Parent = p
1213
		local w = Instance.new("Weld")
1214
		w.Part0 = p
1215
		w.Part1 = l
1216
		w.C0 = CFrame.new(-0.12, 0, 0.24)
1217
		w.C1 = CFrame.new()
1218
		w.Parent = p
1219
		local p = Instance.new("Part")
1220
		p.Material = "SmoothPlastic"
1221
		p.Name = "Scope"
1222
		p.formFactor = "Symmetric"
1223
		p.Size = Vector3.new(1, 1, 1)
1224
		p.BrickColor = MC
1225
		p.Reflectance = MR
1226
		p.CanCollide = false
1227
		p.Locked = true
1228
		p.TopSurface = 0
1229
		p.BottomSurface = 0
1230
		p.Parent = model	
1231
		local m = Instance.new("CylinderMesh")
1232
		m.Scale = Vector3.new(0.13, 0.1, 0.13)
1233
		m.Parent = p
1234
		local w = Instance.new("Weld")
1235
		w.Part0 = p
1236
		w.Part1 = l
1237
		w.C0 = CFrame.new(-0.12, 0.25, 0.24)
1238
		w.C1 = CFrame.new()
1239
		w.Parent = p
1240
		local p = Instance.new("Part")
1241
		p.Material = "SmoothPlastic"
1242
		p.Name = "Scope"
1243
		p.formFactor = "Symmetric"
1244
		p.Size = Vector3.new(1, 1, 1)
1245
		p.BrickColor = MC
1246
		p.Reflectance = MR
1247
		p.CanCollide = false
1248
		p.Locked = true
1249
		p.TopSurface = 0
1250
		p.BottomSurface = 0
1251
		p.Parent = model	
1252
		local m = Instance.new("CylinderMesh")
1253
		m.Scale = Vector3.new(0.13, 0.1, 0.13)
1254
		m.Parent = p
1255
		local w = Instance.new("Weld")
1256
		w.Part0 = p
1257
		w.Part1 = l
1258
		w.C0 = CFrame.new(-0.12, -0.25, 0.24)
1259
		w.C1 = CFrame.new()
1260
		w.Parent = p									
1261
	else end
1262
	if Attachment == true then
1263
		local l = Instance.new("Part")
1264
		l.Material = "SmoothPlastic"
1265
		l.Name = "LightAttach"
1266
		l.formFactor = "Symmetric"
1267
		l.Size = Vector3.new(1, 1, 1)
1268
		l.CanCollide = false
1269
		l.BrickColor = MC
1270
		l.Reflectance = MR
1271
		l.Locked = true
1272
		l.TopSurface = 0
1273
		l.BottomSurface = 0
1274
		l.Parent = model
1275
		local m = Instance.new("CylinderMesh")
1276
		m.Scale = Vector3.new(0.24, 0.45, 0.24)
1277
		m.Parent = l
1278
		local w = Instance.new("Weld")
1279
		w.Part0 = l
1280
		w.Part1 = pm
1281
		w.C0 = CFrame.new(0.2, 1, 0.25)
1282
		w.C1 = CFrame.new()
1283
		w.Parent = l
1284
		local p = Instance.new("Part")
1285
		p.Material = "SmoothPlastic"
1286
		p.Name = "LightAttach"
1287
		p.formFactor = "Symmetric"
1288
		p.Size = Vector3.new(1, 1, 1)
1289
		p.BrickColor = MC
1290
		p.CanCollide = false
1291
		p.Locked = true
1292
		p.TopSurface = 0
1293
		p.BottomSurface = 0
1294
		p.Parent = model
1295
		local m = Instance.new("CylinderMesh")
1296
		m.Scale = Vector3.new(0.21, 0.4, 0.21)
1297
		m.Parent = p
1298
		local w = Instance.new("Weld")
1299
		w.Part0 = p
1300
		w.Part1 = l
1301
		w.C0 = CFrame.new(0, -0.027, 0)
1302
		w.C1 = CFrame.new()
1303
		w.Parent = p
1304
		local p = Instance.new("Part")
1305
		p.Material = "SmoothPlastic"
1306
		p.Name = "LightAttach"
1307
		p.formFactor = "Symmetric"
1308
		p.Size = Vector3.new(1, 1, 1)
1309
		p.BrickColor = BrickColor.new("Bright yellow")
1310
		p.Reflectance = 0.3
1311
		if Holstered == false then
1312
			p.Transparency = 0.5
1313
		else
1314
			p.Transparency = 1
1315
		end
1316
		p.CanCollide = false
1317
		p.Locked = true
1318
		p.TopSurface = 0
1319
		p.BottomSurface = 0
1320
		p.Parent = model
1321
		local m = Instance.new("CylinderMesh")
1322
		m.Scale = Vector3.new(0.22, 0.01, 0.22)
1323
		m.Parent = p
1324
		local w = Instance.new("Weld")
1325
		w.Part0 = p
1326
		w.Part1 = l
1327
		w.C0 = CFrame.new(0, 0.29, 0)
1328
		w.C1 = CFrame.new()
1329
		w.Parent = p		
1330
		local p = Instance.new("Part")
1331
		p.Material = "SmoothPlastic"
1332
		p.Name = "LightAttach"
1333
		p.CanCollide = false
1334
		p.formFactor = "Custom"
1335
		p.Size = Vector3.new(0.2, 0.2, 0.2)
1336
		p.BrickColor = MC
1337
		p.Locked = true
1338
		p.TopSurface = 0
1339
		p.BottomSurface = 0
1340
		p.Parent = model
1341
		local m = Instance.new("SpecialMesh")
1342
		m.MeshType = "FileMesh"
1343
		m.Scale = Vector3.new(0.12, 0.5, 0.12)
1344
		m.MeshId = "http://www.roblox.com/asset/?id=1033714"
1345
		m.Parent = p
1346
		local w = Instance.new("Weld")
1347
		w.Part0 = p
1348
		w.Part1 = l
1349
		w.C0 = CFrame.new(0, 0.1, 0)
1350
		w.C1 = CFrame.new()
1351
		w.Parent = p					
1352
		local p = Instance.new("Part")
1353
		p.Material = "SmoothPlastic"
1354
		p.Name = "Light"
1355
		p.CanCollide = false
1356
		p.formFactor = "Custom"
1357
		p.Size = Vector3.new(0.2, 0.2, 0.2)
1358
		p.BrickColor = BrickColor.new("Bright yellow")
1359
		p.Locked = true
1360
		if selected == true and Mode == 2 and dual == false then
1361
			p.Transparency = 0.5
1362
		else
1363
			p.Transparency = 1
1364
		end
1365
		p.TopSurface = 0
1366
		p.BottomSurface = 0
1367
		p.Parent = model
1368
		local m = Instance.new("SpecialMesh")
1369
		m.MeshType = "FileMesh"
1370
		m.Scale = Vector3.new(2, 50, 2)
1371
		m.MeshId = "http://www.roblox.com/asset/?id=1033714"
1372
		m.Parent = p
1373
		local w = Instance.new("Weld")
1374
		w.Part0 = p
1375
		w.Part1 = l
1376
		w.C0 = CFrame.new(0, 19, 0)
1377
		w.C1 = CFrame.new()
1378
		w.Parent = p			
1379
	else end		
1380
	return model
1381
end
1382
1383
1384
function removeParts(format)
1385
	if format == "RightHand" then
1386
		pcall(function() Player.Character[Name]:Remove() end)
1387
	elseif format == "LeftHand" then
1388
		pcall(function() Player.Character[Name.. " (Left)"]:Remove() end)
1389
	elseif format == "RightHolster" then
1390
		pcall(function() Player.Character[Name.. " (Holstered)"]:Remove() end)
1391
	elseif format == "LeftHolster" then
1392
		pcall(function() Player.Character[Name.. " (Holstered, Left)"]:Remove() end)
1393
	end
1394
end
1395
1396
1397
function SetAngle(Joint, Angle, Character)
1398
	if Character == nil then return false end
1399
	local Joints = {
1400
		Character.Torso:FindFirstChild("Right Shoulder 2"),
1401
		Character.Torso:FindFirstChild("Left Shoulder 2"),
1402
		Character.Torso:FindFirstChild("Right Hip 2"),
1403
		Character.Torso:FindFirstChild("Left Hip 2")
1404
	}
1405
	if Joints[Joint] == nil then return false end
1406
	if Joint == 1 or Joint == 3 then
1407
		Joints[Joint].DesiredAngle = Angle
1408
	end
1409
	if Joint == 2 or Joint == 4 then
1410
		Joints[Joint].DesiredAngle = -Angle
1411
	end
1412
end
1413
1414
1415
function ForceAngle(Joint, Angle, Character)
1416
	if Character == nil then return false end
1417
	local Joints = {
1418
		Character.Torso:FindFirstChild("Right Shoulder 2"),
1419
		Character.Torso:FindFirstChild("Left Shoulder 2"),
1420
		Character.Torso:FindFirstChild("Right Hip 2"),
1421
		Character.Torso:FindFirstChild("Left Hip 2")
1422
	}
1423
	if Joints[Joint] == nil then return false end
1424
	if Joint == 1 or Joint == 3 then
1425
		Joints[Joint].DesiredAngle = Angle
1426
		Joints[Joint].CurrentAngle = Angle
1427
	end
1428
	if Joint == 2 or Joint == 4 then
1429
		Joints[Joint].DesiredAngle = -Angle
1430
		Joints[Joint].CurrentAngle = -Angle
1431
	end
1432
end
1433
1434
1435
function SetSpeed(Joint, Speed, Character)
1436
	if Character == nil then return false end
1437
	local Joints = {
1438
		Character.Torso:FindFirstChild("Right Shoulder 2"),
1439
		Character.Torso:FindFirstChild("Left Shoulder 2"),
1440
		Character.Torso:FindFirstChild("Right Hip 2"),
1441
		Character.Torso:FindFirstChild("Left Hip 2")
1442
	}
1443
	if Joints[Joint] == nil then return false end
1444
	Joints[Joint].MaxVelocity = Speed
1445
end
1446
1447
1448
function DisableLimb(Limb, Character)
1449
	if Character == nil then return false end
1450
	if Character:FindFirstChild("Torso") == nil then return false end
1451
	local Joints = {
1452
		Character.Torso:FindFirstChild("Right Shoulder"),
1453
		Character.Torso:FindFirstChild("Left Shoulder"),
1454
		Character.Torso:FindFirstChild("Right Hip"),
1455
		Character.Torso:FindFirstChild("Left Hip")
1456
	}
1457
	local Limbs = {
1458
		Character:FindFirstChild("Right Arm"),
1459
		Character:FindFirstChild("Left Arm"),
1460
		Character:FindFirstChild("Right Leg"),
1461
		Character:FindFirstChild("Left Leg")
1462
	}
1463
	if Joints[Limb] == nil then return false end
1464
	if Limbs[Limb] == nil then return false end
1465
	local Joint = Instance.new("Motor")
1466
	Joint.Parent = Character.Torso
1467
	Joint.Part0 = Character.Torso
1468
	Joint.Part1 = Limbs[Limb]
1469
	if Limb == 1 then
1470
		Joint.C0 = CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
1471
		Joint.C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
1472
		Joint.Name = "Right Shoulder 2"
1473
	elseif Limb == 2 then
1474
		Joint.C0 = CFrame.new(-1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
1475
		Joint.C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
1476
		Joint.Name = "Left Shoulder 2"
1477
	elseif Limb == 3 then
1478
		Joint.C0 = CFrame.new(0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
1479
		Joint.C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
1480
		Joint.Name = "Right Hip 2"
1481
	elseif Limb == 4 then
1482
		Joint.C0 = CFrame.new(-0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
1483
		Joint.C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
1484
		Joint.Name = "Left Hip 2"
1485
	end
1486
	Joint.MaxVelocity = Joints[Limb].MaxVelocity
1487
	Joint.CurrentAngle = Joints[Limb].CurrentAngle
1488
	Joint.DesiredAngle = Joints[Limb].DesiredAngle
1489
	Joints[Limb]:Remove()
1490
end
1491
1492
1493
function ResetLimbCFrame(Limb, Character)
1494
	if Character == nil then return false end
1495
	if Character.Parent == nil then return false end
1496
	if Character:FindFirstChild("Torso") == nil then return false end
1497
	local Joints = {
1498
		Character.Torso:FindFirstChild("Right Shoulder 2"),
1499
		Character.Torso:FindFirstChild("Left Shoulder 2"),
1500
		Character.Torso:FindFirstChild("Right Hip 2"),
1501
		Character.Torso:FindFirstChild("Left Hip 2")
1502
	}
1503
	local Limbs = {
1504
		Character:FindFirstChild("Right Arm"),
1505
		Character:FindFirstChild("Left Arm"),
1506
		Character:FindFirstChild("Right Leg"),
1507
		Character:FindFirstChild("Left Leg")
1508
	}
1509
	if Joints[Limb] == nil then return false end
1510
	if Limbs[Limb] == nil then return false end
1511
	if Limb == 1 then
1512
		Joints[Limb].C0 = CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
1513
		Joints[Limb].C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
1514
	elseif Limb == 2 then
1515
		Joints[Limb].C0 = CFrame.new(-1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
1516
		Joints[Limb].C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
1517
	elseif Limb == 3 then
1518
		Joints[Limb].C0 = CFrame.new(0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
1519
		Joints[Limb].C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
1520
	elseif Limb == 4 then
1521
		Joints[Limb].C0 = CFrame.new(-0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
1522
		Joints[Limb].C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
1523
	end
1524
end
1525
1526
1527
function EnableLimb(Limb, Character)
1528
	if Character == nil then return false end
1529
	if Character:FindFirstChild("Torso") == nil then return false end
1530
	local Joints = {
1531
		Character.Torso:FindFirstChild("Right Shoulder 2"),
1532
		Character.Torso:FindFirstChild("Left Shoulder 2"),
1533
		Character.Torso:FindFirstChild("Right Hip 2"),
1534
		Character.Torso:FindFirstChild("Left Hip 2")
1535
	}
1536
	local Limbs = {
1537
		Character:FindFirstChild("Right Arm"),
1538
		Character:FindFirstChild("Left Arm"),
1539
		Character:FindFirstChild("Right Leg"),
1540
		Character:FindFirstChild("Left Leg")
1541
	}
1542
	if Joints[Limb] == nil then return false end
1543
	if Limbs[Limb] == nil then return false end
1544
	if Limb == 1 then
1545
		Joints[Limb].Name = "Right Shoulder"
1546
	elseif Limb == 2 then
1547
		Joints[Limb].Name = "Left Shoulder"
1548
	elseif Limb == 3 then
1549
		Joints[Limb].Name = "Right Hip"
1550
	elseif Limb == 4 then
1551
		Joints[Limb].Name = "Left Hip"
1552
	end
1553
	Animate = Character:FindFirstChild("Animate")
1554
	if Animate == nil then return false end
1555
	Animate = Animate:Clone()
1556
	Character.Animate:Remove()
1557
	Animate.Parent = Character
1558
end
1559
1560
1561
function playAnimation(format, mouse)
1562
	if format == "equip" then
1563
		Player.Character[Name.. " (Holstered)"].Handle.Weld:Remove()
1564
		local w = Instance.new("Weld")
1565
		w.Part0 = Player.Character[Name.. " (Holstered)"].Handle
1566
		w.Part1 = Player.Character:FindFirstChild("Right Arm")
1567
		w.C0 = CFrame.new(0, 1.2, 0.7)
1568
		w.C1 = CFrame.new()
1569
		w.Parent = Player.Character[Name.. " (Holstered)"].Handle
1570
		for i = 0.01, 1, 0.1 do
1571
			if Player.Character:FindFirstChild("Torso") ~= nil then
1572
				if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
1573
					Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
1574
					Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new((-0.55 * i) + (1.5 * (1 - i)), 0.75 * i, 0.35 * i) * CFrame.fromEulerAnglesXYZ(math.rad(315 + ((1 - i) * 50)), 0, math.rad(-90) * i)
1575
					Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
1576
					Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new((-1 * i) + (-1.5 * (1 - i)), 0.5 * i, 0.6 * i) * CFrame.fromEulerAnglesXYZ(math.rad(-90 * i), math.rad(-5 * i), 0)
1577
					wait()
1578
				else return false end
1579
			else return false end
1580
		end
1581
		return playAnimation("hold")
1582
	end
1583
	if format == "rightEquip" then
1584
		Player.Character[Name.. " (Holstered)"].Handle.Weld:Remove()
1585
		local w = Instance.new("Weld")
1586
		w.Part0 = Player.Character[Name.. " (Holstered)"].Handle
1587
		w.Part1 = Player.Character:FindFirstChild("Right Arm")
1588
		w.C0 = CFrame.new(0, 1.2, 0.7)
1589
		w.C1 = CFrame.new()
1590
		w.Parent = Player.Character[Name.. " (Holstered)"].Handle
1591
		for i = 0.01, 1, 0.1 do
1592
			if Player.Character:FindFirstChild("Torso") ~= nil then
1593
				if Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
1594
					Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
1595
					Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new((-1 * i) + (-1.5 * (1 - i)), 0.5 * i, 0.6 * i) * CFrame.fromEulerAnglesXYZ(math.rad(-90 * i), math.rad(-5 * i), 0)
1596
					wait()
1597
				else return false end
1598
			else return false end
1599
		end
1600
		return playAnimation("rightHold")
1601
	end
1602
	if format == "leftEquip" then
1603
		Player.Character[Name.. " (Holstered, Left)"].Handle.Weld:Remove()
1604
		local w = Instance.new("Weld")
1605
		w.Part0 = Player.Character[Name.. " (Holstered, Left)"].Handle
1606
		w.Part1 = Player.Character:FindFirstChild("Left Arm")
1607
		w.C0 = CFrame.new(0, 1.2, 0.7)
1608
		w.C1 = CFrame.new()
1609
		w.Parent = Player.Character[Name.. " (Holstered, Left)"].Handle
1610
		for i = 0.01, 1, 0.1 do
1611
			if Player.Character:FindFirstChild("Torso") ~= nil then
1612
				if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil then
1613
					Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
1614
					Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new((1 * i) + (1.5 * (1 - i)), 0.5 * i, 0.6 * i) * CFrame.fromEulerAnglesXYZ(math.rad(-90 * i), math.rad(5 * i), 0)
1615
					wait()
1616
				else return false end
1617
			else return false end
1618
		end
1619
		return playAnimation("leftHold")
1620
	end
1621
	if format == "unequip" then
1622
		Mode = 0
1623
		if Attachment == true then
1624
			Player.Character[Name].Light.Transparency = 1
1625
		end	
1626
		for i = 1, 0.01, -0.1 do
1627
			if Player.Character:FindFirstChild("Torso") ~= nil then
1628
				if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
1629
					Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
1630
					Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new((-0.55 * i) + (1.5 * (1 - i)), 0.75 * i, 0.35 * i) * CFrame.fromEulerAnglesXYZ(math.rad(315 + ((1 - i) * 50)), 0, math.rad(-90) * i)
1631
					Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
1632
					Player.Character.Torso["Right Shoulder 2"].C1 =  CFrame.new((-1 * i) + (-1.5 * (1 - i)), 0.5 * i, 0.6 * i) * CFrame.fromEulerAnglesXYZ(math.rad(-90 * i), math.rad(-5 * i), 0)
1633
					wait()
1634
				else return false end
1635
			else return false end
1636
		end
1637
		return true
1638
	end
1639
	if format == "leftUnequip" then
1640
		Mode = 0
1641
		if Attachment == true then
1642
			Player.Character[Name].Light.Transparency = 1
1643
			Player.Character[Name.. " (Left)"].Light.Transparency = 1
1644
		end	
1645
		for i = 1, 0.01, -0.1 do
1646
			if Player.Character:FindFirstChild("Torso") ~= nil then
1647
				if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil then
1648
					Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
1649
					Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new((1 * i) + (1.5 * (1 - i)), 0.5 * i, 0.6 * i) * CFrame.fromEulerAnglesXYZ(math.rad(-90 * i), math.rad(5 * i), 0)
1650
					wait()
1651
				else return false end
1652
			else return false end
1653
		end
1654
		return true
1655
	end
1656
	if format == "rightUnequip" then
1657
		Mode = 0
1658
		if Attachment == true then
1659
			Player.Character[Name].Light.Transparency = 1
1660
			Player.Character[Name.. " (Left)"].Light.Transparency = 1
1661
		end	
1662
		for i = 1, 0.01, -0.1 do
1663
			if Player.Character:FindFirstChild("Torso") ~= nil then
1664
				if Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
1665
					Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
1666
					Player.Character.Torso["Right Shoulder 2"].C1 =  CFrame.new((-1 * i) + (-1.5 * (1 - i)), 0.5 * i, 0.6 * i) * CFrame.fromEulerAnglesXYZ(math.rad(-90 * i), math.rad(-5 * i), 0)
1667
					wait()
1668
				else return false end
1669
			else return false end
1670
		end
1671
		return true
1672
	end
1673
	if format == "hold" then
1674
		if Player.Character:FindFirstChild("Torso") ~= nil then
1675
			if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
1676
				Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
1677
				Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new(-0.3, 1.2, 0.4) * CFrame.fromEulerAnglesXYZ(math.rad(300), math.rad(10), math.rad(-90))
1678
				Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
1679
				Player.Character.Torso["Right Shoulder 2"].C1 =  CFrame.new(-1, 0.2, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-5), 0)
1680
			else return false end
1681
		else return false end
1682
	end
1683
	if format == "rightHold" then
1684
		if Player.Character:FindFirstChild("Torso") ~= nil then
1685
			if Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
1686
				Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
1687
				Player.Character.Torso["Right Shoulder 2"].C1 =  CFrame.new(-0.72, 0.5, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-5), math.rad(-5))
1688
			else return false end
1689
		else return false end
1690
	end
1691
	if format == "leftHold" then
1692
		if Player.Character:FindFirstChild("Torso") ~= nil then
1693
			if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil then
1694
				Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
1695
				Player.Character.Torso["Left Shoulder 2"].C1 =  CFrame.new(0.72, 0.5, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(5), math.rad(5))
1696
			else return false end
1697
		else return false end
1698
	end
1699
	if format == "reload" then
1700
		Player.Character[Name].Handle.Empty:Play()
1701
		for i = 0, 25, 7.5 do
1702
			if Player.Character:FindFirstChild("Torso") ~= nil then
1703
				if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
1704
					Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
1705
					Player.Character.Torso["Right Shoulder 2"].C1 =  CFrame.new(-1, 0.5, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(-90 + i * 1.2), math.rad(-5), 0)
1706
					wait()
1707
				else return false end
1708
			else return false end
1709
		end	
1710
		Player.Character[Name].Handle.Release:Play()
1711
		Player.Character[Name].Magazine.Transparency = 1
1712
		local magazineDrop = Player.Character[Name].Magazine:Clone()
1713
		magazineDrop.Transparency = 0
1714
		magazineDrop.Parent = game:GetService("Workspace")
1715
		for i = 0, 25, 5 do
1716
			if Player.Character:FindFirstChild("Torso") ~= nil then
1717
				if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
1718
					Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
1719
					Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new(-0.5 + (i / 60), 1.2 - (i / 20), 0.8 + (i / 35)) * CFrame.fromEulerAnglesXYZ(math.rad(300 - i), math.rad(10 + -i * 3.5), math.rad(-90))
1720
					wait()
1721
				else return false end
1722
			else return false end
1723
		end		
1724
		coroutine.resume(coroutine.create(function(part) wait(4.5) for i = 0, 1, 0.1 do part.Transparency = i wait() end part:Remove() end), magazineDrop)
1725
		delay(0.1, function() magazineDrop.CanCollide = true end)		
1726
		Player.Character[Name].Handle.Reload:Play()		
1727
		local magazineNew = Player.Character[Name].Magazine:Clone()
1728
		magazineNew.Name = "New Magazine"
1729
		magazineNew.Transparency = 0
1730
		magazineNew.Parent = Player.Character[Name]
1731
		local w = Instance.new("Weld")
1732
		w.Part0 = magazineNew
1733
		w.Part1 = Player.Character:FindFirstChild("Left Arm")
1734
		w.C0 = CFrame.new(0, 1.1, 0)
1735
		w.C1 = CFrame.new() * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
1736
		w.Parent = magazineNew
1737
		for i = 25, 0, -5 do
1738
			if Player.Character:FindFirstChild("Torso") ~= nil then
1739
				if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
1740
					Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
1741
					Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new(-0.55 + (i / 50), 0.75 - (i / 50), 0.35 + (i / 22.5)) * CFrame.fromEulerAnglesXYZ(math.rad(315 - (i * 2)), math.rad(-i * 3.5), math.rad(-90))
1742
					wait()
1743
				else return false end
1744
			else return false end
1745
		end			
1746
		Player.Character[Name].Magazine.Transparency = 0
1747
		Player.Character[Name]["New Magazine"]:Remove()
1748
		wait(0.1)
1749
		Player.Character[Name].Handle.Lock.Pitch = 3		
1750
		Player.Character[Name].Handle.Lock:Play()			
1751
		for i = 5, 0, -1 do
1752
			if Player.Character:FindFirstChild("Torso") ~= nil then
1753
				if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
1754
					Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
1755
					Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new(-0.55, 0.75, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(315 + (i * 1.5)), math.rad(i * 4), math.rad(-90))
1756
					wait()
1757
				else return false end
1758
			else return false end
1759
		end	
1760
		wait(0.14)
1761
		for i = 25, 0, -7.5 do
1762
			if Player.Character:FindFirstChild("Torso") ~= nil then
1763
				if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
1764
					Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
1765
					Player.Character.Torso["Right Shoulder 2"].C1 =  CFrame.new(-1, 0.5, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(-90 + i * 1.2), math.rad(-5), 0)
1766
					wait()
1767
				else return false end
1768
			else return false end
1769
		end	
1770
		for i = 0, 10, 5 do
1771
			if Player.Character:FindFirstChild("Torso") ~= nil then
1772
				if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
1773
					Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
1774
					Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new(-0.3, 1.2, 0.4) * CFrame.fromEulerAnglesXYZ(math.rad(300), math.rad(10 + i), math.rad(-90))
1775
					Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
1776
					Player.Character.Torso["Right Shoulder 2"].C1 =  CFrame.new(-1, 0.2, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(-90 - i), math.rad(-5), 0)
1777
					wait()
1778
				else return false end
1779
			else return false end
1780
		end
1781
		for i = 10, 0, -5 do
1782
			if Player.Character:FindFirstChild("Torso") ~= nil then
1783
				if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
1784
					Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
1785
					Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new(-0.3, 1.2, 0.4) * CFrame.fromEulerAnglesXYZ(math.rad(300), math.rad(10 + i), math.rad(-90))
1786
					Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
1787
					Player.Character.Torso["Right Shoulder 2"].C1 =  CFrame.new(-1, 0.2, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(-90 - i), math.rad(-5), 0)
1788
					wait()
1789
				else return false end
1790
			else return false end
1791
		end	
1792
		if magazine.Value == 0 then
1793
			playAnimation("charge")
1794
			return true
1795
		else end
1796
	end
1797
	if format == "charge" then
1798
		for i = 0, 10, 1.5 do
1799
			if Player.Character:FindFirstChild("Torso") ~= nil then
1800
				if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil then
1801
					Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
1802
					Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new(-0.5, 1.2 - (i / 10), 0.1) * CFrame.fromEulerAnglesXYZ(math.rad(300), math.rad(10), math.rad(-90))
1803
					wait()
1804
				end
1805
			end
1806
		end	
1807
		Player.Character[Name].Handle.Lock.Pitch = 1.5
1808
		Player.Character[Name].Handle.Lock:Play()		
1809
		Player.Character[Name].Bolt.Weld.C0 = CFrame.new(0, 0.6, -0.125)
1810
		Jammed = false
1811
		if magazine.Value ~= 0 then
1812
			makeShell(Player.Character[Name]:FindFirstChild("ShellOut"))
1813
		else end
1814
		wait(0.2)
1815
		Player.Character[Name].Bolt.Weld.C0 = CFrame.new(0, 0.8, -0.125)
1816
		playAnimation("hold")
1817
		return true
1818
	end
1819
	if format == "reloadDual" then
1820
		for i = 0, 25, 7.5 do
1821
			if Player.Character:FindFirstChild("Torso") ~= nil then
1822
				if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
1823
					Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
1824
					Player.Character.Torso["Left Shoulder 2"].C1 =  CFrame.new(0.7, 0.5, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(-90 - i), math.rad(5), 0)
1825
					Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
1826
					Player.Character.Torso["Right Shoulder 2"].C1 =  CFrame.new(-0.7, 0.5, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(-90 - i), math.rad(-5), 0)
1827
					wait()
1828
				else return false end
1829
			else return false end
1830
		end
1831
		coroutine.wrap(function()
1832
				Player.Character[Name].WeldPoint.Weld.C0 = CFrame.new(0, 1, 0.71)	
1833
				Player.Character[Name.. " (Left)"].WeldPoint.Weld.C0 = CFrame.new(0, 1, 0.71)						
1834
				for i = 0, 90, 15 do
1835
					pcall(function() Player.Character[Name].Handle.Weld.C0 = CFrame.fromEulerAnglesXYZ(math.rad(i), 0, 0) end)
1836
					pcall(function() Player.Character[Name.. " (Left)"].Handle.Weld.C0 = CFrame.fromEulerAnglesXYZ(math.rad(i), 0, 0) end)					
1837
					wait()
1838
				end
1839
				pcall(function() Player.Character[Name].Handle.Weld.C0 = CFrame.fromEulerAnglesXYZ(math.rad(90), 0, 0) end)
1840
				pcall(function() Player.Character[Name.. " (Left)"].Handle.Weld.C0 = CFrame.fromEulerAnglesXYZ(math.rad(90), 0, 0) end)				
1841
		end)()				
1842
		wait(0.1)
1843
		CamShake(1, 40000)													
1844
		Player.Character[Name].Handle.Release:Play()
1845
		Player.Character[Name].Magazine.Transparency = 1
1846
		local magazineDrop = Player.Character[Name].Magazine:Clone()
1847
		magazineDrop.Transparency = 0
1848
		magazineDrop.Parent = game:GetService("Workspace")
1849
		coroutine.resume(coroutine.create(function(part) wait(4.5) for i = 0, 1, 0.1 do part.Transparency = i wait() end part:Remove() end), magazineDrop)
1850
		delay(0.1, function() magazineDrop.CanCollide = true end)	
1851
		wait(math.random(0.1, 0.25))
1852
		Player.Character[Name].Handle.Release:Play()
1853
		Player.Character[Name.. " (Left)"].Magazine.Transparency = 1
1854
		local magazineDropDual = Player.Character[Name.. " (Left)"].Magazine:Clone()
1855
		magazineDropDual.Transparency = 0
1856
		magazineDropDual.Parent = game:GetService("Workspace")
1857
		coroutine.resume(coroutine.create(function(part) wait(4.5) for i = 0, 1, 0.1 do part.Transparency = i wait() end part:Remove() end), magazineDropDual)
1858
		delay(0.1, function() magazineDropDual.CanCollide = true end)
1859
		for i = 0, 25, 7.5 do
1860
			if Player.Character:FindFirstChild("Torso") ~= nil then
1861
				if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
1862
					Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
1863
					Player.Character.Torso["Left Shoulder 2"].C1 =  CFrame.new(0.7, 0.5, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(-90 - i), math.rad(5), 0)
1864
					Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
1865
					Player.Character.Torso["Right Shoulder 2"].C1 =  CFrame.new(-0.7, 0.5, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(-90 - i), math.rad(-5), 0)
1866
					wait()
1867
				else return false end
1868
			else return false end
1869
		end
1870
		for i = 125, 0, -15 do
1871
			if Player.Character:FindFirstChild("Torso") ~= nil then
1872
				if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
1873
					Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
1874
					Player.Character.Torso["Left Shoulder 2"].C1 =  CFrame.new(0.7, 0.5, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad((-90 - i) + 100), math.rad(5), 0)					
1875
					Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
1876
					Player.Character.Torso["Right Shoulder 2"].C1 =  CFrame.new(-0.7, 0.5, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad((-90 - i) + 100), math.rad(-5), 0)
1877
					wait()
1878
				else return false end
1879
			else return false end
1880
		end
1881
		Player.Character[Name].Handle.Reload:Play()		
1882
		Player.Character[Name].Magazine.Transparency = 0
1883
		Player.Character[Name.. " (Left)"].Magazine.Transparency = 0
1884
		coroutine.wrap(function()
1885
				for i = 90, 0, -15 do
1886
					pcall(function() Player.Character[Name].Handle.Weld.C0 = CFrame.fromEulerAnglesXYZ(math.rad(i), 0, 0) end)
1887
					pcall(function() Player.Character[Name.. " (Left)"].Handle.Weld.C0 = CFrame.fromEulerAnglesXYZ(math.rad(i), 0, 0) end)					
1888
					wait()
1889
				end
1890
				pcall(function() Player.Character[Name].Handle.Weld.C0 = CFrame.fromEulerAnglesXYZ(math.rad(0), 0, 0) end)
1891
				pcall(function() Player.Character[Name.. " (Left)"].Handle.Weld.C0 = CFrame.fromEulerAnglesXYZ(math.rad(0), 0, 0) end)
1892
				Player.Character[Name].WeldPoint.Weld.C0 = CFrame.new(0, 0.2, 0.71)	
1893
				Player.Character[Name.. " (Left)"].WeldPoint.Weld.C0 = CFrame.new(0, 0.2, 0.71)								
1894
		end)()	
1895
		for i = 0, 125, 15 do
1896
			if Player.Character:FindFirstChild("Torso") ~= nil then
1897
				if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
1898
					Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
1899
					Player.Character.Torso["Left Shoulder 2"].C1 =  CFrame.new(0.7, 0.5, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad((-90 - i) + 100), math.rad(5), 0)					
1900
					Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
1901
					Player.Character.Torso["Right Shoulder 2"].C1 =  CFrame.new(-0.7, 0.5, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad((-90 - i) + 100), math.rad(-5), 0)
1902
					wait()
1903
				else return false end
1904
			else return false end
1905
		end
1906
		if magazine.Value == 0 then
1907
			Player.Character[Name].Handle.Lock.Pitch = 1.5
1908
			Player.Character[Name].Handle.Lock:Play()
1909
			CamShake(1, 30000)	
1910
			CamShake(1, -30000)											
1911
		else end
1912
		for i = 25, 0, -5 do
1913
			if Player.Character:FindFirstChild("Torso") ~= nil then
1914
				if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
1915
					Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
1916
					Player.Character.Torso["Left Shoulder 2"].C1 =  CFrame.new(0.7, 0.5, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(-90 - i), math.rad(5), 0)
1917
					Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
1918
					Player.Character.Torso["Right Shoulder 2"].C1 =  CFrame.new(-0.7, 0.5, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(-90 - i), math.rad(-5), 0)
1919
					wait()
1920
				else return false end
1921
			else return false end
1922
		end
1923
		playAnimation("rightHold")
1924
		playAnimation("leftHold")
1925
		return true
1926
	end
1927
	if format == "fire" then
1928
		makeShell(Player.Character[Name]:FindFirstChild("ShellOut"))
1929
		if Player.Character[Name]:FindFirstChild("Handle") ~= nil then
1930
			if silenced then
1931
				Player.Character[Name].Handle.Fire2.Volume = math.random(3, 8) / 10
1932
				Player.Character[Name].Handle.Fire2.Pitch = math.random(1.8, 2)
1933
				Player.Character[Name].Handle.Fire2:Play()
1934
				CamShake(15, 50000)
1935
			else
1936
				Player.Character[Name].Handle.Fire.Volume = math.random(8, 12) / 10
1937
				Player.Character[Name].Handle.Fire.Pitch = math.random(25, 35) / 20
1938
				Player.Character[Name].Handle.Fire:Play()
1939
				CamShake(15, 50000)
1940
			end
1941
		else return false end
1942
		if Player.Character[Name]:FindFirstChild("Muzzle") ~= nil then
1943
			if silenced == false then
1944
				coroutine.resume(coroutine.create(function() Player.Character[Name].Muzzle.Smoke.Enabled = true Player.Character[Name].Muzzle.Fire.Enabled = true wait(0.1) Player.Character[Name].Muzzle.Smoke.Enabled = false Player.Character[Name].Muzzle.Fire.Enabled = false end))
1945
			else end
1946
		else return false end
1947
		for i = 0, 6, 3 do
1948
			if Player.Character:FindFirstChild("Torso") ~= nil then
1949
				if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
1950
					Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
1951
					Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new(-0.3, 1.2, 0.4) * CFrame.fromEulerAnglesXYZ(math.rad(300), math.rad(10 + i), math.rad(-90))
1952
					Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
1953
					Player.Character.Torso["Right Shoulder 2"].C1 =  CFrame.new(-1, 0.2, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(-90 - i), math.rad(-5), 0)
1954
					wait()
1955
				else return false end
1956
			else return false end
1957
		end
1958
		if magazine.Value ~= 0 then
1959
			wait()
1960
		elseif magazine.Value == 0 then
1961
			Player.Character[Name].Handle.Lock.Pitch = 3
1962
			Player.Character[Name].Handle.Lock:Play()
1963
		end--]]
1964
		if math.random(1, Reliability) == 1 then 
1965
			Jammed = true
1966
			Player.Character[Name].Handle.Jam:Play()			
1967
		end		
1968
		for i = 6, 0, -3 do
1969
			if Player.Character:FindFirstChild("Torso") ~= nil then
1970
				if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
1971
					Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
1972
					Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new(-0.3, 1.2, 0.4) * CFrame.fromEulerAnglesXYZ(math.rad(300), math.rad(10 + i), math.rad(-90))
1973
					Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
1974
					Player.Character.Torso["Right Shoulder 2"].C1 =  CFrame.new(-1, 0.2, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(-90 - i), math.rad(-5), 0)
1975
					wait()
1976
				else return false end
1977
			else return false end
1978
		end
1979
	end
1980
	if format == "rightFire" then
1981
		if Player.Character[Name]:FindFirstChild("Handle") ~= nil then
1982
			if silenced then
1983
				Player.Character[Name].Handle.Fire2.Volume = math.random(3, 8) / 10
1984
				Player.Character[Name].Handle.Fire2.Pitch = math.random(1.8, 2)
1985
				Player.Character[Name].Handle.Fire2:Play()
1986
				CamShake(15, 50000)
1987
			else
1988
				Player.Character[Name].Handle.Fire.Volume = math.random(8, 12) / 10
1989
				Player.Character[Name].Handle.Fire.Pitch = math.random(25, 35) / 20
1990
				Player.Character[Name].Handle.Fire:Play()
1991
				CamShake(15, 50000)
1992
			end
1993
		else return false end
1994
		if Player.Character[Name]:FindFirstChild("Muzzle") ~= nil then
1995
			if silenced == false then
1996
				coroutine.resume(coroutine.create(function() Player.Character[Name].Muzzle.Smoke.Enabled = true Player.Character[Name].Muzzle.Fire.Enabled = true wait(0.1) Player.Character[Name].Muzzle.Smoke.Enabled = false Player.Character[Name].Muzzle.Fire.Enabled = false end))
1997
			else end
1998
		else return false end
1999
		for i = 0, 10, 5 do
2000
			if Player.Character:FindFirstChild("Torso") ~= nil then
2001
				if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
2002
					Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
2003
					Player.Character.Torso["Right Shoulder 2"].C1 =  CFrame.new(-0.72, 0.5, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(-90 - i), math.rad(-5), math.rad(-5))
2004
					wait()
2005
				else return false end
2006
			else return false end
2007
		end
2008
		makeShell(Player.Character[Name]:FindFirstChild("ShellOut"))		
2009
		if magazine.Value ~= 0 then
2010
			wait()
2011
		elseif magazine.Value == 0 then
2012
			Player.Character[Name].Handle.Lock.Pitch = 3
2013
			Player.Character[Name].Handle.Lock:Play()
2014
		end
2015
		for i = 10, 0, -5 do
2016
			if Player.Character:FindFirstChild("Torso") ~= nil then
2017
				if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
2018
					Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
2019
					Player.Character.Torso["Right Shoulder 2"].C1 =  CFrame.new(-0.72, 0.5, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(-90 - i), math.rad(-5), math.rad(-5))
2020
					wait()
2021
				else return false end
2022
			else return false end
2023
		end
2024
	end
2025
	if format == "leftFire" then
2026
		if Player.Character[Name.. " (Left)"]:FindFirstChild("Handle") ~= nil then
2027
			if silenced then
2028
				Player.Character[Name.. " (Left)"].Handle.Fire2.Volume = math.random(3, 8) / 10
2029
				Player.Character[Name.. " (Left)"].Handle.Fire2.Pitch = math.random(1.8, 2)
2030
				Player.Character[Name.. " (Left)"].Handle.Fire2:Play()
2031
				CamShake(15, 50000)
2032
			else
2033
				Player.Character[Name.. " (Left)"].Handle.Fire.Volume = math.random(8, 12) / 10
2034
				Player.Character[Name.. " (Left)"].Handle.Fire.Pitch = math.random(25, 35) / 20
2035
				Player.Character[Name.. " (Left)"].Handle.Fire:Play()
2036
				CamShake(15, 50000)
2037
			end
2038
		end
2039
		if Player.Character[Name.. " (Left)"]:FindFirstChild("Muzzle") ~= nil then
2040
			if silenced == false then
2041
				coroutine.resume(coroutine.create(function() Player.Character[Name.. " (Left)"].Muzzle.Smoke.Enabled = true Player.Character[Name.. " (Left)"].Muzzle.Fire.Enabled = true wait(0.1) Player.Character[Name.. " (Left)"].Muzzle.Smoke.Enabled = false Player.Character[Name.. " (Left)"].Muzzle.Fire.Enabled = false end))
2042
			else end
2043
		end
2044
		for i = 0, 10, 5 do
2045
			if Player.Character:FindFirstChild("Torso") ~= nil then
2046
				if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
2047
					Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
2048
					Player.Character.Torso["Left Shoulder 2"].C1 =  CFrame.new(0.72, 0.5, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(-90 - i), math.rad(5), math.rad(5))
2049
					wait()
2050
				else return false end
2051
			else return false end
2052
		end
2053
		makeShell(Player.Character[Name.. " (Left)"]:FindFirstChild("ShellOut"))		
2054
		if magazine.Value ~= 0 then
2055
			wait()
2056
		elseif magazine.Value == 0 then
2057
			Player.Character[Name].Handle.Lock.Pitch = 3
2058
			Player.Character[Name].Handle.Lock:Play()	
2059
		end
2060
		for i = 10, 0, -5 do
2061
			if Player.Character:FindFirstChild("Torso") ~= nil then
2062
				if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
2063
					Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
2064
					Player.Character.Torso["Left Shoulder 2"].C1 =  CFrame.new(0.72, 0.5, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(-90 - i), math.rad(5), math.rad(5))
2065
					wait()
2066
				else return false end
2067
			else return false end
2068
		end
2069
	end
2070
	if format == "silence" then
2071
		Player.Character[Name].Handle.Jam:Play()
2072
		if Player.Character:FindFirstChild("Torso") ~= nil then
2073
			if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
2074
				Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
2075
				Player.Character.Torso["Right Shoulder 2"].C1 =  CFrame.new(-0.9, -0.6, 0.51) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-5), 0)
2076
			else return false end
2077
		else return false end		
2078
		for i = 0, 10, 1.5 do
2079
			if Player.Character:FindFirstChild("Torso") ~= nil then
2080
				if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil then
2081
					Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
2082
					Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new(-0.9, 1.4 - (i / 25), 0.8) * CFrame.fromEulerAnglesXYZ(math.rad(290), 0, math.rad(-90))
2083
					wait()
2084
				end
2085
			end
2086
		end
2087
		for i = 10, 0, -1.5 do
2088
			if Player.Character:FindFirstChild("Torso") ~= nil then
2089
				if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil then
2090
					Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
2091
					Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new(-0.9, 1.4 - (i / 25), 0.8) * CFrame.fromEulerAnglesXYZ(math.rad(290), 0, math.rad(-90))
2092
					wait()
2093
				end
2094
			end
2095
		end
2096
		playAnimation("hold")
2097
		return true
2098
	end	
2099
	if format == "attachment" then
2100
		Player.Character[Name].Handle.Switch:Play()
2101
		for i = 0, 10, 5 do
2102
			if Player.Character:FindFirstChild("Torso") ~= nil then
2103
				if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil then
2104
					Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
2105
					Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new(-0.5 - (i / 25), 1.2, 0.8) * CFrame.fromEulerAnglesXYZ(math.rad(300 - i), math.rad(10 - i), math.rad(-90))
2106
					wait()
2107
				end
2108
			end
2109
		end
2110
		for i = 10, 0, -5 do
2111
			if Player.Character:FindFirstChild("Torso") ~= nil then
2112
				if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil then
2113
					Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
2114
					Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new(-0.5 - (i / 25), 1.2, 0.8) * CFrame.fromEulerAnglesXYZ(math.rad(300 - i), math.rad(10 - i), math.rad(-90))
2115
					wait()
2116
				end
2117
			end
2118
		end
2119
	end	
2120
	return true
2121
end
2122
2123
2124
function CamShake(time, freq)
2125
	coroutine.resume(coroutine.create(function()
2126
		local cam = game:GetService("Workspace").CurrentCamera
2127
		local time = 10
2128
		local seed = Vector3.new(math.random(100, 200) / freq, math.random(100, 200) / freq, 0)
2129
		if math.random(1, 2) == 1 then seed = Vector3.new(-seed.x, seed.y, 0) end
2130
		if math.random(1, 2) == 1 then seed = Vector3.new(seed.x, -seed.y, 0) end
2131
		cam.CoordinateFrame = (CFrame.new(cam.Focus.p) * (cam.CoordinateFrame - cam.CoordinateFrame.p) * CFrame.fromEulerAnglesXYZ(seed.x * time, seed.y * time, 0)) * CFrame.new(0, 0, (cam.CoordinateFrame.p - cam.Focus.p).magnitude)
2132
		for i = 1, time do
2133
			cam.CoordinateFrame = (CFrame.new(cam.Focus.p) * (cam.CoordinateFrame - cam.CoordinateFrame.p) * CFrame.fromEulerAnglesXYZ(-seed.x, -seed.y, 0)) * CFrame.new(0, 0, (cam.CoordinateFrame.p - cam.Focus.p).magnitude)
2134
			wait()
2135
		end
2136
	end))
2137
end
2138
2139
2140
function makeShell(part)
2141
	if part == nil then return false end
2142
	local casing = Instance.new("Part")
2143
	casing.Name = "Shell"
2144
	casing.formFactor = "Custom"
2145
	casing.Size = Vector3.new(0.2, 0.26, 0.2)
2146
	casing.CFrame = CFrame.new(part.Position) * CFrame.fromEulerAnglesXYZ(math.rad(math.random(0, 360)), math.rad(math.random(0, 360)), math.rad(math.random(0, 360)))
2147
	casing.BrickColor = BrickColor.new("New Yeller")
2148
	local mesh = Instance.new("CylinderMesh")
2149
	mesh.Scale = Vector3.new(0.4, 1, 0.4)
2150
	mesh.Parent = casing
2151
	casing.Parent = game:GetService("Workspace")
2152
	casing:BreakJoints()
2153
	casing.Velocity = (part.CFrame.lookVector * 50) + Vector3.new(0, 10, 0)
2154
	coroutine.resume(coroutine.create(function() wait(4.5) for i = 0, 1, 0.1 do casing.Transparency = i wait() end casing:Remove() end))
2155
end
2156
2157
2158
function Weld(x, y)
2159
	local weld = Instance.new("Weld")
2160
	weld.Part0 = x
2161
	weld.Part1 = y
2162
	CJ = CFrame.new(x.Position)
2163
	C0 = x.CFrame:inverse() * CJ
2164
	C1 = y.CFrame:inverse() * CJ
2165
	weld.C0 = C0
2166
	weld.C1 = C1
2167
	weld.Parent = x
2168
end
2169
2170
2171
function tagHumanoid(humanoid)
2172
	local tag = Instance.new("ObjectValue")
2173
	tag.Name = "creator"
2174
	tag.Value = Player
2175
	tag.Parent = humanoid
2176
	local tag = Instance.new("StringValue")
2177
	tag.Name = "creatorType1"
2178
	tag.Value = Name
2179
	tag.Parent = humanoid
2180
	local tag = Instance.new("StringValue")
2181
	tag.Name = "creatorType2"
2182
	tag.Value = "shot"
2183
	tag.Parent = humanoid
2184
end
2185
2186
2187
function untagHumanoid(humanoid)
2188
	if humanoid ~= nil then
2189
		local tag = humanoid:FindFirstChild("creator")
2190
		if tag ~= nil then
2191
			tag:Remove()
2192
		end
2193
		local tag = humanoid:FindFirstChild("creatorType1")
2194
		if tag ~= nil then
2195
			tag:Remove()
2196
		end
2197
		local tag = humanoid:FindFirstChild("creatorType2")
2198
		if tag ~= nil then
2199
			tag:Remove()
2200
		end
2201
	end
2202
end
2203
2204
2205
function fire(startPoint, endPoint, hit)
2206
	local trail = Instance.new("Part")
2207
	trail.Name = "Bullet Trail"
2208
	trail.BrickColor = BrickColor.new("Dark stone grey")
2209
	trail.TopSurface = 0
2210
	trail.BottomSurface = 0
2211
	trail.formFactor = 0
2212
	trail.Size = Vector3.new(1, 1, 1)
2213
	trail.Transparency = 0.5
2214
	trail.Anchored = true
2215
	trail.CanCollide = false
2216
	trail.CFrame = CFrame.new((startPoint + endPoint) / 2, endPoint)
2217
	trail.Parent = game:GetService("Workspace")
2218
	local mesh = Instance.new("SpecialMesh")
2219
	mesh.MeshType = "Brick"
2220
	mesh.Scale = Vector3.new(0.1, 0.1, (startPoint - endPoint).magnitude)
2221
	mesh.Parent = trail
2222
	coroutine.resume(coroutine.create(function(part) for i = 1, 10 do part.Mesh.Scale = Vector3.new(part.Mesh.Scale.x - 0.01, part.Mesh.Scale.y - 0.01, part.Mesh.Scale.z) wait() end part:Remove() end), trail)
2223
	if hit ~= nil then
2224
		if hit.Parent == nil then return end
2225
		if hit.Parent.ClassName == "Hat" then
2226
			if hit.Parent.Parent.Humanoid ~= nil then
2227
				hit.Parent.Parent.Humanoid:TakeDamage(damage * 5)
2228
			end
2229
		end		
2230
		if hit.Parent:FindFirstChild("Humanoid") ~= nil then
2231
			tagHumanoid(hit.Parent.Humanoid)
2232
			if hit.Name == "Head" then
2233
				hit.Parent.Humanoid:TakeDamage(damage * 10)
2234
			elseif hit.Name == "Torso" then
2235
				hit.Parent.Humanoid:TakeDamage(damage * 2)
2236
			elseif hit.Name == "Left Leg" then
2237
				hit.Parent.Humanoid:TakeDamage(damage)	
2238
				hit.Parent.Humanoid.Sit = true	
2239
			elseif hit.Name == "Right Leg" then
2240
				hit.Parent.Humanoid:TakeDamage(damage)	
2241
				hit.Parent.Humanoid.Sit = true								
2242
			else
2243
				hit.Parent.Humanoid:TakeDamage(damage)
2244
			end
2245
			if math.random(1, 10) == 1 then
2246
				hit.Parent.Humanoid.Sit = true
2247
			end
2248
			delay(0.1, function() untagHumanoid(hit.Parent.Humanoid) end)
2249
		end
2250
		if hit.Anchored == false then
2251
			hit.Velocity = hit.Velocity + ((endPoint - startPoint).unit * (damage * 2))
2252
		end
2253
	end
2254
end
2255
2256
2257
function onButton1Down(mouse)
2258
	if selected == false then return end
2259
	if Player.Character:FindFirstChild(Name) ~= nil and Button1Down == false and canFire == true and (function() if dual == true then if Player.Character:FindFirstChild(Name.. " (Left)") ~= nil then return true else return false end else return true end end)() == true then
2260
		if Player.Character[Name]:FindFirstChild("Handle") == nil then return end
2261
		if Player.Character[Name]:FindFirstChild("Muzzle") == nil then return end
2262
		if dual == true then if Player.Character[Name.. " (Left)"]:FindFirstChild("Handle") == nil then return end end
2263
		if dual == true then if Player.Character[Name.. " (Left)"]:FindFirstChild("Muzzle") == nil then return end end
2264
		mouse.Icon = "http://www.roblox.com/asset/?id=59125642"
2265
		Button1Down = true
2266
		canFire = false
2267
		canFire2 = true
2268
		while canFire2 == true do
2269
			local humanoid = Player.Character:FindFirstChild("Humanoid")
2270
			if humanoid == nil then
2271
				canFire2 = false
2272
				break
2273
			end
2274
			if humanoid.Health <= 0 then
2275
				canFire2 = false
2276
				break
2277
			end
2278
			local fireLeft = false
2279
			if automatic == false and burst == false then
2280
				canFire2 = false
2281
			elseif automatic == false and burst == true then
2282
				if burstCount >= burstCountMax then
2283
					canFire2 = false
2284
					burstCount = 0
2285
					break
2286
				end
2287
				burstCount = burstCount + 1
2288
			elseif automatic == true and burst == false then
2289
				fireLeft = true
2290
			end
2291
			if Jammed ~= true then
2292
				if magazine.Value > 0 then
2293
					magazine.Value = magazine.Value - 1
2294
					updateGui()
2295
					if silenced == true then
2296
						CamShake(1, Spread)
2297
					else end
2298
					fire(Player.Character[Name].Muzzle.Position, mouse.Hit.p, mouse.Target)
2299
					coroutine.resume(coroutine.create(function()
2300
						if dual == true then
2301
							playAnimation("rightFire")
2302
						elseif dual == false then
2303
							playAnimation("fire")
2304
						end
2305
					end))
2306
				else
2307
					Player.Character[Name].Handle.Empty:Play()
2308
				end
2309
			else 
2310
				Player.Character[Name].Handle.Empty:Play()
2311
			end					
2312
			if fireLeft == true and dual == true and automatic == true then
2313
				if magazine.Value > 0 then
2314
					coroutine.resume(coroutine.create(function()
2315
						wait(readyTime / 2)
2316
						magazine.Value = magazine.Value - 1
2317
						updateGui()
2318
						fire(Player.Character[Name.. " (Left)"].Muzzle.Position, mouse.Hit.p, mouse.Target)
2319
						if silenced == true then
2320
							CamShake(1, Spread)
2321
						else end
2322
						playAnimation("leftFire")
2323
					end))
2324
				else
2325
					coroutine.resume(coroutine.create(function()
2326
						wait(readyTime / 2)
2327
						Player.Character[Name].Handle.Empty:Play()
2328
					end))
2329
				end
2330
			end
2331
			wait(readyTime)
2332
		end
2333
		if magazine.Value ~= 0 then
2334
			mouse.Icon = "http://www.roblox.com/asset/?id=59125633"
2335
		else end
2336
		canFire = true
2337
	end
2338
end
2339
2340
2341
function onButton1Up(mouse)
2342
	if selected == false then return end
2343
	Button1Down = false
2344
	canFire2 = false
2345
	burstCount = 0
2346
	while canFire == false do wait() end
2347
	if dual == true and automatic == false then
2348
		if Player.Character[Name.. " (Left)"]:FindFirstChild("Handle") == nil then return end
2349
		if Player.Character[Name.. " (Left)"]:FindFirstChild("Muzzle") == nil then return end
2350
		mouse.Icon = "http://www.roblox.com/asset/?id=59125642"
2351
		canFire = false
2352
		canFire2 = true
2353
		while canFire2 == true do
2354
			local humanoid = Player.Character:FindFirstChild("Humanoid")
2355
			if humanoid == nil then
2356
				canFire2 = false
2357
				break
2358
			end
2359
			if humanoid.Health <= 0 then
2360
				canFire2 = false
2361
				break
2362
			end
2363
			if burst == false then
2364
				canFire2 = false
2365
			elseif burst == true then
2366
				if burstCount >= burstCountMax then
2367
					canFire2 = false
2368
					burstCount = 0
2369
					break
2370
				end
2371
				burstCount = burstCount + 1
2372
			end
2373
			if magazine.Value <= 0 then
2374
				Player.Character[Name].Handle.Empty:Play()
2375
			else
2376
				coroutine.resume(coroutine.create(function()
2377
					playAnimation("leftFire")
2378
				end))
2379
				magazine.Value = magazine.Value - 1
2380
				updateGui()
2381
				if silenced == true then
2382
					CamShake(1, Spread)
2383
				else end
2384
				fire(Player.Character[Name.. " (Left)"].Muzzle.Position, mouse.Hit.p, mouse.Target)
2385
			end
2386
			wait(readyTime)
2387
		end
2388
		if magazine.Value ~= 0 then
2389
			mouse.Icon = "http://www.roblox.com/asset/?id=59125633"
2390
		else end
2391
		canFire = true
2392
	end
2393
end
2394
2395
2396
function onKeyDown(key, mouse)
2397
	if selected == false then return end
2398
	key = key:lower()
2399
	if key == "q" and Button1Down == false and canFire == true then
2400
		if mouse.Target == nil then return end
2401
		if game:GetService("Players"):GetPlayerFromCharacter(mouse.Target.Parent) ~= nil then
2402
			if dual == true then onKeyDown("t", mouse) end
2403
			onDeselected(mouse)
2404
			removeParts("RightHolster")
2405
			script.Parent.Parent = game:GetService("Players"):GetPlayerFromCharacter(mouse.Target.Parent).Backpack
2406
		end
2407
	end
2408
	if key == "e" and Button1Down == false and canFire == true and canSilence == true then
2409
		if silenced then
2410
			silenced = false
2411
			Player.Character[Name].Handle.Lock.Pitch = 5
2412
			Player.Character[Name].Handle.Lock:Play()
2413
			if Player.Character:FindFirstChild(Name) == nil then return end
2414
			if Player.Character[Name]:FindFirstChild("Muzzle") == nil then return end
2415
			if Player.Character[Name]:FindFirstChild("Muzzle 2") == nil then return end
2416
			Player.Character[Name].Muzzle.Transparency = 1
2417
			Player.Character[Name].Silencer1.Transparency = 1			
2418
			Player.Character[Name].Muzzle.Name = "Silencer"
2419
			Player.Character[Name]["Muzzle 2"].Name = "Muzzle"
2420
			if dual == true then
2421
				if Player.Character[Name.. " (Left)"]:FindFirstChild("Muzzle") == nil then return end
2422
				if Player.Character[Name.. " (Left)"]:FindFirstChild("Muzzle 2") == nil then return end
2423
				Player.Character[Name.. " (Left)"].Muzzle.Transparency = 1
2424
				Player.Character[Name.. " (Left)"].Silencer1.Transparency = 1					
2425
				Player.Character[Name.. " (Left)"].Muzzle.Name = "Silencer"
2426
				Player.Character[Name.. " (Left)"]["Muzzle 2"].Name = "Muzzle"
2427
			end
2428
		else		
2429
			silenced = true
2430
			Player.Character[Name].Handle.Lock.Pitch = 5
2431
			Player.Character[Name].Handle.Lock:Play()			
2432
			if Player.Character:FindFirstChild(Name) == nil then return end
2433
			if Player.Character[Name]:FindFirstChild("Silencer") == nil then return end
2434
			if Player.Character[Name]:FindFirstChild("Muzzle") == nil then return end
2435
			Player.Character[Name].Silencer.Transparency = 0
2436
			Player.Character[Name].Silencer1.Transparency = 0					
2437
			Player.Character[Name].Muzzle.Name = "Muzzle 2"
2438
			Player.Character[Name].Silencer.Name = "Muzzle"
2439
			if dual == true then
2440
				if Player.Character[Name.. " (Left)"]:FindFirstChild("Silencer") == nil then return end
2441
				if Player.Character[Name.. " (Left)"]:FindFirstChild("Muzzle") == nil then return end
2442
				Player.Character[Name.. " (Left)"].Silencer.Transparency = 0
2443
				Player.Character[Name.. " (Left)"].Silencer1.Transparency = 0						
2444
				Player.Character[Name.. " (Left)"].Muzzle.Name = "Muzzle 2"
2445
				Player.Character[Name.. " (Left)"].Silencer.Name = "Muzzle"
2446
			end
2447
		end
2448
	end
2449
	if key == "r" and Button1Down == false and canFire == true then
2450
		if ammo.Value > 0 and magazine.Value ~= magazineMax.Value + Chamber then
2451
			canFire = false
2452
			burstCount = 0
2453
			mouse.Icon = "http://www.roblox.com/asset/?id=59125642"
2454
			if magazine.Value > 0 then magazine.Value = Chamber end
2455
			updateGui()
2456
			if dual == true then
2457
				playAnimation("reloadDual")
2458
			elseif dual == false then
2459
				playAnimation("reload")
2460
			end
2461
			if ammo.Value - magazineMax.Value < 0 then
2462
				magazine.Value = ammo.Value
2463
				ammo.Value = 0
2464
			elseif ammo.Value - magazineMax.Value >= 0 then
2465
				ammo.Value = ammo.Value - magazineMax.Value
2466
				magazine.Value = magazine.Value + MagSize
2467
			end
2468
			updateGui()
2469
			mouse.Icon = "http://www.roblox.com/asset/?id=59125633"
2470
			canFire = true
2471
		end
2472
	end
2473
	if key == "t" and Button1Down == false and canFire == true and canDual == true then
2474
		canFire = false
2475
		if dual == false then
2476
			local weapon = nil
2477
			for _, p in pairs(Player.Backpack:GetChildren()) do
2478
				if p.Name == Name and p ~= script.Parent then weapon = p break end
2479
			end
2480
			if weapon ~= nil then
2481
				dual = true
2482
				Chamber = 2
2483
				MagSize = MagSize * 2
2484
				weapon.Name = "Dual"
2485
				weapon.Parent = script
2486
				removeParts("RightHand")
2487
				makeParts("RightHand")
2488
				removeParts("RightHolster")
2489
				makeParts("LeftHolster")
2490
				playAnimation("leftEquip")
2491
				removeParts("LeftHolster")
2492
				makeParts("LeftHand")
2493
				magazineMax.Value = math.ceil(magazineMax.Value * 2)
2494
				ammoMax.Value = math.ceil(ammoMax.Value * 2)
2495
				magazine.Value = magazine.Value + weapon.Magazine.Value
2496
				ammo.Value = ammo.Value + weapon.Ammo.Value
2497
				updateGui()
2498
			end
2499
		elseif dual == true then
2500
			local weapon = script:FindFirstChild("Dual")
2501
			if weapon ~= nil then
2502
				dual = false
2503
				Holstered = true
2504
				Chamber = 1
2505
				MagSize = MagSize * 0.5
2506
				weapon.Name = Name
2507
				weapon.Parent = Player.Backpack
2508
				removeParts("RightHand")
2509
				makeParts("RightHand")
2510
				playAnimation("leftUnequip")
2511
				removeParts("LeftHand")
2512
				makeParts("RightHolster")
2513
				playAnimation("hold")
2514
				weapon.Magazine.Value = math.floor(magazine.Value / 2)
2515
				weapon.Ammo.Value = math.floor(ammo.Value / 2)
2516
				magazineMax.Value = math.ceil(magazineMax.Value / 2)
2517
				ammoMax.Value = math.ceil(ammoMax.Value / 2)
2518
				magazine.Value = math.ceil(magazine.Value / 2)
2519
				ammo.Value = math.ceil(ammo.Value / 2)
2520
				updateGui()
2521
			end
2522
		end
2523
		canFire = true
2524
	end
2525
	if key == "y" and canZoom == true then
2526
		if zoom == false then
2527
			zoom = true
2528
			local pos = mouse.Hit.p
2529
			local target = mouse.Target
2530
			local cam = game:GetService("Workspace").CurrentCamera
2531
			focus = Instance.new("Part", workspace)
2532
			focus.Anchored = true
2533
			focus.CanCollide = false
2534
			focus.Transparency = 1
2535
			focus.TopSurface = 0
2536
			focus.BottomSurface = 0
2537
			focus.formFactor = "Plate"
2538
			focus.Size = Vector3.new(0, 0, 0)
2539
			focus.CFrame = CFrame.new(pos) * (CFrame.new(Player.Character.Torso.CFrame.p, pos) - CFrame.new(Player.Character.Torso.CFrame.p, pos).p)
2540
			cam.CameraSubject = focus
2541
			cam.CameraType = "Attach"
2542
			while zoom == true and selected == true do
2543
				local set = false
2544
				if target ~= nil then
2545
					if target.Parent ~= nil then
2546
						if target.Anchored == false then
2547
							focus.CFrame = CFrame.new(target.CFrame.p) * (CFrame.new(Player.Character.Torso.CFrame.p, target.CFrame.p) - CFrame.new(Player.Character.Torso.CFrame.p, target.CFrame.p).p)
2548
							set = true
2549
						end
2550
					end
2551
				end
2552
				if set == false then
2553
					focus.CFrame = CFrame.new(pos) * (CFrame.new(Player.Character.Torso.CFrame.p, pos) - CFrame.new(Player.Character.Torso.CFrame.p, pos).p)
2554
				end
2555
				wait()
2556
			end
2557
			if focus ~= nil then focus:Remove() focus = nil end
2558
			local cam = game:GetService("Workspace").CurrentCamera
2559
			cam.CameraSubject = Player.Character:FindFirstChild("Humanoid")
2560
			cam.CameraType = "Custom"
2561
		else
2562
			zoom = false
2563
		end
2564
	end
2565
	if key == "u" and Button1Down == false and canFire == true then
2566
		if automatic == false and burst == false then
2567
			if switchToBurst == true then
2568
				burst = true
2569
				local m = Instance.new("Message", Player)
2570
				m.Text = "Burst"
2571
				pcall(function() Player.Character[Name].Handle.Switch:Play() end)
2572
				delay(2.5, function() m:Remove() end)
2573
			elseif switchToAutomatic == true then
2574
				automatic = true
2575
				local m = Instance.new("Message", Player)
2576
				m.Text = "Automatic"
2577
				pcall(function() Player.Character[Name].Handle.Switch:Play() end)
2578
				delay(2.5, function() m:Remove() end)
2579
			end
2580
		elseif automatic == false and burst == true then
2581
			if switchToAutomatic == true then
2582
				automatic = true
2583
				burst = false
2584
				local m = Instance.new("Message", Player)
2585
				m.Text = "Automatic"
2586
				pcall(function() Player.Character[Name].Handle.Switch:Play() end)
2587
				delay(2.5, function() m:Remove() end)
2588
			elseif switchToSingle == true then
2589
				burst = false
2590
				local m = Instance.new("Message", Player)
2591
				m.Text = "Single"
2592
				pcall(function() Player.Character[Name].Handle.Switch:Play() end)
2593
				delay(2.5, function() m:Remove() end)
2594
			end
2595
		elseif automatic == true and burst == false then
2596
			if switchToSingle == true then
2597
				automatic = false
2598
				local m = Instance.new("Message", Player)
2599
				m.Text = "Single"
2600
				pcall(function() Player.Character[Name].Handle.Switch:Play() end)
2601
				delay(2.5, function() m:Remove() end)
2602
			elseif switchToBurst == true then
2603
				automatic = false
2604
				burst = true
2605
				local m = Instance.new("Message", Player)
2606
				m.Text = "Burst"
2607
				pcall(function() Player.Character[Name].Handle.Switch:Play() end)
2608
				delay(2.5, function() m:Remove() end)
2609
			end
2610
		end
2611
	end
2612
	if key == "c" and Button1Down == false and canFire == true and dual == false then
2613
		canFire = false
2614
		burstCount = 0
2615
		mouse.Icon = "http://www.roblox.com/asset/?id=59125642"
2616
		if magazine.Value ~= 0 then magazine.Value = magazine.Value - 1 end
2617
		updateGui()
2618
		playAnimation("charge")
2619
		mouse.Icon = "http://www.roblox.com/asset/?id=59125633"
2620
		canFire = true
2621
	end	
2622
	if key == "f" and Button1Down == false and canFire == true and Attachment == true and dual == false then
2623
		if Mode == 0 and Mode ~= 1 then
2624
			Player.Character[Name].Handle.Switch:Play()
2625
			Player.Character[Name].Light.Transparency = 0.6
2626
			Mode = 1
2627
		elseif Mode == 1 and Mode ~= 0 then
2628
			Player.Character[Name].Handle.Switch:Play()		
2629
			Player.Character[Name].Light.Transparency = 1
2630
			Mode = 0
2631
		end
2632
	end	
2633
end
2634
2635
2636
function onSelected(mouse)
2637
	if selected == true then return end
2638
	selected = true
2639
	Holstered = false	
2640
	canFire = false
2641
	mouse.Icon = "http://www.roblox.com/asset/?id=59125642"
2642
	while Player.Character:FindFirstChild("WeaponActivated") ~= nil do
2643
		if Player.Character.WeaponActivated.Value == nil then break end
2644
		if Player.Character.WeaponActivated.Value.Parent == nil then break end
2645
		wait()
2646
	end
2647
	updateGui()
2648
	local weapon = Instance.new("ObjectValue")
2649
	weapon.Name = "WeaponActivated"
2650
	weapon.Value = script.Parent
2651
	weapon.Parent = Player.Character
2652
	DisableLimb(1, Player.Character)
2653
	DisableLimb(2, Player.Character)
2654
	ForceAngle(1, 0, Player.Character)
2655
	ForceAngle(2, 0, Player.Character)
2656
	if dual == true then
2657
		coroutine.resume(coroutine.create(function() playAnimation("leftEquip") end))
2658
		playAnimation("rightEquip")
2659
		removeParts("LeftHolster")
2660
		makeParts("LeftHand")
2661
	else
2662
		playAnimation("equip")
2663
	end
2664
	removeParts("RightHolster")
2665
	makeParts("RightHand")
2666
	mouse.Button1Down:connect(function() onButton1Down(mouse) end)
2667
	mouse.Button1Up:connect(function() onButton1Up(mouse) end)
2668
	mouse.KeyDown:connect(function(key) onKeyDown(key, mouse) end)
2669
	mouse.Icon = "http://www.roblox.com/asset/?id=59125633"
2670
	canFire = true
2671
end
2672
2673
2674
function onDeselected(mouse)
2675
	if selected == false then return end
2676
	Button1Down = false
2677
	while canFire == false do
2678
		wait()
2679
	end
2680
	selected = false
2681
	Holstered = true
2682
	if dual == true then
2683
		if math.random(1, 2) == 1 then
2684
			coroutine.resume(coroutine.create(function() playAnimation("leftUnequip") end))
2685
			wait(math.random(1, 10) / 10)
2686
			playAnimation("rightUnequip")
2687
		else
2688
			coroutine.resume(coroutine.create(function() playAnimation("rightUnequip") end))
2689
			wait(math.random(1, 10) / 10)
2690
			playAnimation("leftUnequip")
2691
		end
2692
		removeParts("LeftHand")
2693
		makeParts("LeftHolster")
2694
	else
2695
		playAnimation("unequip")
2696
	end
2697
	removeParts("RightHand")
2698
	makeParts("RightHolster")
2699
	ForceAngle(1, 0, Player.Character)
2700
	ForceAngle(2, 0, Player.Character)
2701
	ResetLimbCFrame(1, Player.Character)
2702
	ResetLimbCFrame(2, Player.Character)
2703
	EnableLimb(1, Player.Character)
2704
	EnableLimb(2, Player.Character)
2705
	if Player.PlayerGui:FindFirstChild(Name) ~= nil then Player.PlayerGui[Name]:Remove() end
2706
	if Player.Character:FindFirstChild("WeaponActivated") ~= nil then
2707
		if Player.Character.WeaponActivated.Value == script.Parent then
2708
			Player.Character.WeaponActivated:Remove()
2709
		end
2710
	end
2711
	while Player.Character:FindFirstChild("WeaponActivated") ~= nil do
2712
		if Player.Character.WeaponActivated.Value == nil then break end
2713
		if Player.Character.WeaponActivated.Value.Parent == nil then break end
2714
		wait()
2715
	end
2716
end
2717
2718
2719
if script.Parent.ClassName ~= "HopperBin" then
2720
	if Player == nil then print("Error: Player not found!") return end
2721
	Tool = Instance.new("HopperBin")
2722
	Tool.Name = Name
2723
	Tool.Parent = Player.Backpack
2724
	script.Name = "Main"
2725
	script.Parent = Tool
2726
end wait() if script.Parent.ClassName == "HopperBin" then
2727
	while script.Parent.Parent.ClassName ~= "Backpack" do
2728
		wait()
2729
	end
2730
	if script.Parent:FindFirstChild("MagazineMax") == nil then
2731
		magazineMax = Instance.new("NumberValue")
2732
		magazineMax.Name = "MagazineMax"
2733
		magazineMax.Value = 50
2734
		magazineMax.Parent = script.Parent
2735
	else
2736
		magazineMax = script.Parent.MagazineMax
2737
	end
2738
	if script.Parent:FindFirstChild("Magazine") == nil then
2739
		magazine = Instance.new("NumberValue")
2740
		magazine.Name = "Magazine"
2741
		magazine.Value = 0
2742
		magazine.Parent = script.Parent
2743
	else
2744
		magazine = script.Parent.Magazine
2745
	end
2746
	if script.Parent:FindFirstChild("AmmoMax") == nil then
2747
		ammoMax = Instance.new("NumberValue")
2748
		ammoMax.Name = "AmmoMax"
2749
		ammoMax.Value = 500000
2750
		ammoMax.Parent = script.Parent
2751
	else
2752
		ammoMax = script.Parent.AmmoMax
2753
	end
2754
	if script.Parent:FindFirstChild("Ammo") == nil then
2755
		ammo = Instance.new("NumberValue")
2756
		ammo.Name = "Ammo"
2757
		ammo.Value = script.Parent.AmmoMax.Value
2758
		ammo.Parent = script.Parent
2759
	else
2760
		ammo = script.Parent.Ammo
2761
	end
2762
	Player = script.Parent.Parent.Parent
2763
	makeParts("RightHolster")
2764
	script.Parent.Selected:connect(onSelected)
2765
	script.Parent.Deselected:connect(onDeselected)
2766
end