View difference between Paste ID: mybuyPc2 and CgGmff4s
SHOW: | | - or go back to the newest paste.
1-
Player = game:GetService("Players"):FindFirstChild("myalt1562")
1+
Player = game:GetService("Players"):FindFirstChild("LocalPlayer")
2
Name = "AK-47"
3
selected = false
4
canDual = false
5
dual = false
6
Button1Down = false
7
damage = 40
8
canFire = true
9
canFire2 = false
10
readyTime = 0.040
11
automatic = true
12
burst = false
13
burstCount = 0
14
burstCountMax = 7
15
canSilence = true
16
silenced = false
17
canZoom = false
18
zoom = false
19
switchToSingle = true
20
switchToBurst = false
21
switchToAutomatic = true
22
23
24
ammoGui = Instance.new("ScreenGui")
25
ammoGui.Name = Name
26
local frame = Instance.new("Frame")
27
frame.Name = "Frame"
28
frame.Size = UDim2.new(0, 165, 0, 60)
29
frame.Position = UDim2.new(0, 0, 1, -60)
30
frame.BackgroundColor3 = Color3.new(1, 1, 1)
31
frame.BorderColor3 = Color3.new(0, 0, 0)
32
frame.Parent = ammoGui
33
local label = Instance.new("TextLabel")
34
label.Name = "Weapon"
35
label.Text = "Weapon: " ..Name
36
label.Size = UDim2.new(1, 0, 0, 20)
37
label.Position = UDim2.new(0, 0, 0, 0)
38
label.BackgroundColor3 = Color3.new(1, 0, 0)
39
label.BorderColor3 = Color3.new(0, 0, 0)
40
label.Parent = frame
41
local label = Instance.new("TextLabel")
42
label.Name = "MagazinePrefix"
43
label.Text = " Magazine:"
44
label.TextXAlignment = "Left"
45
label.Size = UDim2.new(1, 0, 0, 20)
46
label.Position = UDim2.new(0, 0, 0, 20)
47
label.BackgroundColor3 = Color3.new(1, 1, 1)
48
label.BorderColor3 = Color3.new(0, 0, 0)
49
label.Parent = frame
50
local label = Instance.new("TextLabel")
51
label.Name = "Magazine"
52
label.Text = "0/0"
53
label.TextXAlignment = "Right"
54
label.Size = UDim2.new(1, 0, 0, 20)
55
label.Position = UDim2.new(0, -10, 0, 20)
56
label.BackgroundTransparency = 1
57
label.BorderSizePixel = 0
58
label.Parent = frame
59
local label = Instance.new("TextLabel")
60
label.Name = "AmmoPrefix"
61
label.Text = " Ammunition:"
62
label.TextXAlignment = "Left"
63
label.Size = UDim2.new(1, 0, 0, 20)
64
label.Position = UDim2.new(0, 0, 0, 40)
65
label.BackgroundColor3 = Color3.new(1, 1, 1)
66
label.BorderColor3 = Color3.new(0, 0, 0)
67
label.Parent = frame
68
local label = Instance.new("TextLabel")
69
label.Name = "Ammo"
70
label.Text = "0/0"
71
label.TextXAlignment = "Right"
72
label.Size = UDim2.new(1, 0, 0, 20)
73
label.Position = UDim2.new(0, -10, 0, 40)
74
label.BackgroundTransparency = 1
75
label.BorderSizePixel = 0
76
label.Parent = frame
77
78
79
function updateGui()
80
if selected == false then return end
81
if Player:FindFirstChild("PlayerGui") == nil then Instance.new("PlayerGui").Parent = Player end
82
if Player.PlayerGui:FindFirstChild(Name) == nil then
83
ammoGui:Clone().Parent = Player.PlayerGui
84
end
85
Player.PlayerGui[Name].Frame.Magazine.Text = tostring(magazine.Value).. "/" ..tostring(magazineMax.Value)
86
Player.PlayerGui[Name].Frame.Ammo.Text = tostring(ammo.Value).. "/" ..tostring(ammoMax.Value)
87
end
88
89
90
function makeParts(format)
91
local model = Instance.new("Model")
92
model.Name = Name
93
local pm = Instance.new("Part")
94
pm.Name = "Handle"
95
pm.FormFactor = "Custom"
96
pm.Size = Vector3.new(1, 1, 1)
97
pm.BrickColor = BrickColor.new("Navy blue")
98
pm.Locked = true
99
pm.TopSurface = 0
100
pm.BottomSurface = 0
101
pm.Parent = model
102
local m = Instance.new("SpecialMesh")
103
m.MeshType = "Brick"
104
m.Scale = Vector3.new(0.3, 1.25, 0.5)
105
m.Parent = pm
106
if format ~= nil then
107
local w = Instance.new("Weld")
108
w.Part0 = pm
109
if format == "RightHand" then
110
w.Part1 = Player.Character:FindFirstChild("Right Arm")
111
w.C0 = CFrame.new(0, 1.4, 0.8)
112
w.C1 = CFrame.new()
113
elseif format == "RightHolster" then
114
w.Part1 = Player.Character:FindFirstChild("Torso")
115
w.C0 = CFrame.new(-0.65, -0.1, 0.85) * CFrame.fromEulerAnglesXYZ(math.rad(10), math.rad(90), 0)
116
w.C1 = CFrame.new()
117
model.Name = Name.. " (Holstered)"
118
end
119
w.Parent = pm
120
model.Parent = Player.Character
121
end
122
--[[
123
sniper1 http://www.roblox.com/Asset/?id=1868836
124
equip http://www.roblox.com/Asset/?id=13510737
125
fire1 http://www.roblox.com/Asset/?id=2760979
126
fire2 http://www.roblox.com/Asset/?id=13510352
127
fire3 http://www.roblox.com/Asset/?id=2692806
128
fire4 http://www.roblox.com/Asset/?id=2691586
129
fire5 http://www.roblox.com/Asset/?id=2920959
130
fire6 http://www.roblox.com/Asset/?id=2697431
131
fire7 http://www.roblox.com/Asset/?id=2920959
132
reload1 http://www.roblox.com/Asset/?id=2691591
133
reload2 http://www.roblox.com/Asset/?id=2697432
134
reload3 http://www.roblox.com/Asset/?id=2920960
135
reload4 http://www.roblox.com/Asset/?id=2761842
136
shotgun1 http://www.roblox.com/Asset/?id=2697294
137
--]]
138
local s = Instance.new("Sound")
139
s.Name = "Fire"
140
s.SoundId = "http://www.roblox.com/Asset/?id=2760979"
141
s.Volume = 1
142
s.Pitch = 1
143
s.Looped = false
144
s.Parent = pm
145
local s = Instance.new("Sound")
146
s.Name = "Reload"
147
s.SoundId = "http://www.roblox.com/Asset/?id=2697432"
148
s.Volume = 1
149
s.Pitch = 1
150
s.Looped = false
151
s.Parent = pm
152
local s = Instance.new("Sound")
153
s.Name = "Empty"
154
s.SoundId = "http://www.roblox.com/Asset/?id=2697295"
155
s.Volume = 1
156
s.Pitch = 5
157
s.Looped = false
158
s.Parent = pm
159
local s = Instance.new("Sound")
160
s.Name = "Switch"
161
s.SoundId = "http://www.roblox.com/Asset/?id=2697295"
162
s.Volume = 1
163
s.Pitch = 10
164
s.Looped = false
165
s.Parent = pm
166
local p = Instance.new("Part")
167
p.Name = "ShellOut"
168
p.FormFactor = "Custom"
169
p.Size = Vector3.new(1, 1, 1)
170
p.Transparency = 1
171
p.Locked = true
172
p.CanCollide = false
173
p.TopSurface = 0
174
p.BottomSurface = 0
175
p.Parent = model
176
local w = Instance.new("Weld")
177
w.Part0 = p
178
w.Part1 = pm
179
w.C0 = CFrame.new(0, 0, 1) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
180
w.C1 = CFrame.new()
181
w.Parent = p
182
local p = Instance.new("Part")
183
p.Name = "Grip"
184
p.FormFactor = "Custom"
185
p.Size = Vector3.new(1, 1, 1)
186
p.BrickColor = BrickColor.new("Navy blue")
187
p.Locked = true
188
p.TopSurface = 0
189
p.BottomSurface = 0
190
p.Parent = model
191
local m = Instance.new("SpecialMesh")
192
m.MeshType = "Brick"
193
m.Scale = Vector3.new(0.29, 0.5, 0.9)
194
m.Parent = p
195
local w = Instance.new("Weld")
196
w.Part0 = p
197
w.Part1 = pm
198
w.C0 = CFrame.new(0, -0.25, -0.6) * CFrame.fromEulerAnglesXYZ(math.rad(15), 0, 0)
199
w.C1 = CFrame.new()
200
w.Parent = p
201
local p = Instance.new("Part")
202
p.Name = "Magazine Housing"
203
p.FormFactor = "Custom"
204
p.Size = Vector3.new(1, 1, 1)
205
p.BrickColor = BrickColor.new("Navy blue")
206
p.Locked = true
207
p.TopSurface = 0
208
p.BottomSurface = 0
209
p.Parent = model
210
local m = Instance.new("SpecialMesh")
211
m.MeshType = "Brick"
212
m.Scale = Vector3.new(0.3, 0.6, 0.3)
213
m.Parent = p
214
local w = Instance.new("Weld")
215
w.Part0 = p
216
w.Part1 = pm
217
w.C0 = CFrame.new(0, 0.525, -0.31) * CFrame.fromEulerAnglesXYZ(math.rad(-10), 0, 0)
218
w.C1 = CFrame.new()
219
w.Parent = p
220
local p = Instance.new("Part")
221
p.Name = "Magazine"
222
p.FormFactor = "Custom"
223
p.Size = Vector3.new(1, 1, 1)
224
p.BrickColor = BrickColor.new("Navy blue")
225
p.Locked = true
226
p.TopSurface = 0
227
p.BottomSurface = 0
228
p.Parent = model
229
local m = Instance.new("SpecialMesh")
230
m.MeshType = "Brick"
231
m.Scale = Vector3.new(0.25, 0.55, 1)
232
m.Parent = p
233
local w = Instance.new("Weld")
234
w.Part0 = p
235
w.Part1 = pm
236
w.C0 = CFrame.new(0, 0.485, -0.9) * CFrame.fromEulerAnglesXYZ(math.rad(-15), 0, 0)
237
w.C1 = CFrame.new()
238
w.Parent = p
239
local p = Instance.new("Part")
240
p.Name = "Trigger Housing"
241
p.FormFactor = "Custom"
242
p.Size = Vector3.new(1, 1, 1)
243
p.BrickColor = BrickColor.new("Navy blue")
244
p.Locked = true
245
p.TopSurface = 0
246
p.BottomSurface = 0
247
p.Parent = model
248
local m = Instance.new("SpecialMesh")
249
m.MeshType = "Brick"
250
m.Scale = Vector3.new(0.1, 0.4, 0.025)
251
m.Parent = p
252
local w = Instance.new("Weld")
253
w.Part0 = p
254
w.Part1 = pm
255
w.C0 = CFrame.new(0, 0.1, -0.4)
256
w.C1 = CFrame.new()
257
w.Parent = p
258
local p = Instance.new("Part")
259
p.Name = "Trigger"
260
p.FormFactor = "Custom"
261
p.Size = Vector3.new(1, 1, 1)
262
p.BrickColor = BrickColor.new("Black")
263
p.Locked = true
264
p.TopSurface = 0
265
p.BottomSurface = 0
266
p.Parent = model
267
local m = Instance.new("SpecialMesh")
268
m.MeshType = "Brick"
269
m.Scale = Vector3.new(0.1, 0.05, 0.15)
270
m.Parent = p
271
local w = Instance.new("Weld")
272
w.Part0 = p
273
w.Part1 = pm
274
w.C0 = CFrame.new(0, 0.03, -0.275)
275
w.C1 = CFrame.new()
276
w.Parent = p
277
local p = Instance.new("Part")
278
p.Name = "Barrel 2"
279
p.CanCollide = false
280
p.FormFactor = "Custom"
281
p.Size = Vector3.new(1, 1, 1)
282
p.BrickColor = BrickColor.new("Navy blue")
283
p.Locked = true
284
p.TopSurface = 0
285
p.BottomSurface = 0
286
p.Parent = model
287
local m = Instance.new("SpecialMesh")
288
m.MeshType = "Brick"
289
m.Scale = Vector3.new(0.3, 1.1, 0.35)
290
m.Parent = p
291
local w = Instance.new("Weld")
292
w.Part0 = p
293
w.Part1 = pm
294
w.C0 = CFrame.new(0, 1.15, 0.075)
295
w.C1 = CFrame.new()
296
w.Parent = p
297
local p = Instance.new("Part")
298
p.Name = "Barrel 1"
299
p.FormFactor = "Custom"
300
p.Size = Vector3.new(1, 1, 1)
301
p.BrickColor = BrickColor.new("Black")
302
p.CanCollide = false
303
p.Locked = true
304
p.TopSurface = 0
305
p.BottomSurface = 0
306
p.Parent = model
307
local m = Instance.new("CylinderMesh")
308
m.Scale = Vector3.new(0.15, 0.6, 0.15)
309
m.Parent = p
310
local w = Instance.new("Weld")
311
w.Part0 = p
312
w.Part1 = pm
313
w.C0 = CFrame.new(0, 2, 0.075)
314
w.C1 = CFrame.new()
315
w.Parent = p
316
local p = Instance.new("Part")
317
p.Name = "Muzzle"
318
p.FormFactor = "Custom"
319
p.Size = Vector3.new(1, 1, 1)
320
p.BrickColor = BrickColor.new("Black")
321
p.CanCollide = false
322
p.Locked = true
323
p.TopSurface = 0
324
p.BottomSurface = 0
325
p.Parent = model
326
local m = Instance.new("CylinderMesh")
327
m.Scale = Vector3.new(0.2, 0.2, 0.2)
328
m.Parent = p
329
local w = Instance.new("Weld")
330
w.Part0 = p
331
w.Part1 = pm
332
w.C0 = CFrame.new(0, 2.4, 0.075)
333
w.C1 = CFrame.new()
334
w.Parent = p
335
local s = Instance.new("Smoke")
336
s.Enabled = false
337
s.Name = "Smoke"
338
s.RiseVelocity = -5
339
s.Opacity = 0.3
340
s.Color = Color3.new(75 / 225, 75 / 225, 75 / 225)
341
s.Size = 1
342
s.Parent = p
343
local f = Instance.new("Fire")
344
f.Enabled = false
345
f.Name = "Fire"
346
f.Heat = -35
347
f.Size = 1
348
f.Parent = p
349
local p = Instance.new("Part")
350
p.Name = "Silencer"
351
p.FormFactor = "Custom"
352
p.Size = Vector3.new(1, 1, 1)
353
p.BrickColor = BrickColor.new("Black")
354
p.CanCollide = false
355
p.Transparency = 1
356
p.Locked = true
357
p.TopSurface = 0
358
p.BottomSurface = 0
359
p.Parent = model
360
local m = Instance.new("CylinderMesh")
361
m.Scale = Vector3.new(0.4, 1, 0.4)
362
m.Parent = p
363
local w = Instance.new("Weld")
364
w.Part0 = p
365
w.Part1 = pm
366
w.C0 = CFrame.new(0, 2.8, 0.075)
367
w.C1 = CFrame.new()
368
w.Parent = p
369
local p = Instance.new("Part")
370
p.Name = "Stock 1"
371
p.CanCollide = false
372
p.FormFactor = "Custom"
373
p.Size = Vector3.new(1, 1, 1)
374
p.BrickColor = BrickColor.new("Navy blue")
375
p.Locked = true
376
p.TopSurface = 0
377
p.BottomSurface = 0
378
p.Parent = model
379
local m = Instance.new("SpecialMesh")
380
m.MeshType = "Brick"
381
m.Scale = Vector3.new(0.3, 0.9, 0.35)
382
m.Parent = p
383
local w = Instance.new("Weld")
384
w.Part0 = p
385
w.Part1 = pm
386
w.C0 = CFrame.new(0, -1.05, -0.1)
387
w.C1 = CFrame.new()
388
w.Parent = p
389
local p = Instance.new("Part")
390
p.Name = "Stock 1 Angle"
391
p.CanCollide = false
392
p.FormFactor = "Custom"
393
p.Size = Vector3.new(1, 1, 1)
394
p.BrickColor = BrickColor.new("Navy blue")
395
p.Locked = true
396
p.TopSurface = 0
397
p.BottomSurface = 0
398
p.Parent = model
399
local m = Instance.new("SpecialMesh")
400
m.MeshType = "Wedge"
401
m.Scale = Vector3.new(0.3, 0.9, 0.18)
402
m.Parent = p
403
local w = Instance.new("Weld")
404
w.Part0 = p
405
w.Part1 = pm
406
w.C0 = CFrame.new(0, -1.05, 0.1625)
407
w.C1 = CFrame.new()
408
w.Parent = p
409
local p = Instance.new("Part")
410
p.Name = "Stock 2"
411
p.CanCollide = false
412
p.FormFactor = "Custom"
413
p.Size = Vector3.new(1, 1, 1)
414
p.BrickColor = BrickColor.new("Navy blue")
415
p.Locked = true
416
p.TopSurface = 0
417
p.BottomSurface = 0
418
p.Parent = model
419
local m = Instance.new("SpecialMesh")
420
m.MeshType = "Brick"
421
m.Scale = Vector3.new(0.2, 0.5, 0.3)
422
m.Parent = p
423
local w = Instance.new("Weld")
424
w.Part0 = p
425
w.Part1 = pm
426
w.C0 = CFrame.new(0, -1.7, -0.1)
427
w.C1 = CFrame.new()
428
w.Parent = p
429
local p = Instance.new("Part")
430
p.Name = "Stock 2 Angle"
431
p.CanCollide = false
432
p.FormFactor = "Custom"
433
p.Size = Vector3.new(1, 1, 1)
434
p.BrickColor = BrickColor.new("Navy blue")
435
p.Locked = true
436
p.TopSurface = 0
437
p.BottomSurface = 0
438
p.Parent = model
439
local m = Instance.new("SpecialMesh")
440
m.MeshType = "Wedge"
441
m.Scale = Vector3.new(0.2, 0.5, 0.3)
442
m.Parent = p
443
local w = Instance.new("Weld")
444
w.Part0 = p
445
w.Part1 = pm
446
w.C0 = CFrame.new(0, -0.5, -1.8) * CFrame.fromEulerAnglesXYZ(math.rad(270), 0, math.rad(180))
447
w.C1 = CFrame.new()
448
w.Parent = p
449
local p = Instance.new("Part")
450
p.Name = "Stock 3"
451
p.CanCollide = false
452
p.FormFactor = "Custom"
453
p.Size = Vector3.new(1, 1, 1)
454
p.BrickColor = BrickColor.new("Navy blue")
455
p.Locked = true
456
p.TopSurface = 0
457
p.BottomSurface = 0
458
p.Parent = model
459
local m = Instance.new("SpecialMesh")
460
m.MeshType = "Brick"
461
m.Scale = Vector3.new(0.2, 0.05, 0.8)
462
m.Parent = p
463
local w = Instance.new("Weld")
464
w.Part0 = p
465
w.Part1 = pm
466
w.C0 = CFrame.new(0, -1.975, -0.349)
467
w.C1 = CFrame.new()
468
w.Parent = p
469
local p = Instance.new("Part")
470
p.Name = "Stock 4"
471
p.CanCollide = false
472
p.FormFactor = "Custom"
473
p.Size = Vector3.new(1, 1, 1)
474
p.BrickColor = BrickColor.new("Black")
475
p.Locked = true
476
p.TopSurface = 0
477
p.BottomSurface = 0
478
p.Parent = model
479
local m = Instance.new("SpecialMesh")
480
m.MeshType = "Brick"
481
m.Scale = Vector3.new(0.25, 0.05, 0.85)
482
m.Parent = p
483
local w = Instance.new("Weld")
484
w.Part0 = p
485
w.Part1 = pm
486
w.C0 = CFrame.new(0, -2.025, -0.349)
487
w.C1 = CFrame.new()
488
w.Parent = p
489
local p = Instance.new("Part")
490
p.Name = "Stock 4 Bottom"
491
p.CanCollide = false
492
p.FormFactor = "Custom"
493
p.Size = Vector3.new(1, 1, 1)
494
p.BrickColor = BrickColor.new("Black")
495
p.Locked = true
496
p.TopSurface = 0
497
p.BottomSurface = 0
498
p.Parent = model
499
local m = Instance.new("SpecialMesh")
500
m.MeshType = "Wedge"
501
m.Scale = Vector3.new(0.25, 0.1, 0.45)
502
m.Parent = p
503
local w = Instance.new("Weld")
504
w.Part0 = p
505
w.Part1 = pm
506
w.C0 = CFrame.new(0, -2.1, -0.55)
507
w.C1 = CFrame.new()
508
w.Parent = p
509
local p = Instance.new("Part")
510
p.Name = "Stock 4 Top"
511
p.CanCollide = false
512
p.FormFactor = "Custom"
513
p.Size = Vector3.new(1, 1, 1)
514
p.BrickColor = BrickColor.new("Black")
515
p.Locked = true
516
p.TopSurface = 0
517
p.BottomSurface = 0
518
p.Parent = model
519
local m = Instance.new("SpecialMesh")
520
m.MeshType = "Wedge"
521
m.Scale = Vector3.new(0.25, 0.1, 0.45)
522
m.Parent = p
523
local w = Instance.new("Weld")
524
w.Part0 = p
525
w.Part1 = pm
526
w.C0 = CFrame.new(0, -2.1, 0.15) * CFrame.fromEulerAnglesXYZ(math.rad(180), 0, math.rad(180))
527
w.C1 = CFrame.new()
528
w.Parent = p
529
return model
530
end
531
532
533
function removeParts(format)
534
if format == "RightHand" then
535
pcall(function() Player.Character[Name]:Remove() end)
536
elseif format == "LeftHand" then
537
pcall(function() Player.Character[Name.. " (Left)"]:Remove() end)
538
elseif format == "RightHolster" then
539
pcall(function() Player.Character[Name.. " (Holstered)"]:Remove() end)
540
elseif format == "LeftHolster" then
541
pcall(function() Player.Character[Name.. " (Holstered, Left)"]:Remove() end)
542
end
543
end
544
545
546
function SetAngle(Joint, Angle, Character)
547
if Character == nil then return false end
548
local Joints = {
549
Character.Torso:FindFirstChild("Right Shoulder 2"),
550
Character.Torso:FindFirstChild("Left Shoulder 2"),
551
Character.Torso:FindFirstChild("Right Hip 2"),
552
Character.Torso:FindFirstChild("Left Hip 2")
553
}
554
if Joints[Joint] == nil then return false end
555
if Joint == 1 or Joint == 3 then
556
Joints[Joint].DesiredAngle = Angle
557
end
558
if Joint == 2 or Joint == 4 then
559
Joints[Joint].DesiredAngle = -Angle
560
end
561
end
562
563
564
function ForceAngle(Joint, Angle, Character)
565
if Character == nil then return false end
566
local Joints = {
567
Character.Torso:FindFirstChild("Right Shoulder 2"),
568
Character.Torso:FindFirstChild("Left Shoulder 2"),
569
Character.Torso:FindFirstChild("Right Hip 2"),
570
Character.Torso:FindFirstChild("Left Hip 2")
571
}
572
if Joints[Joint] == nil then return false end
573
if Joint == 1 or Joint == 3 then
574
Joints[Joint].DesiredAngle = Angle
575
Joints[Joint].CurrentAngle = Angle
576
end
577
if Joint == 2 or Joint == 4 then
578
Joints[Joint].DesiredAngle = -Angle
579
Joints[Joint].CurrentAngle = -Angle
580
end
581
end
582
583
584
function SetSpeed(Joint, Speed, Character)
585
if Character == nil then return false end
586
local Joints = {
587
Character.Torso:FindFirstChild("Right Shoulder 2"),
588
Character.Torso:FindFirstChild("Left Shoulder 2"),
589
Character.Torso:FindFirstChild("Right Hip 2"),
590
Character.Torso:FindFirstChild("Left Hip 2")
591
}
592
if Joints[Joint] == nil then return false end
593
Joints[Joint].MaxVelocity = Speed
594
end
595
596
597
function DisableLimb(Limb, Character)
598
if Character == nil then return false end
599
if Character:FindFirstChild("Torso") == nil then return false end
600
local Joints = {
601
Character.Torso:FindFirstChild("Right Shoulder"),
602
Character.Torso:FindFirstChild("Left Shoulder"),
603
Character.Torso:FindFirstChild("Right Hip"),
604
Character.Torso:FindFirstChild("Left Hip")
605
}
606
local Limbs = {
607
Character:FindFirstChild("Right Arm"),
608
Character:FindFirstChild("Left Arm"),
609
Character:FindFirstChild("Right Leg"),
610
Character:FindFirstChild("Left Leg")
611
}
612
if Joints[Limb] == nil then return false end
613
if Limbs[Limb] == nil then return false end
614
local Joint = Instance.new("Motor")
615
Joint.Parent = Character.Torso
616
Joint.Part0 = Character.Torso
617
Joint.Part1 = Limbs[Limb]
618
if Limb == 1 then
619
Joint.C0 = CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
620
Joint.C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
621
Joint.Name = "Right Shoulder 2"
622
elseif Limb == 2 then
623
Joint.C0 = CFrame.new(-1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
624
Joint.C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
625
Joint.Name = "Left Shoulder 2"
626
elseif Limb == 3 then
627
Joint.C0 = CFrame.new(0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
628
Joint.C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
629
Joint.Name = "Right Hip 2"
630
elseif Limb == 4 then
631
Joint.C0 = CFrame.new(-0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
632
Joint.C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
633
Joint.Name = "Left Hip 2"
634
end
635
Joint.MaxVelocity = Joints[Limb].MaxVelocity
636
Joint.CurrentAngle = Joints[Limb].CurrentAngle
637
Joint.DesiredAngle = Joints[Limb].DesiredAngle
638
Joints[Limb]:Remove()
639
end
640
641
642
function ResetLimbCFrame(Limb, Character)
643
if Character == nil then return false end
644
if Character.Parent == nil then return false end
645
if Character:FindFirstChild("Torso") == nil then return false end
646
local Joints = {
647
Character.Torso:FindFirstChild("Right Shoulder 2"),
648
Character.Torso:FindFirstChild("Left Shoulder 2"),
649
Character.Torso:FindFirstChild("Right Hip 2"),
650
Character.Torso:FindFirstChild("Left Hip 2")
651
}
652
local Limbs = {
653
Character:FindFirstChild("Right Arm"),
654
Character:FindFirstChild("Left Arm"),
655
Character:FindFirstChild("Right Leg"),
656
Character:FindFirstChild("Left Leg")
657
}
658
if Joints[Limb] == nil then return false end
659
if Limbs[Limb] == nil then return false end
660
if Limb == 1 then
661
Joints[Limb].C0 = CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
662
Joints[Limb].C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
663
elseif Limb == 2 then
664
Joints[Limb].C0 = CFrame.new(-1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
665
Joints[Limb].C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
666
elseif Limb == 3 then
667
Joints[Limb].C0 = CFrame.new(0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
668
Joints[Limb].C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
669
elseif Limb == 4 then
670
Joints[Limb].C0 = CFrame.new(-0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
671
Joints[Limb].C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
672
end
673
end
674
675
676
function EnableLimb(Limb, Character)
677
if Character == nil then return false end
678
if Character:FindFirstChild("Torso") == nil then return false end
679
local Joints = {
680
Character.Torso:FindFirstChild("Right Shoulder 2"),
681
Character.Torso:FindFirstChild("Left Shoulder 2"),
682
Character.Torso:FindFirstChild("Right Hip 2"),
683
Character.Torso:FindFirstChild("Left Hip 2")
684
}
685
local Limbs = {
686
Character:FindFirstChild("Right Arm"),
687
Character:FindFirstChild("Left Arm"),
688
Character:FindFirstChild("Right Leg"),
689
Character:FindFirstChild("Left Leg")
690
}
691
if Joints[Limb] == nil then return false end
692
if Limbs[Limb] == nil then return false end
693
if Limb == 1 then
694
Joints[Limb].Name = "Right Shoulder"
695
elseif Limb == 2 then
696
Joints[Limb].Name = "Left Shoulder"
697
elseif Limb == 3 then
698
Joints[Limb].Name = "Right Hip"
699
elseif Limb == 4 then
700
Joints[Limb].Name = "Left Hip"
701
end
702
Animate = Character:FindFirstChild("Animate")
703
if Animate == nil then return false end
704
Animate = Animate:Clone()
705
Character.Animate:Remove()
706
Animate.Parent = Character
707
end
708
709
710
function playAnimation(format, mouse)
711
if format == "equip" then
712
Player.Character[Name.. " (Holstered)"].Handle.Weld:Remove()
713
local w = Instance.new("Weld")
714
w.Part0 = Player.Character[Name.. " (Holstered)"].Handle
715
w.Part1 = Player.Character:FindFirstChild("Right Arm")
716
w.C0 = CFrame.new(0, 1.2, 0.7)
717
w.C1 = CFrame.new()
718
w.Parent = Player.Character[Name.. " (Holstered)"].Handle
719
for i = 0.01, 1, 0.1 do
720
if Player.Character:FindFirstChild("Torso") ~= nil then
721
if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
722
Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
723
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)
724
Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
725
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)
726
wait()
727
else return false end
728
else return false end
729
end
730
return playAnimation("hold")
731
end
732
if format == "unequip" then
733
for i = 1, 0.01, -0.1 do
734
if Player.Character:FindFirstChild("Torso") ~= nil then
735
if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
736
Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
737
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)
738
Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
739
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)
740
wait()
741
else return false end
742
else return false end
743
end
744
return true
745
end
746
if format == "hold" then
747
if Player.Character:FindFirstChild("Torso") ~= nil then
748
if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
749
Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
750
Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new(-0.5, 1.2, 0.8) * CFrame.fromEulerAnglesXYZ(math.rad(300), math.rad(10), math.rad(-90))
751
Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
752
Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(-0.9, -0.35, 0.51) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-5), 0)
753
else return false end
754
else return false end
755
end
756
if format == "reload" then
757
Player.Character[Name].Handle.Reload:Play()
758
for i = 0, 25, 5 do
759
if Player.Character:FindFirstChild("Torso") ~= nil then
760
if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
761
Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
762
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))
763
Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
764
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)
765
wait()
766
else return false end
767
else return false end
768
end
769
Player.Character[Name].Magazine.Transparency = 1
770
magazineDrop = Player.Character[Name].Magazine:Clone()
771
magazineDrop.Transparency = 0
772
magazineDrop.Parent = game.Workspace
773
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)
774
delay(0.1, function() magazineDrop.CanCollide = true end)
775
magazineNew = Player.Character[Name].Magazine:Clone()
776
magazineNew.Name = "New Magazine"
777
magazineNew.Transparency = 0
778
magazineNew.Parent = Player.Character[Name]
779
local w = Instance.new("Weld")
780
w.Part0 = magazineNew
781
w.Part1 = Player.Character:FindFirstChild("Left Arm")
782
w.C0 = CFrame.new(0, 1.1, 0)
783
w.C1 = CFrame.new() * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
784
w.Parent = magazineNew
785
for i = 25, 0, -5 do
786
if Player.Character:FindFirstChild("Torso") ~= nil then
787
if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
788
Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
789
Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new(-0.5 + ((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))
790
Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
791
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)
792
wait()
793
else return false end
794
else return false end
795
end
796
Player.Character[Name].Magazine.Transparency = 0
797
Player.Character[Name]["New Magazine"]:Remove()
798
wait(0.4)
799
for i = 0, 10, 5 do
800
if Player.Character:FindFirstChild("Torso") ~= nil then
801
if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil then
802
Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
803
Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new(-0.5 - (i / 25), 1.2, 0.8) * CFrame.fromEulerAnglesXYZ(math.rad(300 - i), math.rad(10 - i), math.rad(-90))
804
wait()
805
else return false end
806
else return false end
807
end
808
wait(0.1)
809
for i = 0, 10, 1.5 do
810
if Player.Character:FindFirstChild("Torso") ~= nil then
811
if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil then
812
Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
813
Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new(-0.9, 1.2 - (i / 25), 0.8) * CFrame.fromEulerAnglesXYZ(math.rad(290), 0, math.rad(-90))
814
wait()
815
else return false end
816
else return false end
817
end
818
for i = 10, 0, -1.5 do
819
if Player.Character:FindFirstChild("Torso") ~= nil then
820
if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil then
821
Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
822
Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new(-0.9, 1.2 - (i / 25), 0.8) * CFrame.fromEulerAnglesXYZ(math.rad(290), 0, math.rad(-90))
823
wait()
824
else return false end
825
else return false end
826
end
827
for i = 10, 0, -5 do
828
if Player.Character:FindFirstChild("Torso") ~= nil then
829
if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil then
830
Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
831
Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new(-0.5 - (i / 25), 1.2, 0.8) * CFrame.fromEulerAnglesXYZ(math.rad(300 - i), math.rad(10 - i), math.rad(-90))
832
wait()
833
else return false end
834
else return false end
835
end
836
end
837
if format == "fire" then
838
makeShell(Player.Character[Name]:FindFirstChild("ShellOut"))
839
if Player.Character[Name]:FindFirstChild("Handle") ~= nil then
840
if silenced then
841
Player.Character[Name].Handle.Fire.Volume = math.random(3, 8) / 10
842
Player.Character[Name].Handle.Fire.Pitch = math.random(20, 25) / 10
843
Player.Character[Name].Handle.Fire:Play()
844
CamShake(5, 50000)
845
else
846
Player.Character[Name].Handle.Fire.Volume = math.random(9, 10) / 10
847
Player.Character[Name].Handle.Fire.Pitch = 1
848
Player.Character[Name].Handle.Fire:Play()
849
CamShake(10, 25000)
850
end
851
else return false end
852
if Player.Character[Name]:FindFirstChild("Muzzle") ~= nil then
853
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))
854
else return false end
855
for i = 0, 10, 5 do
856
if Player.Character:FindFirstChild("Torso") ~= nil then
857
if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
858
Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
859
Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new(-0.5, 1.2, 0.8) * CFrame.fromEulerAnglesXYZ(math.rad(300), math.rad(10 + i), math.rad(-90))
860
Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
861
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)
862
wait()
863
else return false end
864
else return false end
865
end
866
for i = 10, 0, -5 do
867
if Player.Character:FindFirstChild("Torso") ~= nil then
868
if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
869
Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
870
Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new(-0.5, 1.2, 0.8) * CFrame.fromEulerAnglesXYZ(math.rad(300), math.rad(10 + i), math.rad(-90))
871
Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
872
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)
873
wait()
874
else return false end
875
else return false end
876
end
877
end
878
return true
879
end
880
881
882
function CamShake(time, freq)
883
coroutine.resume(coroutine.create(function()
884
local cam = Workspace.CurrentCamera
885
local time = 10
886
local seed = Vector3.new(math.random(100, 200) / freq, math.random(100, 200) / freq, 0)
887
if math.random(1, 2) == 1 then seed = Vector3.new(-seed.x, seed.y, 0) end
888
if math.random(1, 2) == 1 then seed = Vector3.new(seed.x, -seed.y, 0) end
889
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)
890
for i = 1, time do
891
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)
892
wait()
893
end
894
end))
895
end
896
897
898
function makeShell(part)
899
if part == nil then return false end
900
local casing = Instance.new("Part")
901
casing.Name = "Shell"
902
casing.FormFactor = "Custom"
903
casing.Size = Vector3.new(1, 1, 1)
904
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)))
905
casing.BrickColor = BrickColor.new("New Yeller")
906
local mesh = Instance.new("CylinderMesh")
907
mesh.Scale = Vector3.new(0.1, 0.3, 0.1)
908
mesh.Parent = casing
909
casing.Parent = Workspace
910
casing:BreakJoints()
911
casing.Velocity = (part.CFrame.lookVector * 50) + Vector3.new(0, 10, 0)
912
coroutine.resume(coroutine.create(function() wait(4.5) for i = 0, 1, 0.1 do casing.Transparency = i wait() end casing:Remove() end))
913
end
914
915
916
function Weld(x, y)
917
local weld = Instance.new("Weld")
918
weld.Part0 = x
919
weld.Part1 = y
920
CJ = CFrame.new(x.Position)
921
C0 = x.CFrame:inverse() * CJ
922
C1 = y.CFrame:inverse() * CJ
923
weld.C0 = C0
924
weld.C1 = C1
925
weld.Parent = x
926
end
927
928
929
function tagHumanoid(humanoid)
930
local tag = Instance.new("ObjectValue")
931
tag.Name = "creator"
932
tag.Value = Player
933
tag.Parent = humanoid
934
local tag = Instance.new("StringValue")
935
tag.Name = "creatorType1"
936
tag.Value = Name
937
tag.Parent = humanoid
938
local tag = Instance.new("StringValue")
939
tag.Name = "creatorType2"
940
tag.Value = "shot"
941
tag.Parent = humanoid
942
end
943
944
945
function untagHumanoid(humanoid)
946
if humanoid ~= nil then
947
local tag = humanoid:FindFirstChild("creator")
948
if tag ~= nil then
949
tag:Remove()
950
end
951
local tag = humanoid:FindFirstChild("creatorType1")
952
if tag ~= nil then
953
tag:Remove()
954
end
955
local tag = humanoid:FindFirstChild("creatorType2")
956
if tag ~= nil then
957
tag:Remove()
958
end
959
end
960
end
961
962
963
function fire(startPoint, endPoint, hit)
964
local trail = Instance.new("Part")
965
trail.Name = "Bullet Trail"
966
trail.BrickColor = BrickColor.new("New Yeller")
967
trail.TopSurface = 0
968
trail.BottomSurface = 0
969
trail.FormFactor = 0
970
trail.Size = Vector3.new(1, 1, 1)
971
trail.Transparency = 0.3
972
trail.Anchored = true
973
trail.CanCollide = false
974
trail.CFrame = CFrame.new((startPoint + endPoint) / 2, endPoint)
975
trail.Parent = Workspace
976
local mesh = Instance.new("SpecialMesh")
977
mesh.MeshType = "Brick"
978
mesh.Scale = Vector3.new(0.1, 0.1, (startPoint - endPoint).magnitude)
979
mesh.Parent = trail
980
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)
981
if hit ~= nil then
982
if hit.Parent == nil then return end
983
if hit.Parent:FindFirstChild("Humanoid") ~= nil then
984
tagHumanoid(hit.Parent.Humanoid)
985
if hit.Name == "Head" then
986
hit.Parent.Humanoid:TakeDamage(damage * 10)
987
elseif hit.Name == "Torso" then
988
hit.Parent.Humanoid:TakeDamage(damage * 2)
989
else
990
hit.Parent.Humanoid:TakeDamage(damage)
991
end
992
if math.random(1, 10) == 1 then
993
hit.Parent.Humanoid.Sit = true
994
end
995
delay(0.1, function() untagHumanoid(hit.Parent.Humanoid) end)
996
end
997
if hit.Anchored == false then
998
hit.Velocity = hit.Velocity + ((endPoint - startPoint).unit * (damage * 2))
999
end
1000
end
1001
end
1002
1003
1004
function onButton1Down(mouse)
1005
if selected == false then return end
1006
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
1007
if Player.Character[Name]:FindFirstChild("Handle") == nil then return end
1008
if Player.Character[Name]:FindFirstChild("Muzzle") == nil then return end
1009
if dual == true then if Player.Character[Name.. " (Left)"]:FindFirstChild("Handle") == nil then return end end
1010
if dual == true then if Player.Character[Name.. " (Left)"]:FindFirstChild("Muzzle") == nil then return end end
1011
mouse.Icon = "rbxasset://textures\\GunWaitCursor.png"
1012
Button1Down = true
1013
canFire = false
1014
canFire2 = true
1015
while canFire2 == true do
1016
local humanoid = Player.Character:FindFirstChild("Humanoid")
1017
if humanoid == nil then
1018
canFire2 = false
1019
break
1020
end
1021
if humanoid.Health <= 0 then
1022
canFire2 = false
1023
break
1024
end
1025
local fireLeft = false
1026
if automatic == false and burst == false then
1027
canFire2 = false
1028
elseif automatic == false and burst == true then
1029
if burstCount >= burstCountMax then
1030
canFire2 = false
1031
burstCount = 0
1032
break
1033
end
1034
burstCount = burstCount + 1
1035
elseif automatic == true and burst == false then
1036
fireLeft = true
1037
end
1038
if magazine.Value > 0 then
1039
magazine.Value = magazine.Value - 1
1040
updateGui()
1041
fire(Player.Character[Name].Muzzle.Position, mouse.Hit.p, mouse.Target)
1042
coroutine.resume(coroutine.create(function()
1043
if dual == true then
1044
playAnimation("rightFire")
1045
elseif dual == false then
1046
playAnimation("fire")
1047
end
1048
end))
1049
else
1050
Player.Character[Name].Handle.Empty:Play()
1051
end
1052
if fireLeft == true and dual == true and automatic == true then
1053
if magazine.Value > 0 then
1054
coroutine.resume(coroutine.create(function()
1055
wait(readyTime / 2)
1056
magazine.Value = magazine.Value - 1
1057
updateGui()
1058
fire(Player.Character[Name.. " (Left)"].Muzzle.Position, mouse.Hit.p, mouse.Target)
1059
playAnimation("leftFire")
1060
end))
1061
else
1062
coroutine.resume(coroutine.create(function()
1063
wait(readyTime / 2)
1064
Player.Character[Name].Handle.Empty:Play()
1065
end))
1066
end
1067
end
1068
wait(readyTime)
1069
end
1070
mouse.Icon = "rbxasset://textures\\GunCursor.png"
1071
canFire = true
1072
end
1073
end
1074
1075
1076
function onButton1Up(mouse)
1077
if selected == false then return end
1078
Button1Down = false
1079
canFire2 = false
1080
burstCount = 0
1081
while canFire == false do wait() end
1082
if dual == true and automatic == false then
1083
if Player.Character[Name.. " (Left)"]:FindFirstChild("Handle") == nil then return end
1084
if Player.Character[Name.. " (Left)"]:FindFirstChild("Muzzle") == nil then return end
1085
mouse.Icon = "rbxasset://textures\\GunWaitCursor.png"
1086
canFire = false
1087
canFire2 = true
1088
while canFire2 == true do
1089
local humanoid = Player.Character:FindFirstChild("Humanoid")
1090
if humanoid == nil then
1091
canFire2 = false
1092
break
1093
end
1094
if humanoid.Health <= 0 then
1095
canFire2 = false
1096
break
1097
end
1098
if burst == false then
1099
canFire2 = false
1100
elseif burst == true then
1101
if burstCount >= burstCountMax then
1102
canFire2 = false
1103
burstCount = 0
1104
break
1105
end
1106
burstCount = burstCount + 1
1107
end
1108
if magazine.Value <= 0 then
1109
Player.Character[Name].Handle.Empty:Play()
1110
else
1111
coroutine.resume(coroutine.create(function()
1112
playAnimation("leftFire")
1113
end))
1114
magazine.Value = magazine.Value - 1
1115
updateGui()
1116
fire(Player.Character[Name.. " (Left)"].Muzzle.Position, mouse.Hit.p, mouse.Target)
1117
end
1118
wait(readyTime)
1119
end
1120
mouse.Icon = "rbxasset://textures\\GunCursor.png"
1121
canFire = true
1122
end
1123
end
1124
1125
1126
function onKeyDown(key, mouse)
1127
if selected == false then return end
1128
key = key:lower()
1129
if key == "q" and Button1Down == false and canFire == true then
1130
if mouse.Target == nil then return end
1131
if game:GetService("Players"):GetPlayerFromCharacter(mouse.Target.Parent) ~= nil then
1132
if dual == true then onKeyDown("t", mouse) end
1133
onDeselected(mouse)
1134
removeParts("RightHolster")
1135
script.Parent.Parent = game:GetService("Players"):GetPlayerFromCharacter(mouse.Target.Parent).Backpack
1136
end
1137
end
1138
if key == "e" and Button1Down == false and canFire == true and canSilence == true then
1139
if silenced then
1140
silenced = false
1141
if Player.Character:FindFirstChild(Name) == nil then return end
1142
if Player.Character[Name]:FindFirstChild("Muzzle") == nil then return end
1143
if Player.Character[Name]:FindFirstChild("Muzzle 2") == nil then return end
1144
Player.Character[Name].Muzzle.Transparency = 1
1145
Player.Character[Name].Muzzle.Name = "Silencer"
1146
Player.Character[Name]["Muzzle 2"].Name = "Muzzle"
1147
if dual == true then
1148
if Player.Character[Name.. " (Left)"]:FindFirstChild("Muzzle") == nil then return end
1149
if Player.Character[Name.. " (Left)"]:FindFirstChild("Muzzle 2") == nil then return end
1150
Player.Character[Name.. " (Left)"].Muzzle.Transparency = 1
1151
Player.Character[Name.. " (Left)"].Muzzle.Name = "Silencer"
1152
Player.Character[Name.. " (Left)"]["Muzzle 2"].Name = "Muzzle"
1153
end
1154
else
1155
silenced = true
1156
if Player.Character:FindFirstChild(Name) == nil then return end
1157
if Player.Character[Name]:FindFirstChild("Silencer") == nil then return end
1158
if Player.Character[Name]:FindFirstChild("Muzzle") == nil then return end
1159
Player.Character[Name].Silencer.Transparency = 0
1160
Player.Character[Name].Muzzle.Name = "Muzzle 2"
1161
Player.Character[Name].Silencer.Name = "Muzzle"
1162
if dual == true then
1163
if Player.Character[Name.. " (Left)"]:FindFirstChild("Silencer") == nil then return end
1164
if Player.Character[Name.. " (Left)"]:FindFirstChild("Muzzle") == nil then return end
1165
Player.Character[Name.. " (Left)"].Silencer.Transparency = 0
1166
Player.Character[Name.. " (Left)"].Muzzle.Name = "Muzzle 2"
1167
Player.Character[Name.. " (Left)"].Silencer.Name = "Muzzle"
1168
end
1169
end
1170
end
1171
if key == "r" and Button1Down == false and canFire == true then
1172
if ammo.Value > 0 and magazine.Value ~= magazineMax.Value then
1173
canFire = false
1174
burstCount = 0
1175
mouse.Icon = "rbxasset://textures\\GunWaitCursor.png"
1176
if magazine.Value > 0 then ammo.Value = ammo.Value + magazine.Value magazine.Value = 0 end
1177
updateGui()
1178
if dual == true then
1179
playAnimation("reloadDual")
1180
elseif dual == false then
1181
playAnimation("reload")
1182
end
1183
if ammo.Value - magazineMax.Value < 0 then
1184
magazine.Value = ammo.Value
1185
ammo.Value = 0
1186
elseif ammo.Value - magazineMax.Value >= 0 then
1187
ammo.Value = ammo.Value - magazineMax.Value
1188
magazine.Value = magazineMax.Value
1189
end
1190
updateGui()
1191
mouse.Icon = "rbxasset://textures\\GunCursor.png"
1192
canFire = true
1193
end
1194
end
1195
if key == "t" and Button1Down == false and canFire == true and canDual == true then
1196
canFire = false
1197
if dual == false then
1198
local weapon = nil
1199
for _, p in pairs(Player.Backpack:GetChildren()) do
1200
if p.Name == Name and p ~= script.Parent then weapon = p break end
1201
end
1202
if weapon ~= nil then
1203
dual = true
1204
weapon.Name = "Dual"
1205
weapon.Parent = script
1206
silenced = false
1207
removeParts("RightHand")
1208
makeParts("RightHand")
1209
removeParts("RightHolster")
1210
makeParts("LeftHolster")
1211
playAnimation("leftEquip")
1212
removeParts("LeftHolster")
1213
makeParts("LeftHand")
1214
magazineMax.Value = math.ceil(magazineMax.Value * 2)
1215
ammoMax.Value = math.ceil(ammoMax.Value * 2)
1216
magazine.Value = magazine.Value + weapon.Magazine.Value
1217
ammo.Value = ammo.Value + weapon.Ammo.Value
1218
updateGui()
1219
end
1220
elseif dual == true then
1221
local weapon = script:FindFirstChild("Dual")
1222
if weapon ~= nil then
1223
dual = false
1224
weapon.Name = Name
1225
weapon.Parent = Player.Backpack
1226
silenced = false
1227
removeParts("RightHand")
1228
makeParts("RightHand")
1229
playAnimation("leftUnequip")
1230
removeParts("LeftHand")
1231
makeParts("RightHolster")
1232
playAnimation("hold")
1233
weapon.Magazine.Value = math.floor(magazine.Value / 2)
1234
weapon.Ammo.Value = math.floor(ammo.Value / 2)
1235
magazineMax.Value = math.ceil(magazineMax.Value / 2)
1236
ammoMax.Value = math.ceil(ammoMax.Value / 2)
1237
magazine.Value = math.ceil(magazine.Value / 2)
1238
ammo.Value = math.ceil(ammo.Value / 2)
1239
updateGui()
1240
end
1241
end
1242
canFire = true
1243
end
1244
if key == "y" and canZoom == true then
1245
if zoom == false then
1246
zoom = true
1247
local pos = mouse.Hit.p
1248
local target = mouse.Target
1249
local cam = Workspace.CurrentCamera
1250
focus = Instance.new("Part", Workspace)
1251
focus.Anchored = true
1252
focus.CanCollide = false
1253
focus.Transparency = 1
1254
focus.TopSurface = 0
1255
focus.BottomSurface = 0
1256
focus.FormFactor = "Plate"
1257
focus.Size = Vector3.new(0, 0, 0)
1258
focus.CFrame = CFrame.new(pos) * (CFrame.new(Player.Character.Torso.Position, pos) - CFrame.new(Player.Character.Torso.Position, pos).p)
1259
cam.CameraSubject = focus
1260
cam.CameraType = "Attach"
1261
while zoom == true and selected == true do
1262
local set = false
1263
if target ~= nil then
1264
if target.Parent ~= nil then
1265
if target.Anchored == false then
1266
focus.CFrame = CFrame.new(target.Position) * (CFrame.new(Player.Character.Torso.Position, target.Position) - CFrame.new(Player.Character.Torso.Position, target.Position).p)
1267
set = true
1268
end
1269
end
1270
end
1271
if set == false then
1272
focus.CFrame = CFrame.new(pos) * (CFrame.new(Player.Character.Torso.Position, pos) - CFrame.new(Player.Character.Torso.Position, pos).p)
1273
end
1274
wait()
1275
end
1276
if focus ~= nil then focus:Remove() focus = nil end
1277
local cam = Workspace.CurrentCamera
1278
cam.CameraSubject = Player.Character:FindFirstChild("Humanoid")
1279
cam.CameraType = "Custom"
1280
else
1281
zoom = false
1282
end
1283
end
1284
if key == "u" and Button1Down == false and canFire == true then
1285
if automatic == false and burst == false then
1286
if switchToBurst == true then
1287
burst = true
1288
local m = Instance.new("Message", Player)
1289
m.Text = "Burst"
1290
pcall(function() Player.Character[Name].Handle.Switch:Play() end)
1291
delay(2.5, function() m:Remove() end)
1292
elseif switchToAutomatic == true then
1293
automatic = true
1294
local m = Instance.new("Message", Player)
1295
m.Text = "Automatic"
1296
pcall(function() Player.Character[Name].Handle.Switch:Play() end)
1297
delay(2.5, function() m:Remove() end)
1298
end
1299
elseif automatic == false and burst == true then
1300
if switchToAutomatic == true then
1301
automatic = true
1302
burst = false
1303
local m = Instance.new("Message", Player)
1304
m.Text = "Automatic"
1305
pcall(function() Player.Character[Name].Handle.Switch:Play() end)
1306
delay(2.5, function() m:Remove() end)
1307
elseif switchToSingle == true then
1308
burst = false
1309
local m = Instance.new("Message", Player)
1310
m.Text = "Single"
1311
pcall(function() Player.Character[Name].Handle.Switch:Play() end)
1312
delay(2.5, function() m:Remove() end)
1313
end
1314
elseif automatic == true and burst == false then
1315
if switchToSingle == true then
1316
automatic = false
1317
local m = Instance.new("Message", Player)
1318
m.Text = "Single"
1319
pcall(function() Player.Character[Name].Handle.Switch:Play() end)
1320
delay(2.5, function() m:Remove() end)
1321
elseif switchToBurst == true then
1322
automatic = false
1323
burst = true
1324
local m = Instance.new("Message", Player)
1325
m.Text = "Burst"
1326
pcall(function() Player.Character[Name].Handle.Switch:Play() end)
1327
delay(2.5, function() m:Remove() end)
1328
end
1329
end
1330
end
1331
end
1332
1333
1334
function onSelected(mouse)
1335
if selected == true then return end
1336
selected = true
1337
canFire = false
1338
mouse.Icon = "rbxasset://textures\\GunWaitCursor.png"
1339
while Player.Character:FindFirstChild("WeaponActivated") ~= nil do
1340
if Player.Character.WeaponActivated.Value == nil then break end
1341
if Player.Character.WeaponActivated.Value.Parent == nil then break end
1342
wait()
1343
end
1344
updateGui()
1345
local weapon = Instance.new("ObjectValue")
1346
weapon.Name = "WeaponActivated"
1347
weapon.Value = script.Parent
1348
weapon.Parent = Player.Character
1349
DisableLimb(1, Player.Character)
1350
DisableLimb(2, Player.Character)
1351
ForceAngle(1, 0, Player.Character)
1352
ForceAngle(2, 0, Player.Character)
1353
if dual == true then
1354
coroutine.resume(coroutine.create(function() playAnimation("leftEquip") end))
1355
playAnimation("rightEquip")
1356
removeParts("LeftHolster")
1357
makeParts("LeftHand")
1358
else
1359
playAnimation("equip")
1360
end
1361
removeParts("RightHolster")
1362
makeParts("RightHand")
1363
mouse.Button1Down:connect(function() onButton1Down(mouse) end)
1364
mouse.Button1Up:connect(function() onButton1Up(mouse) end)
1365
mouse.KeyDown:connect(function(key) onKeyDown(key, mouse) end)
1366
mouse.Icon = "rbxasset://textures\\GunCursor.png"
1367
canFire = true
1368
end
1369
1370
1371
function onDeselected(mouse)
1372
if selected == false then return end
1373
Button1Down = false
1374
while canFire == false do
1375
wait()
1376
end
1377
selected = false
1378
if dual == true then
1379
if math.random(1, 2) == 1 then
1380
coroutine.resume(coroutine.create(function() playAnimation("leftUnequip") end))
1381
wait(math.random(1, 10) / 10)
1382
playAnimation("rightUnequip")
1383
else
1384
coroutine.resume(coroutine.create(function() playAnimation("rightUnequip") end))
1385
wait(math.random(1, 10) / 10)
1386
playAnimation("leftUnequip")
1387
end
1388
removeParts("LeftHand")
1389
makeParts("LeftHolster")
1390
else
1391
playAnimation("unequip")
1392
end
1393
removeParts("RightHand")
1394
makeParts("RightHolster")
1395
ForceAngle(1, 0, Player.Character)
1396
ForceAngle(2, 0, Player.Character)
1397
ResetLimbCFrame(1, Player.Character)
1398
ResetLimbCFrame(2, Player.Character)
1399
EnableLimb(1, Player.Character)
1400
EnableLimb(2, Player.Character)
1401
silenced = false
1402
if Player.PlayerGui:FindFirstChild(Name) ~= nil then Player.PlayerGui[Name]:Remove() end
1403
if Player.Character:FindFirstChild("WeaponActivated") ~= nil then
1404
if Player.Character.WeaponActivated.Value == script.Parent then
1405
Player.Character.WeaponActivated:Remove()
1406
end
1407
end
1408
while Player.Character:FindFirstChild("WeaponActivated") ~= nil do
1409
if Player.Character.WeaponActivated.Value == nil then break end
1410
if Player.Character.WeaponActivated.Value.Parent == nil then break end
1411
wait()
1412
end
1413
end
1414
1415
1416
if script.Parent.ClassName ~= "HopperBin" then
1417
if Player == nil then print("Error: Player not found!") return end
1418
Tool = Instance.new("HopperBin")
1419
Tool.Name = Name
1420
Tool.Parent = Player.Backpack
1421
script.Name = "Main"
1422
script.Parent = Tool
1423
elseif script.Parent.ClassName == "HopperBin" then
1424
while script.Parent.Parent.ClassName ~= "Backpack" do
1425
wait()
1426
end
1427
if script.Parent:FindFirstChild("MagazineMax") == nil then
1428
magazineMax = Instance.new("NumberValue")
1429
magazineMax.Name = "MagazineMax"
1430
magazineMax.Value = 10000
1431
magazineMax.Parent = script.Parent
1432
else
1433
magazineMax = script.Parent.MagazineMax
1434
end
1435
if script.Parent:FindFirstChild("Magazine") == nil then
1436
magazine = Instance.new("NumberValue")
1437
magazine.Name = "Magazine"
1438
magazine.Value = 0
1439
magazine.Parent = script.Parent
1440
else
1441
magazine = script.Parent.Magazine
1442
end
1443
if script.Parent:FindFirstChild("AmmoMax") == nil then
1444
ammoMax = Instance.new("NumberValue")
1445
ammoMax.Name = "AmmoMax"
1446
ammoMax.Value = 1000000
1447
ammoMax.Parent = script.Parent
1448
else
1449
ammoMax = script.Parent.AmmoMax
1450
end
1451
if script.Parent:FindFirstChild("Ammo") == nil then
1452
ammo = Instance.new("NumberValue")
1453
ammo.Name = "Ammo"
1454
ammo.Value = script.Parent.AmmoMax.Value
1455
ammo.Parent = script.Parent
1456
else
1457
ammo = script.Parent.Ammo
1458
end
1459
Player = script.Parent.Parent.Parent
1460
makeParts("RightHolster")
1461
script.Parent.Selected:connect(onSelected)
1462
script.Parent.Deselected:connect(onDeselected)
1463
end