View difference between Paste ID: XLf3nBZ9 and dxyZ8rB3
SHOW: | | - or go back to the newest paste.
1
--MADE BY OneLegend (NOT THE SCRIPT) Thanks to CyberFromLU for letting me Publish! REGULAR SCRIPT: Go to line 12 and put your name where it says "YOUR NAME HERE"
2
--[[
3
American M249 Squad Automatic Weapon, derived from the Fabrique National Minimi, using 
4
key design elements from the older M60, it maintains a relatively smaller profile and 
5
sacrifices power for speed and accuracy.
6
--]]
7
8
9
if script == nil then return end
10
11
12-
Player = script:FindFirstChild("Player") ~= nil and script.Player.Value or game:GetService("Players"):FindFirstChild("Sora295")
12+
Player = script:FindFirstChild("Player") ~= nil and script.Player.Value or game:GetService("Players"):FindFirstChild("jer445")
13
Name = "M249"
14
MC = BrickColor.new("Black")
15
DC = BrickColor.new("Black")
16
GC = BrickColor.new("Dark stone grey")
17
MR = 0
18
GR = 0
19
Holstered = true
20
Spread = 90000
21
WSPenalty = 10
22
selected = false
23
canDual = false
24
dual = false
25
Button1Down = false
26
damage = 18
27
canFire = true
28
canFire2 = false
29
readyTime = 0.1
30
automatic = true
31
burst = false
32
burstCount = 0
33
burstCountMax = 3
34
canSilence = true
35
silenced = false
36
canZoom = false
37
zoom = false
38
switchToSingle = true
39
switchToBurst = false
40
switchToAutomatic = true
41
42
43
ammoGui = Instance.new("ScreenGui")
44
ammoGui.Name = Name
45
local frame = Instance.new("Frame")
46
frame.Name = "Frame"
47
frame.Size = UDim2.new(0, 165, 0, 60)
48
frame.Position = UDim2.new(0, 0, 1, -400)
49
frame.BackgroundColor3 = Color3.new(1, 1, 1)
50
frame.BorderColor3 = Color3.new(0, 0, 0)
51
frame.Parent = ammoGui
52
local label = Instance.new("TextLabel")
53
label.Name = "Weapon"
54
label.Text = "Weapon: " ..Name
55
label.Size = UDim2.new(1, 0, 0, 20)
56
label.Position = UDim2.new(0, 0, 0, 0)
57
label.BackgroundColor3 = Color3.new(1, 0, 0)
58
label.BorderColor3 = Color3.new(0, 0, 0)
59
label.Parent = frame
60
local label = Instance.new("TextLabel")
61
label.Name = "MagazinePrefix"
62
label.Text = "    Magazine:"
63
label.TextXAlignment = "Left"
64
label.Size = UDim2.new(1, 0, 0, 20)
65
label.Position = UDim2.new(0, 0, 0, 20)
66
label.BackgroundColor3 = Color3.new(1, 1, 1)
67
label.BorderColor3 = Color3.new(0, 0, 0)
68
label.Parent = frame
69
local label = Instance.new("TextLabel")
70
label.Name = "Magazine"
71
label.Text = "0/0"
72
label.TextXAlignment = "Right"
73
label.Size = UDim2.new(1, 0, 0, 20)
74
label.Position = UDim2.new(0, -10, 0, 20)
75
label.BackgroundTransparency = 1
76
label.BorderSizePixel = 0
77
label.Parent = frame
78
local label = Instance.new("TextLabel")
79
label.Name = "AmmoPrefix"
80
label.Text = "    5.56x45mm NATO:"
81
label.TextXAlignment = "Left"
82
label.Size = UDim2.new(1, 0, 0, 20)
83
label.Position = UDim2.new(0, 0, 0, 40)
84
label.BackgroundColor3 = Color3.new(1, 1, 1)
85
label.BorderColor3 = Color3.new(0, 0, 0)
86
label.Parent = frame
87
local label = Instance.new("TextLabel")
88
label.Name = "Ammo"
89
label.Text = "0/0"
90
label.TextXAlignment = "Right"
91
label.Size = UDim2.new(1, 0, 0, 20)
92
label.Position = UDim2.new(0, -10, 0, 40)
93
label.BackgroundTransparency = 1
94
label.BorderSizePixel = 0
95
label.Parent = frame
96
97
98
function updateGui()
99
	if selected == false then return end
100
	if Player:FindFirstChild("PlayerGui") == nil then Instance.new("PlayerGui").Parent = Player end
101
	if Player.PlayerGui:FindFirstChild(Name) == nil then
102
		ammoGui:Clone().Parent = Player.PlayerGui
103
	end
104
	Player.PlayerGui[Name].Frame.Magazine.Text = tostring(magazine.Value).. "/" ..tostring(magazineMax.Value)
105
	Player.PlayerGui[Name].Frame.Ammo.Text = tostring(ammo.Value).. "/" ..tostring(ammoMax.Value)
106
end
107
108
109
function makeParts(format)
110
	local model = Instance.new("Model")
111
	model.Name = Name
112
	local pm = Instance.new("Part")
113
	pm.Name = "Handle"
114
	pm.formFactor = "Symmetric"
115
	pm.Size = Vector3.new(1, 1, 1)
116
	pm.BrickColor = MC
117
	pm.Reflectance = MR
118
	pm.CanCollide = false
119
	pm.Locked = true
120
	pm.TopSurface = 0
121
	pm.BottomSurface = 0
122
	pm.Parent = model
123
	local m = Instance.new("BlockMesh")
124
	m.Scale = Vector3.new(0.35, 1.4, 0.41)
125
	m.Offset = Vector3.new(0, 0.01, 0.07)
126
	m.Parent = pm
127
	if format ~= nil then
128
		local w = Instance.new("Weld")
129
		w.Part0 = pm
130
		if format == "RightHand" then
131
			w.Part1 = Player.Character:FindFirstChild("Right Arm")
132
			w.C0 = CFrame.new(0, 1.15, 0.7)
133
			w.C1 = CFrame.new()
134
		elseif format == "RightHolster" then
135
			w.Part1 = Player.Character:FindFirstChild("Torso")
136
			w.C0 = CFrame.new(-0.65, 0, 0) * CFrame.fromEulerAnglesXYZ(math.rad(-40), math.rad(90), 0)
137
			w.C1 = CFrame.new()
138
			model.Name = Name.. " (Holstered)"
139
		end
140
		w.Parent = pm
141
		model.Parent = Player.Character
142
	end
143
	--[[
144
	sniper1  http://www.roblox.com/asset/?id=1868836
145
	equip    http://www.roblox.com/asset/?id=13510737
146
	fire1     http://www.roblox.com/asset/?id=2760979
147
	fire2    http://www.roblox.com/asset/?id=13510352
148
	fire3    http://www.roblox.com/asset/?id=2692806
149
	fire4    http://www.roblox.com/asset/?id=2691586
150
	fire5    http://www.roblox.com/asset/?id=2920959
151
	fire6    http://www.roblox.com/asset/?id=2697431
152
	fire7    http://www.roblox.com/asset/?id=2920959
153
	reload1   http://www.roblox.com/asset/?id=2691591
154
	reload2   http://www.roblox.com/asset/?id=2697432
155
	reload3  http://www.roblox.com/asset/?id=2920960
156
	reload4  http://www.roblox.com/asset/?id=2761842
157
	shotgun1 http://www.roblox.com/asset/?id=2697294
158
	--]]
159
	local s = Instance.new("Sound")
160
	s.Name = "Fire"
161
	s.SoundId = "http://www.roblox.com/Asset/?id=10209798"
162
	s.Volume = 1
163
	s.Pitch = 1.8
164
	s.Looped = false
165
	s.Parent = pm
166
	local s = Instance.new("Sound")
167
	s.Name = "Fire2"
168
	s.SoundId = "http://www.roblox.com/Asset/?id=16211041"
169
	s.Volume = 1
170
	s.Pitch = 3
171
	s.Looped = false
172
	s.Parent = pm
173
	local s = Instance.new("Sound")
174
	s.Name = "Lock"
175
	s.SoundId = "http://www.roblox.com/Asset/?id=10209845"
176
	s.Volume = 1
177
	s.Pitch = 3
178
	s.Looped = false
179
	s.Parent = pm
180
	local s = Instance.new("Sound")
181
	s.Name = "Release"
182
	s.SoundId = "http://www.roblox.com/Asset/?id=10209813"
183
	s.Volume = 1
184
	s.Pitch = 4
185
	s.Looped = false
186
	s.Parent = pm
187
	local s = Instance.new("Sound")
188
	s.Name = "Reload"
189
	s.SoundId = "http://www.roblox.com/asset/?id=2761842"
190
	s.Volume = 1
191
	s.Pitch = 1.1
192
	s.Looped = false
193
	s.Parent = pm
194
	local s = Instance.new("Sound")
195
	s.Name = "Empty"
196
	s.SoundId = "http://www.roblox.com/asset/?id=2697295"
197
	s.Volume = 1
198
	s.Pitch = 5
199
	s.Looped = false
200
	s.Parent = pm
201
	local s = Instance.new("Sound")
202
	s.Name = "Switch"
203
	s.SoundId = "http://www.roblox.com/asset/?id=2697295"
204
	s.Volume = 1
205
	s.Pitch = 10
206
	s.Looped = false
207
	s.Parent = pm
208
	local s = Instance.new("Sound")
209
	s.Name = "Equip"
210
	s.SoundId = "http://www.roblox.com/Asset/?id=10209845"
211
	s.Volume = 1
212
	s.Pitch = 1.2
213
	s.Looped = false
214
	s.Parent = pm
215
	local p = Instance.new("Part")
216
	p.Name = "ShellOut"
217
	p.formFactor = "Symmetric"
218
	p.Size = Vector3.new(1, 1, 1)
219
	p.Transparency = 1
220
	p.Locked = true
221
	p.CanCollide = false
222
	p.TopSurface = 0
223
	p.BottomSurface = 0
224
	p.Parent = model
225
	local w = Instance.new("Weld")
226
	w.Part0 = p
227
	w.Part1 = pm
228
	w.C0 = CFrame.new(0, 0.46, 1) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
229
	w.C1 = CFrame.new()
230
	w.Parent = p
231
	local p = Instance.new("Part")
232
	p.Name = "Grip"
233
	p.formFactor = "Symmetric"
234
	p.Size = Vector3.new(1, 1, 1)
235
	p.BrickColor = MC
236
	p.Reflectance = MR
237
	p.CanCollide = false
238
	p.Locked = true
239
	p.TopSurface = 0
240
	p.BottomSurface = 0
241
	p.Parent = model
242
	local m = Instance.new("BlockMesh")
243
	m.Scale = Vector3.new(0.29, 0.38, 0.8)
244
	m.Parent = p
245
	local w = Instance.new("Weld")
246
	w.Part0 = p
247
	w.Part1 = pm
248
	w.C0 = CFrame.new(0, -0.15, -0.5) * CFrame.fromEulerAnglesXYZ(math.rad(15), 0, 0)
249
	w.C1 = CFrame.new()
250
	w.Parent = p
251
	local p = Instance.new("Part")
252
	p.Name = "Body"
253
	p.formFactor = "Symmetric"
254
	p.Size = Vector3.new(1, 1, 1)
255
	p.BrickColor = MC
256
	p.Reflectance = MR
257
	p.CanCollide = false
258
	p.Locked = true
259
	p.TopSurface = 0
260
	p.BottomSurface = 0
261
	p.Parent = model
262
	local m = Instance.new("BlockMesh")
263
	m.Scale = Vector3.new(0.35, 0.3, 0.44)
264
	m.Parent = p
265
	local w = Instance.new("Weld")
266
	w.Part0 = p
267
	w.Part1 = pm
268
	w.C0 = CFrame.new(0, -0.56, -0.06)
269
	w.C1 = CFrame.new()
270
	w.Parent = p	
271
	local p = Instance.new("Part")
272
	p.Name = "Rearsight"
273
	p.formFactor = "Symmetric"
274
	p.Size = Vector3.new(1, 1, 1)
275
	p.BrickColor = MC
276
	p.Reflectance = MR
277
	p.CanCollide = false
278
	p.Locked = true
279
	p.TopSurface = 0
280
	p.BottomSurface = 0
281
	p.Parent = model
282
	local m = Instance.new("BlockMesh")
283
	m.Scale = Vector3.new(0.08, 0.2, 0.44)
284
	m.Offset = Vector3.new(0.12, 0, 0)
285
	m.Parent = p
286
	local w = Instance.new("Weld")
287
	w.Part0 = p
288
	w.Part1 = pm
289
	w.C0 = CFrame.new(0, -0.56, 0)
290
	w.C1 = CFrame.new()
291
	w.Parent = p
292
	local p = Instance.new("Part")
293
	p.Name = "Rearsight"
294
	p.formFactor = "Symmetric"
295
	p.Size = Vector3.new(1, 1, 1)
296
	p.BrickColor = MC
297
	p.Reflectance = MR
298
	p.CanCollide = false
299
	p.Locked = true
300
	p.TopSurface = 0
301
	p.BottomSurface = 0
302
	p.Parent = model
303
	local m = Instance.new("BlockMesh")
304
	m.Scale = Vector3.new(0.08, 0.2, 0.44)
305
	m.Offset = Vector3.new(-0.12, 0, 0)
306
	m.Parent = p
307
	local w = Instance.new("Weld")
308
	w.Part0 = p
309
	w.Part1 = pm
310
	w.C0 = CFrame.new(0, -0.56, 0)
311
	w.C1 = CFrame.new()
312
	w.Parent = p
313
	local p = Instance.new("Part")
314
	p.Name = "Frontsight"
315
	p.formFactor = "Symmetric"
316
	p.Size = Vector3.new(1, 1, 1)
317
	p.BrickColor = MC
318
	p.Reflectance = MR
319
	p.CanCollide = false
320
	p.Locked = true
321
	p.TopSurface = 0
322
	p.BottomSurface = 0
323
	p.Parent = model
324
	local m = Instance.new("BlockMesh")
325
	m.Scale = Vector3.new(0.08, 0.1, 0.3)
326
	m.Parent = p
327
	local w = Instance.new("Weld")
328
	w.Part0 = p
329
	w.Part1 = pm
330
	w.C0 = CFrame.new(0, 2, 0.07)
331
	w.C1 = CFrame.new()
332
	w.Parent = p		
333
	local p = Instance.new("Part")
334
	p.Name = "Top2C"
335
	p.formFactor = "Symmetric"
336
	p.Size = Vector3.new(1, 1, 1)
337
	p.BrickColor = MC
338
	p.Reflectance = MR
339
	p.CanCollide = false
340
	p.Locked = true
341
	p.TopSurface = 0
342
	p.BottomSurface = 0
343
	p.Parent = model
344
	local m = Instance.new("BlockMesh")
345
	m.Scale = Vector3.new(0.42, 0.46, 0.12)
346
	m.Parent = p
347
	local w = Instance.new("Weld")
348
	w.Part0 = p
349
	w.Part1 = pm
350
	w.C0 = CFrame.new(0.035, 0.46, 0.1)
351
	w.C1 = CFrame.new()
352
	w.Parent = p
353
	local p = Instance.new("Part")
354
	p.Name = "Top2O"
355
	p.formFactor = "Symmetric"
356
	p.Size = Vector3.new(1, 1, 1)
357
	p.BrickColor = MC
358
	p.Reflectance = MR
359
	p.CanCollide = false
360
	p.Transparency = 1
361
	p.Locked = true
362
	p.TopSurface = 0
363
	p.BottomSurface = 0
364
	p.Parent = model
365
	local m = Instance.new("BlockMesh")
366
	m.Scale = Vector3.new(0.42, 0.46, 0.12)
367
	m.Parent = p
368
	local w = Instance.new("Weld")
369
	w.Part0 = p
370
	w.Part1 = pm
371
	w.C0 = CFrame.new(0.035, 0.4, 0.38) * CFrame.fromEulerAnglesXYZ(math.rad(20), 0, 0)
372
	w.C1 = CFrame.new()
373
	w.Parent = p	
374
	local p = Instance.new("Part")
375
	p.Name = "TopC"
376
	p.formFactor = "Symmetric"
377
	p.Size = Vector3.new(1, 1, 1)
378
	p.BrickColor = MC
379
	p.Reflectance = MR
380
	p.CanCollide = false
381
	p.Locked = true
382
	p.TopSurface = 0
383
	p.BottomSurface = 0
384
	p.Parent = model
385
	local m = Instance.new("BlockMesh")
386
	m.Scale = Vector3.new(0.35, 1.1, 0.12)
387
	m.Parent = p
388
	local w = Instance.new("Weld")
389
	w.Part0 = p
390
	w.Part1 = pm
391
	w.C0 = CFrame.new(0, 0.14, 0.1)
392
	w.C1 = CFrame.new()
393
	w.Parent = p
394
	local p = Instance.new("Part")
395
	p.Name = "TopO"
396
	p.formFactor = "Symmetric"
397
	p.Size = Vector3.new(1, 1, 1)
398
	p.BrickColor = MC
399
	p.Reflectance = MR
400
	p.CanCollide = false
401
	p.Transparency = 1
402
	p.Locked = true
403
	p.TopSurface = 0
404
	p.BottomSurface = 0
405
	p.Parent = model
406
	local m = Instance.new("BlockMesh")
407
	m.Scale = Vector3.new(0.35, 1.1, 0.12)
408
	m.Parent = p
409
	local w = Instance.new("Weld")
410
	w.Part0 = p
411
	w.Part1 = pm
412
	w.C0 = CFrame.new(0, 0.05, 0.38) * CFrame.fromEulerAnglesXYZ(math.rad(20), 0, 0)
413
	w.C1 = CFrame.new()
414
	w.Parent = p	
415
	local p = Instance.new("Part")
416
	p.Name = "Magazine"
417
	p.formFactor = "Symmetric"
418
	p.Size = Vector3.new(1, 1, 1)
419
	p.BrickColor = BrickColor.new("Sand green")
420
	p.Locked = true
421
	p.CanCollide = false
422
	p.TopSurface = 0
423
	p.BottomSurface = 0
424
	p.Parent = model
425
	local m = Instance.new("BlockMesh")
426
	m.Scale = Vector3.new(0.8, 0.43, 0.6)
427
	m.Parent = p
428
	local w = Instance.new("Weld")
429
	w.Part0 = p
430
	w.Part1 = pm
431
	w.C0 = CFrame.new(0, 0.46, -0.5)
432
	w.C1 = CFrame.new()
433
	w.Parent = p
434
	local p = Instance.new("Part")
435
	p.Name = "Magazine2"
436
	p.formFactor = "Symmetric"
437
	p.Size = Vector3.new(1, 1, 1)
438
	p.BrickColor = BrickColor.new("Bright yellow")
439
	p.Locked = true
440
	p.CanCollide = false
441
	p.Reflectance = 0.3
442
	if magazine.Value ~= 0 then
443
		p.Transparency = 0
444
	else
445
		p.Transparency = 1
446
	end
447
	p.TopSurface = 0
448
	p.BottomSurface = 0
449
	p.Parent = model
450
	local m = Instance.new("BlockMesh")
451
	m.Scale = Vector3.new(0.06, 0.36, 0.6)
452
	m.Parent = p
453
	local w = Instance.new("Weld")
454
	w.Part0 = p
455
	w.Part1 = pm
456
	w.C0 = CFrame.new(0.18, 0.46, -0.26) * CFrame.fromEulerAnglesXYZ(0, math.rad(20), 0)
457
	w.C1 = CFrame.new()
458
	w.Parent = p	
459
	local p = Instance.new("Part")
460
	p.Name = "TriggerGuard"
461
	p.formFactor = "Symmetric"
462
	p.Size = Vector3.new(1, 1, 1)
463
	p.BrickColor = MC
464
	p.Reflectance = MR
465
	p.CanCollide = false
466
	p.Locked = true
467
	p.TopSurface = 0
468
	p.BottomSurface = 0
469
	p.Parent = model
470
	local m = Instance.new("SpecialMesh")
471
	m.MeshType = "FileMesh"
472
	m.MeshId = "http://www.roblox.com/asset/?id=3270017"
473
	m.Scale = Vector3.new(0.3, 0.3, 0.8)
474
	m.Parent = p
475
	local w = Instance.new("Weld")
476
	w.Part0 = p
477
	w.Part1 = pm
478
	w.C0 = CFrame.new(-0.25, 0, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
479
	w.C1 = CFrame.new()
480
	w.Parent = p
481
	local p = Instance.new("Part")
482
	p.Name = "Trigger"
483
	p.formFactor = "Symmetric"
484
	p.Size = Vector3.new(1, 1, 1)
485
	p.BrickColor = BrickColor.new("Dark stone grey")
486
	p.Reflectance = MR
487
	p.CanCollide = false
488
	p.Locked = true
489
	p.TopSurface = 0
490
	p.BottomSurface = 0
491
	p.Parent = model
492
	local m = Instance.new("BlockMesh")
493
	m.Scale = Vector3.new(0.1, 0.4, 0.16)
494
	m.Parent = p
495
	local w = Instance.new("Weld")
496
	w.Part0 = p
497
	w.Part1 = pm
498
	w.C0 = CFrame.new(0, -0.14, -0.3)
499
	w.C1 = CFrame.new()
500
	w.Parent = p
501
	local p = Instance.new("Part")
502
	p.Name = "ForeBarrel"
503
	p.CanCollide = false
504
	p.formFactor = "Symmetric"
505
	p.Size = Vector3.new(1, 1, 1)
506
	p.BrickColor = GC
507
	p.Reflectance = GR
508
	p.Locked = true
509
	p.TopSurface = 0
510
	p.BottomSurface = 0
511
	p.Parent = model
512
	local m = Instance.new("BlockMesh")
513
	m.Scale = Vector3.new(0.25, 1, 0.25)
514
	m.Parent = p
515
	local w = Instance.new("Weld")
516
	w.Part0 = p
517
	w.Part1 = pm
518
	w.C0 = CFrame.new(0, 1.18, -0.1)
519
	w.C1 = CFrame.new()
520
	w.Parent = p
521
	local p = Instance.new("Part")
522
	p.Name = "ForeBarrel"
523
	p.CanCollide = false
524
	p.formFactor = "Symmetric"
525
	p.Size = Vector3.new(1, 1, 1)
526
	p.BrickColor = GC
527
	p.Reflectance = GR
528
	p.Locked = true
529
	p.TopSurface = 0
530
	p.BottomSurface = 0
531
	p.Parent = model
532
	local m = Instance.new("BlockMesh")
533
	m.Scale = Vector3.new(0.25, 0.8, 0.3)
534
	m.Parent = p
535
	local w = Instance.new("Weld")
536
	w.Part0 = p
537
	w.Part1 = pm
538
	w.C0 = CFrame.new(0, 1.09, -0.25)
539
	w.C1 = CFrame.new()
540
	w.Parent = p
541
	local p = Instance.new("Part")
542
	p.Name = "Shroud"
543
	p.CanCollide = false
544
	p.formFactor = "Symmetric"
545
	p.Size = Vector3.new(1, 1, 1)
546
	p.BrickColor = MC
547
	p.Reflectance = MR
548
	p.Locked = true
549
	p.TopSurface = 0
550
	p.BottomSurface = 0
551
	p.Parent = model
552
	local m = Instance.new("CylinderMesh")
553
	m.Scale = Vector3.new(0.26, 0.999, 0.26)
554
	m.Parent = p
555
	local w = Instance.new("Weld")
556
	w.Part0 = p
557
	w.Part1 = pm
558
	w.C0 = CFrame.new(0, 1.18, 0)
559
	w.C1 = CFrame.new()
560
	w.Parent = p	
561
	local p = Instance.new("Part")
562
	p.Name = "Rail" --------------
563
	p.CanCollide = false
564
	p.formFactor = "Symmetric"
565
	p.Size = Vector3.new(1, 1, 1)
566
	p.BrickColor = MC
567
	p.Reflectance = MR
568
	p.Locked = true
569
	p.TopSurface = 0
570
	p.BottomSurface = 0
571
	p.Parent = model
572
	local m = Instance.new("BlockMesh")
573
	m.Scale = Vector3.new(0.18, 1, 0.18)
574
	m.Parent = p
575
	local w = Instance.new("Weld")
576
	w.Part0 = p
577
	w.Part1 = pm
578
	w.C0 = CFrame.new(0, 1.17, -0.04)
579
	w.C1 = CFrame.new()
580
	w.Parent = p
581
	local p = Instance.new("Part")
582
	p.Name = "Barrel 1"
583
	p.formFactor = "Symmetric"
584
	p.Size = Vector3.new(1, 1, 1)
585
	p.BrickColor = DC
586
	p.Reflectance = MR
587
	p.CanCollide = false
588
	p.Locked = true
589
	p.TopSurface = 0
590
	p.BottomSurface = 0
591
	p.Parent = model
592
	local m = Instance.new("CylinderMesh")
593
	m.Scale = Vector3.new(0.15, 0.8, 0.15)
594
	m.Parent = p
595
	local w = Instance.new("Weld")
596
	w.Part0 = p
597
	w.Part1 = pm
598
	w.C0 = CFrame.new(0, 1.6, -0.04)
599
	w.C1 = CFrame.new()
600
	w.Parent = p
601
	local p = Instance.new("Part")
602
	p.Name = "Hole"
603
	p.formFactor = "Symmetric"
604
	p.Size = Vector3.new(1, 1, 1)
605
	p.BrickColor = BrickColor.new("Really black")
606
	p.CanCollide = false
607
	p.Locked = true
608
	p.TopSurface = 0
609
	p.BottomSurface = 0
610
	p.Parent = model
611
	local m = Instance.new("CylinderMesh")
612
	m.Scale = Vector3.new(0.14, 0.4, 0.14)
613
	m.Offset = Vector3.new(0, 0.2, 0)
614
	m.Parent = p
615
	local w = Instance.new("Weld")
616
	w.Part0 = p
617
	w.Part1 = pm
618
	w.C0 = CFrame.new(0, 2.405, -0.04)
619
	w.C1 = CFrame.new()
620
	w.Parent = p
621
	local p = Instance.new("Part")
622
	if silenced == false then
623
		p.Name = "Muzzle"
624
	else
625
		p.Name = "Muzzle 2"
626
	end
627
	p.formFactor = "Symmetric"
628
	p.Size = Vector3.new(1, 1, 1)
629
	p.BrickColor = DC
630
	p.Reflectance = MR
631
	p.CanCollide = false
632
	p.Locked = true
633
	p.TopSurface = 0
634
	p.BottomSurface = 0
635
	p.Parent = model
636
	local m = Instance.new("CylinderMesh")
637
	m.Scale = Vector3.new(0.18, 0.4, 0.18)
638
	m.Offset = Vector3.new(0, 0.2, 0)
639
	m.Parent = p
640
	local w = Instance.new("Weld")
641
	w.Part0 = p
642
	w.Part1 = pm
643
	w.C0 = CFrame.new(0, 2.4, -0.04)
644
	w.C1 = CFrame.new()
645
	w.Parent = p
646
	local s = Instance.new("Smoke")
647
	s.Enabled = false
648
	s.Name = "Smoke"
649
	s.RiseVelocity = -5
650
	s.Opacity = 0.3
651
	s.Color = Color3.new(75 / 225, 75 / 225, 75 / 225)
652
	s.Size = 1
653
	s.Parent = p
654
	local f = Instance.new("Fire")
655
	f.Enabled = false
656
	f.Name = "Fire"
657
	f.Heat = -35
658
	f.Size = 1
659
	f.Parent = p
660
	local p = Instance.new("Part")
661
	p.Name = "Silencer"
662
	p.formFactor = "Symmetric"
663
	p.Size = Vector3.new(1, 1, 1)
664
	p.BrickColor = BrickColor.new("Black")
665
 	p.CanCollide = false
666
	if silenced == false then
667
		p.Name = "Silencer"
668
		p.Transparency = 1
669
	else	
670
		p.Name = "Muzzle"
671
		p.Transparency = 0
672
	end
673
	p.Locked = true
674
	p.TopSurface = 0
675
	p.BottomSurface = 0
676
	p.Parent = model
677
	local m = Instance.new("CylinderMesh")
678
	m.Scale = Vector3.new(0.25, 0.8, 0.25)
679
	m.Parent = p
680
	local w = Instance.new("Weld")
681
	w.Part0 = p
682
	w.Part1 = pm
683
	w.C0 = CFrame.new(0, 2.5, -0.04)
684
	w.C1 = CFrame.new()
685
	w.Parent = p
686
	if Holstered == true then
687
		local p = Instance.new("Part")
688
		p.Name = "StockI"
689
		p.CanCollide = false
690
		p.formFactor = "Symmetric"
691
		p.Size = Vector3.new(1, 1, 1)
692
		p.BrickColor = MC
693
		p.Reflectance = MR
694
		p.Locked = true
695
		p.TopSurface = 0
696
		p.BottomSurface = 0
697
		p.Parent = model
698
		local m = Instance.new("CylinderMesh")
699
		m.Scale = Vector3.new(0.36, 0.2, 0.36)
700
		m.Parent = p
701
		local w = Instance.new("Weld")
702
		w.Part0 = p
703
		w.Part1 = pm
704
		w.C0 = CFrame.new(0, -0.7, -0.1)
705
		w.C1 = CFrame.new()
706
		w.Parent = p
707
	else
708
		local p = Instance.new("Part")
709
		p.Name = "StockO"
710
		p.CanCollide = false
711
		p.formFactor = "Symmetric"
712
		p.Size = Vector3.new(1, 1, 1)
713
		p.BrickColor = MC
714
		p.Reflectance = MR
715
		p.Locked = true
716
		p.TopSurface = 0
717
		p.BottomSurface = 0
718
		p.Parent = model
719
		local m = Instance.new("CylinderMesh")
720
		m.Scale = Vector3.new(0.36, 0.2, 0.36)
721
		m.Parent = p
722
		local w = Instance.new("Weld")
723
		w.Part0 = p
724
		w.Part1 = pm
725
		w.C0 = CFrame.new(0, -1.4, -0.1)
726
		w.C1 = CFrame.new()
727
		w.Parent = p
728
		local p = Instance.new("Part")
729
		p.Name = "StockArm"
730
		p.CanCollide = false
731
		p.formFactor = "Symmetric"
732
		p.Size = Vector3.new(1, 1, 1)
733
		p.BrickColor = MC
734
		p.Reflectance = MR
735
		p.Locked = true
736
		p.TopSurface = 0
737
		p.BottomSurface = 0
738
		p.Parent = model
739
		local m = Instance.new("BlockMesh")
740
		m.Scale = Vector3.new(0.1, 0.8, 0.1)
741
		m.Offset = Vector3.new(0, 0, 0.12)
742
		m.Parent = p
743
		local w = Instance.new("Weld")
744
		w.Part0 = p
745
		w.Part1 = pm
746
		w.C0 = CFrame.new(0, -0.9, -0.1)
747
		w.C1 = CFrame.new()
748
		w.Parent = p
749
		local p = Instance.new("Part")
750
		p.Name = "StockArm"
751
		p.CanCollide = false
752
		p.formFactor = "Symmetric"
753
		p.Size = Vector3.new(1, 1, 1)
754
		p.BrickColor = MC
755
		p.Reflectance = MR
756
		p.Locked = true
757
		p.TopSurface = 0
758
		p.BottomSurface = 0
759
		p.Parent = model
760
		local m = Instance.new("BlockMesh")
761
		m.Scale = Vector3.new(0.1, 0.8, 0.1)
762
		m.Offset = Vector3.new(0, 0, -0.12)		
763
		m.Parent = p
764
		local w = Instance.new("Weld")
765
		w.Part0 = p
766
		w.Part1 = pm
767
		w.C0 = CFrame.new(0, -0.9, -0.1)
768
		w.C1 = CFrame.new()
769
		w.Parent = p				
770
	end
771
	return model
772
end
773
774
775
function removeParts(format)
776
	if format == "RightHand" then
777
		pcall(function() Player.Character[Name]:Remove() end)
778
	elseif format == "LeftHand" then
779
		pcall(function() Player.Character[Name.. " (Left)"]:Remove() end)
780
	elseif format == "RightHolster" then
781
		pcall(function() Player.Character[Name.. " (Holstered)"]:Remove() end)
782
	elseif format == "LeftHolster" then
783
		pcall(function() Player.Character[Name.. " (Holstered, Left)"]:Remove() end)
784
	end
785
end
786
787
788
function SetAngle(Joint, Angle, Character)
789
	if Character == nil then return false end
790
	local Joints = {
791
		Character.Torso:FindFirstChild("Right Shoulder 2"),
792
		Character.Torso:FindFirstChild("Left Shoulder 2"),
793
		Character.Torso:FindFirstChild("Right Hip 2"),
794
		Character.Torso:FindFirstChild("Left Hip 2")
795
	}
796
	if Joints[Joint] == nil then return false end
797
	if Joint == 1 or Joint == 3 then
798
		Joints[Joint].DesiredAngle = Angle
799
	end
800
	if Joint == 2 or Joint == 4 then
801
		Joints[Joint].DesiredAngle = -Angle
802
	end
803
end
804
805
806
function ForceAngle(Joint, Angle, Character)
807
	if Character == nil then return false end
808
	local Joints = {
809
		Character.Torso:FindFirstChild("Right Shoulder 2"),
810
		Character.Torso:FindFirstChild("Left Shoulder 2"),
811
		Character.Torso:FindFirstChild("Right Hip 2"),
812
		Character.Torso:FindFirstChild("Left Hip 2")
813
	}
814
	if Joints[Joint] == nil then return false end
815
	if Joint == 1 or Joint == 3 then
816
		Joints[Joint].DesiredAngle = Angle
817
		Joints[Joint].CurrentAngle = Angle
818
	end
819
	if Joint == 2 or Joint == 4 then
820
		Joints[Joint].DesiredAngle = -Angle
821
		Joints[Joint].CurrentAngle = -Angle
822
	end
823
end
824
825
826
function SetSpeed(Joint, Speed, Character)
827
	if Character == nil then return false end
828
	local Joints = {
829
		Character.Torso:FindFirstChild("Right Shoulder 2"),
830
		Character.Torso:FindFirstChild("Left Shoulder 2"),
831
		Character.Torso:FindFirstChild("Right Hip 2"),
832
		Character.Torso:FindFirstChild("Left Hip 2")
833
	}
834
	if Joints[Joint] == nil then return false end
835
	Joints[Joint].MaxVelocity = Speed
836
end
837
838
839
function DisableLimb(Limb, Character)
840
	if Character == nil then return false end
841
	if Character:FindFirstChild("Torso") == nil then return false end
842
	local Joints = {
843
		Character.Torso:FindFirstChild("Right Shoulder"),
844
		Character.Torso:FindFirstChild("Left Shoulder"),
845
		Character.Torso:FindFirstChild("Right Hip"),
846
		Character.Torso:FindFirstChild("Left Hip")
847
	}
848
	local Limbs = {
849
		Character:FindFirstChild("Right Arm"),
850
		Character:FindFirstChild("Left Arm"),
851
		Character:FindFirstChild("Right Leg"),
852
		Character:FindFirstChild("Left Leg")
853
	}
854
	if Joints[Limb] == nil then return false end
855
	if Limbs[Limb] == nil then return false end
856
	local Joint = Instance.new("Motor")
857
	Joint.Parent = Character.Torso
858
	Joint.Part0 = Character.Torso
859
	Joint.Part1 = Limbs[Limb]
860
	if Limb == 1 then
861
		Joint.C0 = CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
862
		Joint.C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
863
		Joint.Name = "Right Shoulder 2"
864
	elseif Limb == 2 then
865
		Joint.C0 = CFrame.new(-1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
866
		Joint.C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
867
		Joint.Name = "Left Shoulder 2"
868
	elseif Limb == 3 then
869
		Joint.C0 = CFrame.new(0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
870
		Joint.C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
871
		Joint.Name = "Right Hip 2"
872
	elseif Limb == 4 then
873
		Joint.C0 = CFrame.new(-0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
874
		Joint.C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
875
		Joint.Name = "Left Hip 2"
876
	end
877
	Joint.MaxVelocity = Joints[Limb].MaxVelocity
878
	Joint.CurrentAngle = Joints[Limb].CurrentAngle
879
	Joint.DesiredAngle = Joints[Limb].DesiredAngle
880
	Joints[Limb]:Remove()
881
end
882
883
884
function ResetLimbCFrame(Limb, Character)
885
	if Character == nil then return false end
886
	if Character.Parent == nil then return false end
887
	if Character:FindFirstChild("Torso") == nil then return false end
888
	local Joints = {
889
		Character.Torso:FindFirstChild("Right Shoulder 2"),
890
		Character.Torso:FindFirstChild("Left Shoulder 2"),
891
		Character.Torso:FindFirstChild("Right Hip 2"),
892
		Character.Torso:FindFirstChild("Left Hip 2")
893
	}
894
	local Limbs = {
895
		Character:FindFirstChild("Right Arm"),
896
		Character:FindFirstChild("Left Arm"),
897
		Character:FindFirstChild("Right Leg"),
898
		Character:FindFirstChild("Left Leg")
899
	}
900
	if Joints[Limb] == nil then return false end
901
	if Limbs[Limb] == nil then return false end
902
	if Limb == 1 then
903
		Joints[Limb].C0 = CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
904
		Joints[Limb].C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
905
	elseif Limb == 2 then
906
		Joints[Limb].C0 = CFrame.new(-1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
907
		Joints[Limb].C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
908
	elseif Limb == 3 then
909
		Joints[Limb].C0 = CFrame.new(0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
910
		Joints[Limb].C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
911
	elseif Limb == 4 then
912
		Joints[Limb].C0 = CFrame.new(-0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
913
		Joints[Limb].C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
914
	end
915
end
916
917
918
function EnableLimb(Limb, Character)
919
	if Character == nil then return false end
920
	if Character:FindFirstChild("Torso") == nil then return false end
921
	local Joints = {
922
		Character.Torso:FindFirstChild("Right Shoulder 2"),
923
		Character.Torso:FindFirstChild("Left Shoulder 2"),
924
		Character.Torso:FindFirstChild("Right Hip 2"),
925
		Character.Torso:FindFirstChild("Left Hip 2")
926
	}
927
	local Limbs = {
928
		Character:FindFirstChild("Right Arm"),
929
		Character:FindFirstChild("Left Arm"),
930
		Character:FindFirstChild("Right Leg"),
931
		Character:FindFirstChild("Left Leg")
932
	}
933
	if Joints[Limb] == nil then return false end
934
	if Limbs[Limb] == nil then return false end
935
	if Limb == 1 then
936
		Joints[Limb].Name = "Right Shoulder"
937
	elseif Limb == 2 then
938
		Joints[Limb].Name = "Left Shoulder"
939
	elseif Limb == 3 then
940
		Joints[Limb].Name = "Right Hip"
941
	elseif Limb == 4 then
942
		Joints[Limb].Name = "Left Hip"
943
	end
944
	Animate = Character:FindFirstChild("Animate")
945
	if Animate == nil then return false end
946
	Animate = Animate:Clone()
947
	Character.Animate:Remove()
948
	Animate.Parent = Character
949
end
950
951
952
function playAnimation(format, mouse)
953
	if format == "equip" then
954
		Player.Character.Humanoid.WalkSpeed = WSPenalty
955
		coroutine.resume(coroutine.create(function()
956
			for i = 0, 1, 0.025 do
957
				if Player.Character:FindFirstChild("Torso") ~= nil then
958
					if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
959
						Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new(-1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(math.rad(90) * i, 0, math.rad(67.5) * i)
960
						Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new(0, 0.5 * (1 - i), 0) * CFrame.new(0, 1.85 * i, 0)
961
					else return false end
962
				else return false end
963
				wait()
964
			end
965
		end))
966
		for i = 0, 1, 0.05 do
967
			if Player.Character:FindFirstChild("Torso") ~= nil then
968
				if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
969
					Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new(1.5, 0.5, -0.25 * i) * CFrame.fromEulerAnglesXYZ(math.rad(-90) * i, 0, math.rad(-20) * i)
970
					Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(0, 0.5, 0)
971
				else return false end
972
			else return false end
973
			wait()
974
		end
975
		removeParts("RightHolster")
976
		makeParts("RightHand")
977
		for i = 0, 1, 0.05 do
978
			if Player.Character:FindFirstChild("Torso") ~= nil then
979
				if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
980
					Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new(1.5 * (1 - i), 0.5 * (1 - i), -0.25 * (1 - i)) * CFrame.fromEulerAnglesXYZ(math.rad(-90) * (1 - i), 0, math.rad(-20) * (1 - i)) * CFrame.new(1.25 * i, 0.5 * i, 0) * CFrame.fromEulerAnglesXYZ(math.rad(90) * i, 0, 0)
981
					Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(0, 0.5 * (1 - i), 0) * CFrame.new(0, 0.75 * i, 0.1 * i)
982
				else return false end
983
			else return false end
984
			if Player.Character:FindFirstChild(Name) ~= nil then
985
				if Player.Character[Name]:FindFirstChild("Handle") ~= nil then
986
					Player.Character[Name].Handle.Weld.C0 = CFrame.new(0, 1.5, 0.75)
987
					Player.Character[Name].Handle.Weld.C1 = CFrame.fromEulerAnglesXYZ(math.rad(-90) * (1 - i), 0, 0)
988
				else return false end
989
			else return false end
990
			wait()
991
		end
992
		makeParts("RightHolster")
993
		removeParts("RightHand")
994
		return playAnimation("hold")
995
	end
996
	if format == "unequip" then
997
		Player.Character.Humanoid.WalkSpeed = 16
998
		coroutine.resume(coroutine.create(function()
999
			for i = 1, 0, -0.025 do
1000
				if Player.Character:FindFirstChild("Torso") ~= nil then
1001
					if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
1002
						Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new(-1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(math.rad(90) * i, 0, math.rad(67.5) * i)
1003
						Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new(0, 0.5 * (1 - i), 0) * CFrame.new(0, 1.85 * i, 0)
1004
					else return false end
1005
				else return false end
1006
				wait()
1007
			end
1008
		end))
1009
		for i = 1, 0, -0.05 do
1010
			if Player.Character:FindFirstChild("Torso") ~= nil then
1011
				if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
1012
					Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new(1.5 * (1 - i), 0.5 * (1 - i), -0.25 * (1 - i)) * CFrame.fromEulerAnglesXYZ(math.rad(-90) * (1 - i), 0, math.rad(-20) * (1 - i)) * CFrame.new(1.25 * i, 0.5 * i, 0) * CFrame.fromEulerAnglesXYZ(math.rad(90) * i, 0, 0)
1013
					Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(0, 0.5 * (1 - i), 0) * CFrame.new(0, 0.75 * i, 0.1 * i)
1014
				else return false end
1015
			else return false end
1016
			if Player.Character:FindFirstChild(Name) ~= nil then
1017
				if Player.Character[Name]:FindFirstChild("Handle") ~= nil then
1018
					Player.Character[Name].Handle.Weld.C0 = CFrame.new(0, 1.5, 0.75)
1019
					Player.Character[Name].Handle.Weld.C1 = CFrame.fromEulerAnglesXYZ(math.rad(-90) * (1 - i), 0, 0)
1020
				else return false end
1021
			else return false end
1022
			wait()
1023
		end
1024
		makeParts("RightHolster")
1025
		removeParts("RightHand")
1026
		for i = 1, 0, -0.05 do
1027
			if Player.Character:FindFirstChild("Torso") ~= nil then
1028
				if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
1029
					Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new(1.5, 0.5, -0.25 * i) * CFrame.fromEulerAnglesXYZ(math.rad(-90) * i, 0, math.rad(-20) * i)
1030
					Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(0, 0.5, 0)
1031
				else return false end
1032
			else return false end
1033
			wait()
1034
		end
1035
		removeParts("RightHolster")
1036
		makeParts("RightHand")
1037
		return true
1038
	end
1039
	if format == "hold" then
1040
		if Player.Character:FindFirstChild("Torso") ~= nil then
1041
			if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
1042
				Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
1043
				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))
1044
				Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
1045
				Player.Character.Torso["Right Shoulder 2"].C1 =  CFrame.new(-0.9, -0.35, 0.51) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-5), 0)
1046
			else return false end
1047
		else return false end
1048
	end
1049
	if format == "reload" then
1050
		Player.Character[Name].Handle.Weld:Remove()
1051
		local w = Instance.new("Weld")
1052
		w.Part0 = Player.Character[Name].Handle
1053
		w.Part1 = Player.Character:FindFirstChild("Left Arm")
1054
		w.C0 = CFrame.new(-0.85, -0.5, 0.5) * CFrame.fromEulerAnglesXYZ(math.rad(-5), math.rad(90), 0)
1055
		w.C1 = CFrame.new() * CFrame.fromEulerAnglesXYZ(math.rad(50), 0, 0)
1056
		w.Parent = Player.Character[Name].Handle
1057
		if Player.Character:FindFirstChild("Torso") ~= nil then
1058
			if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
1059
				Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
1060
				Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new(-0.55, 1.2, 0.8) * CFrame.fromEulerAnglesXYZ(math.rad(300), math.rad(10), math.rad(-90))
1061
			else return false end
1062
		else return false end
1063
		wait(0.3)
1064
		for i = 0, 1, 0.1 do
1065
			if Player.Character:FindFirstChild("Torso") ~= nil then
1066
				if Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
1067
					Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
1068
					Player.Character.Torso["Right Shoulder 2"].C1 =  CFrame.new(-0.9 + (i / 10), -0.35 + (i * 1.5), 0.51 + (i / 8)) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-5), 0)
1069
					wait()
1070
				else return false end
1071
			else return false end
1072
		end
1073
		for i = 0, 1, 0.25 do
1074
			if Player.Character:FindFirstChild("Torso") ~= nil then
1075
				if Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
1076
					Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
1077
					Player.Character.Torso["Right Shoulder 2"].C1 =  CFrame.new(-0.8, 1.15 - (i / 5), 0.635) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-5), 0)
1078
					wait()
1079
				else return false end
1080
			else return false end
1081
		end
1082
		Player.Character[Name].Handle.Equip:Play()
1083
		if magazine.Value ~= 0 then
1084
			makeShell(Player.Character[Name]:FindFirstChild("ShellOut"))
1085
		else end
1086
		for i = 1, 0, -0.25 do
1087
			if Player.Character:FindFirstChild("Torso") ~= nil then
1088
				if Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
1089
					Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
1090
					Player.Character.Torso["Right Shoulder 2"].C1 =  CFrame.new(-0.8, 1.15 - (i / 5), 0.635) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-5), 0)
1091
					wait()
1092
				else return false end
1093
			else return false end
1094
		end
1095
		for i = 1, 0, -0.1 do
1096
			if Player.Character:FindFirstChild("Torso") ~= nil then
1097
				if Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
1098
					Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
1099
					Player.Character.Torso["Right Shoulder 2"].C1 =  CFrame.new(-0.9 + (i / 10), -0.35 + (i * 1.5), 0.51 + (i / 8)) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-5), 0)
1100
					wait()
1101
				else return false end
1102
			else return false end
1103
		end
1104
		removeParts("RightHand")
1105
		makeParts("RightHand")
1106
		wait(0.4)
1107
		Player.Character[Name].Handle.Lock:Play()
1108
		for i = 5, 0, -1 do
1109
			if Player.Character:FindFirstChild("Torso") ~= nil then
1110
				if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
1111
					Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
1112
					Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new(-0.55, 0.75, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(315 + (i * 1.5)), math.rad(i * 4), math.rad(-90))
1113
					wait()
1114
				else return false end
1115
			else return false end
1116
		end
1117
		Player.Character[Name].TopC.Transparency = 1
1118
		Player.Character[Name].TopO.Transparency = 0
1119
		Player.Character[Name].Top2C.Transparency = 1
1120
		Player.Character[Name].Top2O.Transparency = 0
1121
		wait(0.4)
1122
		Player.Character[Name].Handle.Reload:Play()
1123
		Player.Character[Name].Handle.Release:Play()
1124
		Player.Character[Name].Magazine.Transparency = 1
1125
		Player.Character[Name].Magazine2.Transparency = 1
1126
		magazineDrop = Player.Character[Name].Magazine:Clone()
1127
		magazineDrop.Transparency = 0
1128
		magazineDrop.CanCollide = true
1129
		magazineDrop.Parent = game.Workspace
1130
		coroutine.resume(coroutine.create(function(part) wait(4.5) for i = 0, 1, 0.1 do part.Transparency = i wait() end part:Remove() end), magazineDrop)
1131
		delay(0.1, function() magazineDrop.CanCollide = true end)
1132
		for i = 0, 25, 5 do
1133
			if Player.Character:FindFirstChild("Torso") ~= nil then
1134
				if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
1135
					Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
1136
					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))					
1137
					wait()
1138
				else return false end
1139
			else return false end
1140
		end
1141
		magazineNew = Player.Character[Name].Magazine:Clone()
1142
		magazineNew.Name = "New Magazine" 
1143
		magazineNew.Transparency = 0
1144
		magazineNew.Parent = Player.Character[Name]
1145
		local w = Instance.new("Weld")
1146
		w.Part0 = magazineNew
1147
		w.Part1 = Player.Character:FindFirstChild("Left Arm")
1148
		w.C0 = CFrame.new(0, 1.1, 0)
1149
		w.C1 = CFrame.new() * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
1150
		w.Parent = magazineNew
1151
		wait(0.2)
1152
		for i = 25, 0, -5 do
1153
			if Player.Character:FindFirstChild("Torso") ~= nil then
1154
				if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
1155
					Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
1156
					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))
1157
					Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
1158
					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)))
1159
					wait()
1160
				else return false end
1161
			else return false end
1162
		end
1163
		Player.Character[Name].Magazine.Transparency = 0
1164
		Player.Character[Name]["New Magazine"]:Remove()
1165
		wait(0.1)
1166
		if Player.Character:FindFirstChild("Torso") ~= nil then
1167
			if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
1168
				Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
1169
				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))
1170
				Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
1171
				Player.Character.Torso["Right Shoulder 2"].C1 =  CFrame.new(-0.9, -0.35, 0.51) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-5), 0)
1172
			else return false end
1173
		else return false end
1174
		Player.Character[Name].Handle.Reload:Stop()
1175
		wait(0.4)
1176
		Player.Character[Name].Handle.Empty:Play()
1177
		for i = 5, 0, -1 do
1178
			if Player.Character:FindFirstChild("Torso") ~= nil then
1179
				if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
1180
					Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
1181
					Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new(-0.55, 0.75, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(315 + (i * 1.5)), math.rad(i * 4), math.rad(-90))
1182
					wait()
1183
				else return false end
1184
			else return false end
1185
		end
1186
		Player.Character[Name].Magazine2.Transparency = 0
1187
		wait(0.4)
1188
		Player.Character[Name].Handle.Lock:Play()
1189
		for i = 5, 0, -1 do
1190
			if Player.Character:FindFirstChild("Torso") ~= nil then
1191
				if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
1192
					Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
1193
					Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new(-0.55, 0.75, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(315 + (i * 1.5)), math.rad(i * 4), math.rad(-90))
1194
					wait()
1195
				else return false end
1196
			else return false end
1197
		end
1198
		Player.Character[Name].TopC.Transparency = 0
1199
		Player.Character[Name].TopO.Transparency = 1
1200
		Player.Character[Name].Top2C.Transparency = 0
1201
		Player.Character[Name].Top2O.Transparency = 1		
1202
		playAnimation("hold")
1203
		return true
1204
	end
1205
	if format == "fire" then
1206
		makeShell(Player.Character[Name]:FindFirstChild("ShellOut"))
1207
		if magazine.Value == 0 then
1208
			Player.Character[Name].Magazine2.Transparency = 1
1209
		else end
1210
		if Player.Character[Name]:FindFirstChild("Handle") ~= nil then
1211
			if silenced then
1212
				Player.Character[Name].Handle.Fire2.Volume = math.random(3, 8) / 10
1213
				Player.Character[Name].Handle.Fire2.Pitch = math.random(2.4, 3)
1214
				Player.Character[Name].Handle.Fire2:Play()
1215
				CamShake(10, 90000)
1216
			else
1217
				Player.Character[Name].Handle.Fire.Volume = math.random(9, 10) / 10
1218
				Player.Character[Name].Handle.Fire.Pitch = math.random(1.6, 1.8)
1219
				Player.Character[Name].Handle.Fire:Play()
1220
				CamShake(10, 80000)
1221
			end
1222
		else return false end
1223
		if Player.Character[Name]:FindFirstChild("Muzzle") ~= nil then
1224
			if silenced == false then
1225
				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))
1226
			else end
1227
		else return false end
1228
		for i = 0, 10, 5 do
1229
			if Player.Character:FindFirstChild("Torso") ~= nil then
1230
				if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
1231
					Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
1232
					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))
1233
					Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
1234
					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)
1235
					wait()
1236
				else return false end
1237
			else return false end
1238
		end
1239
		for i = 10, 0, -5 do
1240
			if Player.Character:FindFirstChild("Torso") ~= nil then
1241
				if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
1242
					Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
1243
					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))
1244
					Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
1245
					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)
1246
					wait()
1247
				else return false end
1248
			else return false end
1249
		end
1250
	end
1251
	return true
1252
end
1253
1254
1255
function CamShake(time, freq)
1256
	coroutine.resume(coroutine.create(function()
1257
		local cam = game:GetService("Workspace").CurrentCamera
1258
		local time = 10
1259
		local seed = Vector3.new(math.random(100, 200) / freq, math.random(100, 200) / freq, 0)
1260
		if math.random(1, 2) == 1 then seed = Vector3.new(-seed.x, seed.y, 0) end
1261
		if math.random(1, 2) == 1 then seed = Vector3.new(seed.x, -seed.y, 0) end
1262
		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)
1263
		for i = 1, time do
1264
			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)
1265
			wait()
1266
		end
1267
	end))
1268
end
1269
1270
1271
function makeShell(part)
1272
	if part == nil then return false end
1273
	local casing = Instance.new("Part")
1274
	casing.Name = "Shell"
1275
	casing.formFactor = "Custom"
1276
	casing.Size = Vector3.new(0.2, 0.25, 0.2)
1277
	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)))
1278
	casing.BrickColor = BrickColor.new("New Yeller")
1279
	local mesh = Instance.new("CylinderMesh")
1280
	mesh.Scale = Vector3.new(0.3, 1, 0.3)
1281
	mesh.Parent = casing
1282
	casing.Parent = game:GetService("Workspace")
1283
	casing:BreakJoints()
1284
	casing.Velocity = (part.CFrame.lookVector * 50) + Vector3.new(0, 10, 0)
1285
	coroutine.resume(coroutine.create(function() wait(4.5) for i = 0, 1, 0.1 do casing.Transparency = i wait() end casing:Remove() end))
1286
end
1287
1288
1289
function Weld(x, y)
1290
	local weld = Instance.new("Weld")
1291
	weld.Part0 = x
1292
	weld.Part1 = y
1293
	CJ = CFrame.new(x.Position)
1294
	C0 = x.CFrame:inverse() * CJ
1295
	C1 = y.CFrame:inverse() * CJ
1296
	weld.C0 = C0
1297
	weld.C1 = C1
1298
	weld.Parent = x
1299
end
1300
1301
1302
function tagHumanoid(humanoid)
1303
	local tag = Instance.new("ObjectValue")
1304
	tag.Name = "creator"
1305
	tag.Value = Player
1306
	tag.Parent = humanoid
1307
	local tag = Instance.new("StringValue")
1308
	tag.Name = "creatorType1"
1309
	tag.Value = Name
1310
	tag.Parent = humanoid
1311
	local tag = Instance.new("StringValue")
1312
	tag.Name = "creatorType2"
1313
	tag.Value = "shot"
1314
	tag.Parent = humanoid
1315
end
1316
1317
1318
function untagHumanoid(humanoid)
1319
	if humanoid ~= nil then
1320
		local tag = humanoid:FindFirstChild("creator")
1321
		if tag ~= nil then
1322
			tag:Remove()
1323
		end
1324
		local tag = humanoid:FindFirstChild("creatorType1")
1325
		if tag ~= nil then
1326
			tag:Remove()
1327
		end
1328
		local tag = humanoid:FindFirstChild("creatorType2")
1329
		if tag ~= nil then
1330
			tag:Remove()
1331
		end
1332
	end
1333
end
1334
1335
1336
function fire(startPoint, endPoint, hit)
1337
	local trail = Instance.new("Part")
1338
	trail.Name = "Bullet Trail"
1339
	trail.BrickColor = BrickColor.new("New Yeller")
1340
	trail.TopSurface = 0
1341
	trail.BottomSurface = 0
1342
	trail.formFactor = 0
1343
	trail.Size = Vector3.new(1, 1, 1)
1344
	trail.Transparency = 0.8
1345
	trail.Anchored = true
1346
	trail.CanCollide = false
1347
	trail.CFrame = CFrame.new((startPoint + endPoint) / 2, endPoint)
1348
	trail.Parent = game:GetService("Workspace")
1349
	local mesh = Instance.new("SpecialMesh")
1350
	mesh.MeshType = "Brick"
1351
	mesh.Scale = Vector3.new(0.1, 0.1, (startPoint - endPoint).magnitude)
1352
	mesh.Parent = trail
1353
	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)
1354
	if hit ~= nil then
1355
		if hit.Parent == nil then return end
1356
		if hit.Parent:FindFirstChild("Humanoid") ~= nil then
1357
			tagHumanoid(hit.Parent.Humanoid)
1358
			if hit.Name == "Head" then
1359
				hit.Parent.Humanoid:TakeDamage(damage * 10)
1360
			elseif hit.Name == "Torso" then
1361
				hit.Parent.Humanoid:TakeDamage(damage * 2)
1362
			else
1363
				hit.Parent.Humanoid:TakeDamage(damage)
1364
			end
1365
			if math.random(1, 10) == 1 then
1366
				hit.Parent.Humanoid.Sit = true
1367
			end
1368
			delay(0.1, function() untagHumanoid(hit.Parent.Humanoid) end)
1369
		end
1370
		if hit.Anchored == false then
1371
			hit.Velocity = hit.Velocity + ((endPoint - startPoint).unit * (damage * 2))
1372
		end
1373
	end
1374
end
1375
1376
1377
function onButton1Down(mouse)
1378
	if selected == false then return end
1379
	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
1380
		if Player.Character[Name]:FindFirstChild("Handle") == nil then return end
1381
		if Player.Character[Name]:FindFirstChild("Muzzle") == nil then return end
1382
		if dual == true then if Player.Character[Name.. " (Left)"]:FindFirstChild("Handle") == nil then return end end
1383
		if dual == true then if Player.Character[Name.. " (Left)"]:FindFirstChild("Muzzle") == nil then return end end
1384
		mouse.Icon = "http://www.roblox.com/asset/?id=59125642"
1385
		Button1Down = true
1386
		canFire = false
1387
		canFire2 = true
1388
		while canFire2 == true do
1389
			local humanoid = Player.Character:FindFirstChild("Humanoid")
1390
			if humanoid == nil then
1391
				canFire2 = false
1392
				break
1393
			end
1394
			if humanoid.Health <= 0 then
1395
				canFire2 = false
1396
				break
1397
			end
1398
			local fireLeft = false
1399
			if automatic == false and burst == false then
1400
				canFire2 = false
1401
			elseif automatic == false and burst == true then
1402
				if burstCount >= burstCountMax then
1403
					canFire2 = false
1404
					burstCount = 0
1405
					break
1406
				end
1407
				burstCount = burstCount + 1
1408
			elseif automatic == true and burst == false then
1409
				fireLeft = true
1410
			end
1411
			if magazine.Value > 0 then
1412
				magazine.Value = magazine.Value - 1
1413
				updateGui()
1414
				if silenced == true then
1415
					CamShake(1, Spread)
1416
				else end		
1417
				fire(Player.Character[Name].Muzzle.Position, mouse.Hit.p, mouse.Target)
1418
				coroutine.resume(coroutine.create(function()
1419
					if dual == true then
1420
						playAnimation("rightFire")
1421
					elseif dual == false then
1422
						playAnimation("fire")
1423
					end
1424
				end))
1425
			else
1426
				Player.Character[Name].Handle.Empty:Play()
1427
			end
1428
			if fireLeft == true and dual == true and automatic == true then
1429
				if magazine.Value > 0 then
1430
					coroutine.resume(coroutine.create(function()
1431
						wait(readyTime / 2)
1432
						magazine.Value = magazine.Value - 1
1433
						updateGui()
1434
						fire(Player.Character[Name.. " (Left)"].Muzzle.Position, mouse.Hit.p, mouse.Target)
1435
						playAnimation("leftFire")
1436
					end))
1437
				else
1438
					coroutine.resume(coroutine.create(function()
1439
						wait(readyTime / 2)
1440
						Player.Character[Name].Handle.Empty:Play()
1441
					end))
1442
				end
1443
			end
1444
			wait(readyTime)
1445
		end
1446
		if magazine.Value ~= 0 then
1447
			mouse.Icon = "http://www.roblox.com/asset/?id=59125633"
1448
		else end
1449
		canFire = true
1450
	end
1451
end
1452
1453
1454
function onButton1Up(mouse)
1455
	if selected == false then return end
1456
	Button1Down = false
1457
	canFire2 = false
1458
	burstCount = 0
1459
	while canFire == false do wait() end
1460
	if dual == true and automatic == false then
1461
		if Player.Character[Name.. " (Left)"]:FindFirstChild("Handle") == nil then return end
1462
		if Player.Character[Name.. " (Left)"]:FindFirstChild("Muzzle") == nil then return end
1463
		mouse.Icon = "http://www.roblox.com/asset/?id=59125642"
1464
		canFire = false
1465
		canFire2 = true
1466
		while canFire2 == true do
1467
			local humanoid = Player.Character:FindFirstChild("Humanoid")
1468
			if humanoid == nil then
1469
				canFire2 = false
1470
				break
1471
			end
1472
			if humanoid.Health <= 0 then
1473
				canFire2 = false
1474
				break
1475
			end
1476
			if burst == false then
1477
				canFire2 = false
1478
			elseif burst == true then
1479
				if burstCount >= burstCountMax then
1480
					canFire2 = false
1481
					burstCount = 0
1482
					break
1483
				end
1484
				burstCount = burstCount + 1
1485
			end
1486
			if magazine.Value <= 0 then
1487
				Player.Character[Name].Handle.Empty:Play()
1488
			else
1489
				coroutine.resume(coroutine.create(function()
1490
					playAnimation("leftFire")
1491
				end))
1492
				magazine.Value = magazine.Value - 1
1493
				updateGui()
1494
				fire(Player.Character[Name.. " (Left)"].Muzzle.Position, mouse.Hit.p, mouse.Target)
1495
			end
1496
			wait(readyTime)
1497
		end
1498
		if magazine.Value ~= 0 then
1499
			mouse.Icon = "http://www.roblox.com/asset/?id=59125633"
1500
		else end
1501
		canFire = true
1502
	end
1503
end
1504
1505
1506
function onKeyDown(key, mouse)
1507
	if selected == false then return end
1508
	key = key:lower()
1509
	if key == "q" and Button1Down == false and canFire == true then
1510
		if mouse.Target == nil then return end
1511
		if game:GetService("Players"):GetPlayerFromCharacter(mouse.Target.Parent) ~= nil then
1512
			if dual == true then onKeyDown("t", mouse) end
1513
			onDeselected(mouse)
1514
			removeParts("RightHolster")
1515
			script.Parent.Parent = game:GetService("Players"):GetPlayerFromCharacter(mouse.Target.Parent).Backpack
1516
		end
1517
	end
1518
	if key == "e" and Button1Down == false and canFire == true and canSilence == true then
1519
		if silenced then
1520
			silenced = false
1521
			if Player.Character:FindFirstChild(Name) == nil then return end
1522
			if Player.Character[Name]:FindFirstChild("Muzzle") == nil then return end
1523
			if Player.Character[Name]:FindFirstChild("Muzzle 2") == nil then return end
1524
			Player.Character[Name].Muzzle.Transparency = 1
1525
			Player.Character[Name].Muzzle.Name = "Silencer"
1526
			Player.Character[Name]["Muzzle 2"].Name = "Muzzle"
1527
			if dual == true then
1528
				if Player.Character[Name.. " (Left)"]:FindFirstChild("Muzzle") == nil then return end
1529
				if Player.Character[Name.. " (Left)"]:FindFirstChild("Muzzle 2") == nil then return end
1530
				Player.Character[Name.. " (Left)"].Muzzle.Transparency = 1
1531
				Player.Character[Name.. " (Left)"].Muzzle.Name = "Silencer"
1532
				Player.Character[Name.. " (Left)"]["Muzzle 2"].Name = "Muzzle"
1533
			end
1534
		else
1535
			silenced = true
1536
			if Player.Character:FindFirstChild(Name) == nil then return end
1537
			if Player.Character[Name]:FindFirstChild("Silencer") == nil then return end
1538
			if Player.Character[Name]:FindFirstChild("Muzzle") == nil then return end
1539
			Player.Character[Name].Silencer.Transparency = 0
1540
			Player.Character[Name].Muzzle.Name = "Muzzle 2"
1541
			Player.Character[Name].Silencer.Name = "Muzzle"
1542
			if dual == true then
1543
				if Player.Character[Name.. " (Left)"]:FindFirstChild("Silencer") == nil then return end
1544
				if Player.Character[Name.. " (Left)"]:FindFirstChild("Muzzle") == nil then return end
1545
				Player.Character[Name.. " (Left)"].Silencer.Transparency = 0
1546
				Player.Character[Name.. " (Left)"].Muzzle.Name = "Muzzle 2"
1547
				Player.Character[Name.. " (Left)"].Silencer.Name = "Muzzle"
1548
			end
1549
		end
1550
	end
1551
	if key == "r" and Button1Down == false and canFire == true then
1552
		if ammo.Value > 0 and magazine.Value ~= magazineMax.Value then
1553
			canFire = false
1554
			burstCount = 0
1555
			mouse.Icon = "http://www.roblox.com/asset/?id=59125642"
1556
			if magazine.Value > 0 then ammo.Value = ammo.Value + magazine.Value magazine.Value = 0 end
1557
			updateGui()
1558
			if dual == true then
1559
				playAnimation("reloadDual")
1560
			elseif dual == false then
1561
				playAnimation("reload")
1562
			end
1563
			if ammo.Value - magazineMax.Value < 0 then
1564
				magazine.Value = ammo.Value
1565
				ammo.Value = 0
1566
			elseif ammo.Value - magazineMax.Value >= 0 then
1567
				ammo.Value = ammo.Value - magazineMax.Value
1568
				magazine.Value = magazine.Value + magazineMax.Value
1569
			end
1570
			updateGui()
1571
			mouse.Icon = "http://www.roblox.com/asset/?id=59125633"
1572
			canFire = true
1573
		end
1574
	end
1575
	if key == "t" and Button1Down == false and canFire == true and canDual == true then
1576
		canFire = false
1577
		if dual == false then
1578
			local weapon = nil
1579
			for _, p in pairs(Player.Backpack:GetChildren()) do
1580
				if p.Name == Name and p ~= script.Parent then weapon = p break end
1581
			end
1582
			if weapon ~= nil then
1583
				dual = true
1584
				weapon.Name = "Dual"
1585
				weapon.Parent = script
1586
				silenced = false
1587
				removeParts("RightHand")
1588
				makeParts("RightHand")
1589
				removeParts("RightHolster")
1590
				makeParts("LeftHolster")
1591
				playAnimation("leftEquip")
1592
				removeParts("LeftHolster")
1593
				makeParts("LeftHand")
1594
				magazineMax.Value = math.ceil(magazineMax.Value * 2)
1595
				ammoMax.Value = math.ceil(ammoMax.Value * 2)
1596
				magazine.Value = magazine.Value + weapon.Magazine.Value
1597
				ammo.Value = ammo.Value + weapon.Ammo.Value
1598
				updateGui()
1599
			end
1600
		elseif dual == true then
1601
			local weapon = script:FindFirstChild("Dual")
1602
			if weapon ~= nil then
1603
				dual = false
1604
				weapon.Name = Name
1605
				weapon.Parent = Player.Backpack
1606
				silenced = false
1607
				removeParts("RightHand")
1608
				makeParts("RightHand")
1609
				playAnimation("leftUnequip")
1610
				removeParts("LeftHand")
1611
				makeParts("RightHolster")
1612
				playAnimation("hold")
1613
				weapon.Magazine.Value = math.floor(magazine.Value / 2)
1614
				weapon.Ammo.Value = math.floor(ammo.Value / 2)
1615
				magazineMax.Value = math.ceil(magazineMax.Value / 2)
1616
				ammoMax.Value = math.ceil(ammoMax.Value / 2)
1617
				magazine.Value = math.ceil(magazine.Value / 2)
1618
				ammo.Value = math.ceil(ammo.Value / 2)
1619
				updateGui()
1620
			end
1621
		end
1622
		canFire = true
1623
	end
1624
	if key == "y" and canZoom == true then
1625
		if zoom == false then
1626
			zoom = true
1627
			local pos = mouse.Hit.p
1628
			local target = mouse.Target
1629
			local cam = game:GetService("Workspace").CurrentCamera
1630
			focus = Instance.new("Part", workspace)
1631
			focus.Anchored = true
1632
			focus.CanCollide = false
1633
			focus.Transparency = 1
1634
			focus.TopSurface = 0
1635
			focus.BottomSurface = 0
1636
			focus.formFactor = "Plate"
1637
			focus.Size = Vector3.new(0, 0, 0)
1638
			focus.CFrame = CFrame.new(pos) * (CFrame.new(Player.Character.Torso.CFrame.p, pos) - CFrame.new(Player.Character.Torso.CFrame.p, pos).p)
1639
			cam.CameraSubject = focus
1640
			cam.CameraType = "Attach"
1641
			while zoom == true and selected == true do
1642
				local set = false
1643
				if target ~= nil then
1644
					if target.Parent ~= nil then
1645
						if target.Anchored == false then
1646
							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)
1647
							set = true
1648
						end
1649
					end
1650
				end
1651
				if set == false then
1652
					focus.CFrame = CFrame.new(pos) * (CFrame.new(Player.Character.Torso.CFrame.p, pos) - CFrame.new(Player.Character.Torso.CFrame.p, pos).p)
1653
				end
1654
				wait()
1655
			end
1656
			if focus ~= nil then focus:Remove() focus = nil end
1657
			local cam = game:GetService("Workspace").CurrentCamera
1658
			cam.CameraSubject = Player.Character:FindFirstChild("Humanoid")
1659
			cam.CameraType = "Custom"
1660
		else
1661
			zoom = false
1662
		end
1663
	end
1664
	if key == "u" and Button1Down == false and canFire == true then
1665
		if automatic == false and burst == false then
1666
			if switchToBurst == true then
1667
				burst = true
1668
				local m = Instance.new("Message", Player)
1669
				m.Text = "Burst"
1670
				pcall(function() Player.Character[Name].Handle.Switch:Play() end)
1671
				delay(2.5, function() m:Remove() end)
1672
			elseif switchToAutomatic == true then
1673
				automatic = true
1674
				local m = Instance.new("Message", Player)
1675
				m.Text = "Automatic"
1676
				pcall(function() Player.Character[Name].Handle.Switch:Play() end)
1677
				delay(2.5, function() m:Remove() end)
1678
			end
1679
		elseif automatic == false and burst == true then
1680
			if switchToAutomatic == true then
1681
				automatic = true
1682
				burst = false
1683
				local m = Instance.new("Message", Player)
1684
				m.Text = "Automatic"
1685
				pcall(function() Player.Character[Name].Handle.Switch:Play() end)
1686
				delay(2.5, function() m:Remove() end)
1687
			elseif switchToSingle == true then
1688
				burst = false
1689
				local m = Instance.new("Message", Player)
1690
				m.Text = "Single"
1691
				pcall(function() Player.Character[Name].Handle.Switch:Play() end)
1692
				delay(2.5, function() m:Remove() end)
1693
			end
1694
		elseif automatic == true and burst == false then
1695
			if switchToSingle == true then
1696
				automatic = false
1697
				local m = Instance.new("Message", Player)
1698
				m.Text = "Single"
1699
				pcall(function() Player.Character[Name].Handle.Switch:Play() end)
1700
				delay(2.5, function() m:Remove() end)
1701
			elseif switchToBurst == true then
1702
				automatic = false
1703
				burst = true
1704
				local m = Instance.new("Message", Player)
1705
				m.Text = "Burst"
1706
				pcall(function() Player.Character[Name].Handle.Switch:Play() end)
1707
				delay(2.5, function() m:Remove() end)
1708
			end
1709
		end
1710
	end
1711
end
1712
1713
1714
function onSelected(mouse)
1715
	if selected == true then return end
1716
	selected = true
1717
	Holstered = false
1718
	canFire = false
1719
	mouse.Icon = "http://www.roblox.com/asset/?id=59125642"
1720
	while Player.Character:FindFirstChild("WeaponActivated") ~= nil do
1721
		if Player.Character.WeaponActivated.Value == nil then break end
1722
		if Player.Character.WeaponActivated.Value.Parent == nil then break end
1723
		wait()
1724
	end
1725
	updateGui()
1726
	local weapon = Instance.new("ObjectValue")
1727
	weapon.Name = "WeaponActivated"
1728
	weapon.Value = script.Parent
1729
	weapon.Parent = Player.Character
1730
	DisableLimb(1, Player.Character)
1731
	DisableLimb(2, Player.Character)
1732
	ForceAngle(1, 0, Player.Character)
1733
	ForceAngle(2, 0, Player.Character)
1734
	if dual == true then
1735
		coroutine.resume(coroutine.create(function() playAnimation("leftEquip") end))
1736
		playAnimation("rightEquip")
1737
		removeParts("LeftHolster")
1738
		makeParts("LeftHand")
1739
	else
1740
		playAnimation("equip")
1741
	end
1742
	removeParts("RightHolster")
1743
	makeParts("RightHand")
1744
	mouse.Button1Down:connect(function() onButton1Down(mouse) end)
1745
	mouse.Button1Up:connect(function() onButton1Up(mouse) end)
1746
	mouse.KeyDown:connect(function(key) onKeyDown(key, mouse) end)
1747
	mouse.Icon = "http://www.roblox.com/asset/?id=59125633"
1748
	canFire = true
1749
end
1750
1751
1752
function onDeselected(mouse)
1753
	if selected == false then return end
1754
	Holstered = true
1755
	Button1Down = false
1756
	while canFire == false do
1757
		wait()
1758
	end
1759
	selected = false
1760
	if dual == true then
1761
		if math.random(1, 2) == 1 then
1762
			coroutine.resume(coroutine.create(function() playAnimation("leftUnequip") end))
1763
			wait(math.random(1, 10) / 10)
1764
			playAnimation("rightUnequip")
1765
		else
1766
			coroutine.resume(coroutine.create(function() playAnimation("rightUnequip") end))
1767
			wait(math.random(1, 10) / 10)
1768
			playAnimation("leftUnequip")
1769
		end
1770
		removeParts("LeftHand")
1771
		makeParts("LeftHolster")
1772
	else
1773
		playAnimation("unequip")
1774
	end
1775
	removeParts("RightHand")
1776
	makeParts("RightHolster")
1777
	ForceAngle(1, 0, Player.Character)
1778
	ForceAngle(2, 0, Player.Character)
1779
	ResetLimbCFrame(1, Player.Character)
1780
	ResetLimbCFrame(2, Player.Character)
1781
	EnableLimb(1, Player.Character)
1782
	EnableLimb(2, Player.Character)
1783
	if Player.PlayerGui:FindFirstChild(Name) ~= nil then Player.PlayerGui[Name]:Remove() end
1784
	if Player.Character:FindFirstChild("WeaponActivated") ~= nil then
1785
		if Player.Character.WeaponActivated.Value == script.Parent then
1786
			Player.Character.WeaponActivated:Remove()
1787
		end
1788
	end
1789
	while Player.Character:FindFirstChild("WeaponActivated") ~= nil do
1790
		if Player.Character.WeaponActivated.Value == nil then break end
1791
		if Player.Character.WeaponActivated.Value.Parent == nil then break end
1792
		wait()
1793
	end
1794
end
1795
1796
1797
if script.Parent.className ~= "HopperBin" then
1798
	if Player == nil then print("Error: Player not found!") return end
1799
	Tool = Instance.new("HopperBin")
1800
	Tool.Name = Name
1801
	Tool.Parent = Player.Backpack
1802
	script.Name = "Main"
1803
	script.Parent = Tool
1804
elseif script.Parent.className == "HopperBin" then
1805
	while script.Parent.Parent.className ~= "Backpack" do
1806
		wait()
1807
	end
1808
	if script.Parent:FindFirstChild("MagazineMax") == nil then
1809
		magazineMax = Instance.new("NumberValue")
1810
		magazineMax.Name = "MagazineMax"
1811
		magazineMax.Value = 50
1812
		magazineMax.Parent = script.Parent
1813
	else
1814
		magazineMax = script.Parent.MagazineMax
1815
	end
1816
	if script.Parent:FindFirstChild("Magazine") == nil then
1817
		magazine = Instance.new("NumberValue")
1818
		magazine.Name = "Magazine"
1819
		magazine.Value = 0
1820
		magazine.Parent = script.Parent
1821
	else
1822
		magazine = script.Parent.Magazine
1823
	end
1824
	if script.Parent:FindFirstChild("AmmoMax") == nil then
1825
		ammoMax = Instance.new("NumberValue")
1826
		ammoMax.Name = "AmmoMax"
1827
		ammoMax.Value = 200
1828
		ammoMax.Parent = script.Parent
1829
	else
1830
		ammoMax = script.Parent.AmmoMax
1831
	end
1832
	if script.Parent:FindFirstChild("Ammo") == nil then
1833
		ammo = Instance.new("NumberValue")
1834
		ammo.Name = "Ammo"
1835
		ammo.Value = script.Parent.AmmoMax.Value
1836
		ammo.Parent = script.Parent
1837
	else
1838
		ammo = script.Parent.Ammo
1839
	end
1840
	Player = script.Parent.Parent.Parent
1841
	makeParts("RightHolster")
1842
	script.Parent.Selected:connect(onSelected)
1843
	script.Parent.Deselected:connect(onDeselected)
1844
end