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