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