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