· 8 years ago · Dec 26, 2017, 12:56 PM
1--Created with PenguinAnonymous's compiler
2--PenguinAnonymous is not responsible for damages caused to your game
3--This plugin does not remove things
4--PenguinAnonymous cannot be held resonsible for manual deletion for the purpose of testing
5--Keep in mind, any items that cause errors in compilation will be skipped and documented within the last line of the disclaimer comments
6--Thank you for using my plugin and enjoy :)
7--It is free to use
8--If you use this plugin to create your own, please give me credit
9--Errors: ModuleScript,MeshPart,UnionOperation,TouchTransmitter,Camera
10local runDummyScript = function(f,scri)
11local oldenv = getfenv(f)
12local newenv = setmetatable({}, {
13__index = function(_, k)
14if k:lower() == 'script' then
15return scri
16else
17return oldenv[k]
18end
19end
20})
21setfenv(f, newenv)
22ypcall(function() f() end)
23end
24cors = {}
25mas = Instance.new("Model",game:GetService("Lighting"))
26mas.Name = "CompiledModel"
27o1 = Instance.new("Tool")
28o2 = Instance.new("IntValue")
29o3 = Instance.new("IntValue")
30o4 = Instance.new("IntValue")
31o5 = Instance.new("LocalScript")
32o6 = Instance.new("IntValue")
33o7 = Instance.new("Folder")
34o10 = Instance.new("ScreenGui")
35o11 = Instance.new("Frame")
36o12 = Instance.new("Frame")
37o13 = Instance.new("TextLabel")
38o14 = Instance.new("TextLabel")
39o15 = Instance.new("TextLabel")
40o16 = Instance.new("Frame")
41o17 = Instance.new("TextLabel")
42o18 = Instance.new("TextLabel")
43o19 = Instance.new("Frame")
44o20 = Instance.new("Frame")
45o21 = Instance.new("ImageLabel")
46o22 = Instance.new("TextLabel")
47o23 = Instance.new("TextLabel")
48o24 = Instance.new("Frame")
49o25 = Instance.new("ImageLabel")
50o26 = Instance.new("TextLabel")
51o27 = Instance.new("TextLabel")
52o28 = Instance.new("Frame")
53o29 = Instance.new("TextLabel")
54o30 = Instance.new("Frame")
55o31 = Instance.new("Frame")
56o32 = Instance.new("Frame")
57o33 = Instance.new("Frame")
58o34 = Instance.new("Frame")
59o35 = Instance.new("Frame")
60o36 = Instance.new("Frame")
61o37 = Instance.new("Frame")
62o38 = Instance.new("Frame")
63o39 = Instance.new("Frame")
64o40 = Instance.new("Frame")
65o41 = Instance.new("Frame")
66o42 = Instance.new("Frame")
67o43 = Instance.new("Frame")
68o44 = Instance.new("Frame")
69o45 = Instance.new("Frame")
70o46 = Instance.new("Frame")
71o47 = Instance.new("Frame")
72o48 = Instance.new("Frame")
73o49 = Instance.new("Frame")
74o50 = Instance.new("Frame")
75o51 = Instance.new("Frame")
76o52 = Instance.new("Frame")
77o53 = Instance.new("Frame")
78o54 = Instance.new("Frame")
79o55 = Instance.new("Frame")
80o56 = Instance.new("TextLabel")
81o57 = Instance.new("TextLabel")
82o58 = Instance.new("TextLabel")
83o59 = Instance.new("Frame")
84o60 = Instance.new("TextLabel")
85o61 = Instance.new("TextLabel")
86o62 = Instance.new("ImageLabel")
87o63 = Instance.new("NumberValue")
88o64 = Instance.new("TextLabel")
89o65 = Instance.new("Frame")
90o66 = Instance.new("Frame")
91o67 = Instance.new("ImageLabel")
92o68 = Instance.new("ImageLabel")
93o69 = Instance.new("TextLabel")
94o70 = Instance.new("Frame")
95o71 = Instance.new("ImageLabel")
96o72 = Instance.new("TextLabel")
97o73 = Instance.new("Frame")
98o74 = Instance.new("TextLabel")
99o75 = Instance.new("Frame")
100o76 = Instance.new("TextLabel")
101o77 = Instance.new("Frame")
102o78 = Instance.new("TextLabel")
103o79 = Instance.new("Frame")
104o80 = Instance.new("TextLabel")
105o81 = Instance.new("Frame")
106o82 = Instance.new("TextLabel")
107o83 = Instance.new("Frame")
108o84 = Instance.new("ImageLabel")
109o85 = Instance.new("ImageLabel")
110o86 = Instance.new("Frame")
111o87 = Instance.new("Frame")
112o88 = Instance.new("LocalScript")
113o89 = Instance.new("IntValue")
114o90 = Instance.new("Script")
115o91 = Instance.new("Script")
116o92 = Instance.new("ObjectValue")
117o93 = Instance.new("RemoteFunction")
118o94 = Instance.new("RemoteFunction")
119o95 = Instance.new("RemoteFunction")
120o96 = Instance.new("RemoteEvent")
121o97 = Instance.new("RemoteFunction")
122o98 = Instance.new("RemoteFunction")
123o99 = Instance.new("RemoteFunction")
124o100 = Instance.new("LocalScript")
125o101 = Instance.new("IntValue")
126o102 = Instance.new("RemoteEvent")
127o103 = Instance.new("RemoteEvent")
128o104 = Instance.new("RemoteEvent")
129o105 = Instance.new("RemoteEvent")
130o106 = Instance.new("Part")
131o109 = Instance.new("NumberValue")
132o119 = Instance.new("Part")
133o120 = Instance.new("CylinderMesh")
134o121 = Instance.new("Part")
135o122 = Instance.new("BlockMesh")
136o123 = Instance.new("Sound")
137o124 = Instance.new("Sound")
138o125 = Instance.new("Sound")
139o126 = Instance.new("Sound")
140o128 = Instance.new("Part")
141o129 = Instance.new("ParticleEmitter")
142o130 = Instance.new("ParticleEmitter")
143o131 = Instance.new("PointLight")
144o1.Name = "Hecate II"
145o1.Parent = mas
146o1.TextureId = "rbxassetid://813075948"
147o2.Name = "Ammo"
148o2.Parent = o1
149o2.Value = 5
150o3.Name = "ClipSize"
151o3.Parent = o1
152o3.Value = 5
153o4.Name = "LethalGrenades"
154o4.Parent = o1
155o4.Value = 15
156o5.Name = "clientMain"
157o5.Parent = o1
158table.insert(cors,coroutine.create(function()
159wait()
160runDummyScript(function()
161--[[
162Kit By TurboFusion
163Remake By MuYhEt & Xander521
164--]]
165--------------------------------------------------------------------------------------
166--------------------[ CHARACTER LOADING ]---------------------------------------------
167--------------------------------------------------------------------------------------
168
169repeat wait() until game.Players.LocalPlayer.Character
170repeat wait() until game.Players.LocalPlayer.Character:IsDescendantOf(game.Workspace)
171wait(1 / 20)
172
173--------------------------------------------------------------------------------------
174--------------------[ IGNORE MODEL ]--------------------------------------------------
175--------------------------------------------------------------------------------------
176
177local ignoreCode = script:WaitForChild("ignoreCode")
178
179repeat wait() until ignoreCode.Value ~= 0
180
181local ignoreModel = game.Workspace:WaitForChild("ignoreModel_"..ignoreCode.Value)
182
183local grenadeFolder = ignoreModel:WaitForChild("grenadeFolder")
184
185--------------------------------------------------------------------------------------
186--------------------[ CONSTANTS ]-----------------------------------------------------
187--------------------------------------------------------------------------------------
188
189local Gun = script.Parent
190local serverMain = Gun:WaitForChild("serverMain")
191local Handle = Gun:WaitForChild("Handle")
192local AimPart = Gun:WaitForChild("AimPart")
193local Main = Gun:WaitForChild("Main")
194
195local Ammo = Gun:WaitForChild("Ammo")
196local ClipSize = Gun:WaitForChild("ClipSize")
197local StoredAmmo = Gun:WaitForChild("StoredAmmo")
198
199local createTweenIndicator = serverMain:WaitForChild("createTweenIndicator")
200local deleteTweenIndicator = serverMain:WaitForChild("deleteTweenIndicator")
201local getWeldCF = serverMain:WaitForChild("getWeldCF")
202local gunSetup = serverMain:WaitForChild("gunSetup")
203local lerpCF = serverMain:WaitForChild("lerpCF")
204local createBlood = serverMain:WaitForChild("createBlood")
205local createBulletImpact = serverMain:WaitForChild("createBulletImpact")
206local createShockwave = serverMain:WaitForChild("createShockwave")
207local createTrail = serverMain:WaitForChild("createTrail")
208
209local Particle = require(script:WaitForChild("Particle"))
210local Spring = require(script:WaitForChild("Spring"))
211local Anims = require(Gun:WaitForChild("ANIMATIONS"))
212local Plugins = require(Gun:WaitForChild("PLUGINS"))
213local S = require(Gun:WaitForChild("SETTINGS"))
214
215local Player = game.Players.LocalPlayer
216local Char = Player.Character
217local Humanoid = Char:WaitForChild("Humanoid")
218local Torso = Char:WaitForChild("Torso")
219local Head = Char:WaitForChild("Head")
220local HRP = Char:WaitForChild("HumanoidRootPart")
221local Root = HRP:WaitForChild("RootJoint")
222
223local Neck = Torso:WaitForChild("Neck")
224
225local LArm = Char:WaitForChild("Left Arm")
226local RArm = Char:WaitForChild("Right Arm")
227local LLeg = Char:WaitForChild("Left Leg")
228local RLeg = Char:WaitForChild("Right Leg")
229
230local M2 = Player:GetMouse()
231
232local mainGUI = script:WaitForChild("mainGUI")
233
234local crossHair = mainGUI:WaitForChild("crossHair")
235local HUD = mainGUI:WaitForChild("HUD")
236local Scope = mainGUI:WaitForChild("Scope")
237local fireSelect = mainGUI:WaitForChild("fireSelect")
238local hitMarker = mainGUI:WaitForChild("hitMarker")
239local Sens = mainGUI:WaitForChild("Sens")
240
241local crossA = crossHair:WaitForChild("A"):WaitForChild("Line")
242local crossB = crossHair:WaitForChild("B"):WaitForChild("Line")
243local crossC = crossHair:WaitForChild("C"):WaitForChild("Line")
244local crossD = crossHair:WaitForChild("D"):WaitForChild("Line")
245
246local Controls = HUD:WaitForChild("Controls")
247
248local gunNameTitle = HUD:WaitForChild("gunName"):WaitForChild("Title")
249
250local scopeMain = Scope:WaitForChild("Main")
251local scopeSteady = Scope:WaitForChild("Steady")
252
253local fireModes = fireSelect:WaitForChild("Modes")
254
255local modeGUI = HUD:WaitForChild("Mode"):WaitForChild("Main")
256local clipAmmoGUI = HUD:WaitForChild("Ammo"):WaitForChild("Clip")
257local storedAmmoGUI = HUD:WaitForChild("Ammo"):WaitForChild("Stored")
258
259local DS = game:GetService("Debris")
260local CP = game:GetService("ContentProvider")
261local RS = game:GetService("RunService")
262local UIS = game:GetService("UserInputService")
263
264local Cam = game.Workspace.CurrentCamera
265
266local ABS, HUGE, FLOOR, CEIL = math.abs, math.huge, math.floor, math.ceil
267local RAD, SIN, COS, TAN = math.rad, math.sin, math.cos, math.tan
268local VEC2, V3 = Vector2.new, Vector3.new
269local CF, CFANG = CFrame.new, CFrame.Angles
270local INSERT = table.insert
271
272local maxStamina = S.sprintTime * 60
273local maxSteadyTime = S.scopeSettings.steadyTime * 60
274
275local LethalIcons = {
276 "http://www.roblox.com/asset/?id=194849880";
277 "http://www.roblox.com/asset/?id=195727791";
278 "http://www.roblox.com/asset/?id=195728137";
279 "http://www.roblox.com/asset/?id=218151830";
280}
281
282local TacticalIcons = {
283 "http://www.roblox.com/asset/?id=195728473";
284 "http://www.roblox.com/asset/?id=195728693";
285}
286
287local ASCII = {
288 071; 117; 110; 032;
289 075; 105; 116; 032;
290 115; 099; 114; 105;
291 112; 116; 101; 100;
292 032; 098; 121; 032;
293 084; 117; 114; 098;
294 111; 070; 117; 115;
295 105; 111; 110; 000;
296}
297
298local Ignore = {
299 Char;
300 ignoreModel;
301}
302
303local Shoulders = {
304 Right = Torso:WaitForChild("Right Shoulder");
305 Left = Torso:WaitForChild("Left Shoulder")
306}
307
308local armC0 = {
309 CF(-1.5, 0, 0) * CFANG(RAD(90), 0, 0);
310 CF(1.5, 0, 0) * CFANG(RAD(90), 0, 0);
311}
312
313local legC0 = {
314 Stand = {
315 CF(-0.5, -2, 0);
316 CF(0.5, -2, 0);
317 };
318 Crouch = {
319 CF(-0.5, -1.5, 0.5) * CFANG(-RAD(90), 0, 0);
320 CF(0.5, -1, -0.75);
321 };
322 Prone = {
323 CF(-0.5, -2, 0);
324 CF(0.5, -2, 0);
325 };
326}
327
328local Sine = function(X)
329 return SIN(RAD(X))
330end
331
332local Linear = function(X)
333 return (X / 90)
334end
335
336--------------------------------------------------------------------------------------
337--------------------[ VARIABLES ]-----------------------------------------------------
338--------------------------------------------------------------------------------------
339
340local Selected = false
341
342local playerMass = 0
343
344local Forward = false
345local Backward = false
346
347local Idling = false
348local Walking = false
349local Running = false
350
351local crawlCamRot = 0
352local crawlAlpha = 0
353local idleAlpha = 1
354local walkAlpha = 0
355local isCrawling = false
356local isIdling = false
357local isWalking = false
358local isRunning = false
359
360local Aimed = false
361local Aiming = false
362local aimAlpha = 0
363local headOffset = VEC2(COS(RAD(90) - S.aimSettings.headTilt) * 0.5, 1 + SIN(RAD(90) - S.aimSettings.headTilt) * 0.5)
364
365local Reloading = false
366local breakReload = false
367local magVisible = true
368local newMag = false
369
370local Knifing = false
371
372local MB1Down = false
373local Firing = false
374local canFire = true
375local fireFunction = nil
376local firstShot = false
377local shotCount = 0
378local lastSideRecoil = {0, 0}
379local recoilAnim = {
380 Pos = V3();
381 Rot = V3();
382 Code = nil;
383}
384
385local numModes = 0
386local rawFireMode = 1
387local canSelectFire = true
388local guiAngOffset = 0
389local Modes = {}
390
391local onGround = true
392local startFallHeight = 0
393local jumpAnim = {
394 Pos = 0;
395 Rot = 0;
396 Code = 0;
397}
398
399local runReady = true
400local runKeyPressed = false
401local chargingStamina = false
402
403local AimingIn = false
404local AimingOut = false
405
406local Stamina = S.sprintTime * 60
407local currentSteadyTime = S.scopeSettings.steadyTime * 60
408
409local camSteady = false
410local takingBreath = false
411local steadyKeyPressed = false
412
413local Grip = nil
414local aimedGripCF = nil
415
416local spreadZoom = "unAimed"
417local spreadStance = "Stand"
418local spreadMotion = "Idling"
419local baseSpread = S.spreadSettings.unAimed.Stand.Idling
420local currentSpread = 0
421local loweringSpread = false
422
423local mouseSensitivity = S.sensitivitySettings.Default
424local aimSensitivity = S.sensitivitySettings.Aim
425local lastSensUpdate = 0
426
427local ammoInClip = 0
428
429local Stance = 0
430local stanceSway = 1
431local camSway = 1
432
433local camAng = VEC2()
434
435local armTilt = 0
436local moveAng = 0
437local animCode = 0
438
439local desiredXOffset = 0
440local desiredYOffset = 0
441local currentXOffset = 0
442local currentYOffset = 0
443local aimHeadOffset = 0
444local recoilAnimMultiplier = 1
445local jumpAnimMultiplier = 1
446local translationDivisor = 7
447local rotationMultiplier = S.momentumSettings.Amplitude.unAimed
448local armTiltMultiplier = 1
449
450local equipAnimPlaying = false
451
452local crossOffset = 0
453
454local camOffsets = {
455 guiScope = {
456 Rot = V3();
457 };
458 Reload = {
459 Rot = V3();
460 Code = nil;
461 };
462 Recoil = {
463 Rot = V3();
464 Code = nil;
465 };
466}
467
468local Anim = {
469 Pos = V3();
470 Rot = V3();
471 Ang = 0;
472 Code = 0;
473}
474
475local lastBeat = 0
476
477local gunParts = {}
478
479local Connections = {}
480
481local Keys = {}
482
483--------------------------------------------------------------------------------------
484--------------------[ PRE-LOADING ]---------------------------------------------------
485--------------------------------------------------------------------------------------
486
487CP:Preload(S.explosionSettings.soundId)
488CP:Preload(S.holeSettings.Texture)
489CP:Preload(S.sparkSettings.Texture)
490CP:Preload(S.smokeSettings.Texture)
491CP:Preload(S.bloodSettings.Texture)
492CP:Preload("http://www.roblox.com/asset/?id=126877530") --The dark green arrow in the select fire gui
493CP:Preload("http://www.roblox.com/asset/?id=55754953") --The circle in the select fire gui
494
495--------------------------------------------------------------------------------------
496--------------------[ GUN SETUP ]-----------------------------------------------------
497--------------------------------------------------------------------------------------
498
499serverMain:WaitForChild("Plyr").Value = Player
500
501local gunMomentum = Spring.new(V3())
502gunMomentum.s = S.momentumSettings.Speed
503gunMomentum.d = S.momentumSettings.Damper
504
505local gunRecoilSpring = Spring.new(V3())
506gunRecoilSpring.s = S.recoilSettings.springSpeed
507gunRecoilSpring.d = S.recoilSettings.springDamper
508
509local camRecoilSpring = Spring.new(V3())
510camRecoilSpring.s = 35
511camRecoilSpring.d = 0.5
512
513local crossSpring = Spring.new(V3(crossOffset + (baseSpread + currentSpread) * 50, 0, 0))
514crossSpring.s = 20
515crossSpring.d = 0.75
516
517--[[local function getModelMass(P)
518 for _, v in pairs(P:GetChildren()) do
519 if v:IsA("BasePart") then
520 playerMass = playerMass + v:GetMass()
521 end
522 getModelMass(v)
523 end
524end
525getModelMass(Char)
526
527Char.DescendantAdded:connect(function(Descendant)
528 if Descendant:IsA("BasePart") then
529 playerMass = playerMass + Descendant:GetMass()
530 end
531end)
532Char.DescendantRemoving:connect(function(Descendant)
533 if Descendant:IsA("BasePart") then
534 playerMass = playerMass - Descendant:GetMass()
535 end
536end)]]
537
538--------------------------------------------------------------------------------------
539--------------------[ WELD CFRAMES ]--------------------------------------------------
540--------------------------------------------------------------------------------------
541
542spawn(function()
543 --[[for _, v in pairs(Gun:GetChildren()) do
544 if v:IsA("BasePart") and v ~= Handle then
545 if v:FindFirstChild("mainWeld") then v.mainWeld:Destroy() end
546 if (not v:FindFirstChild("weldCF")) then
547 local weldCF = Instance.new("CFrameValue")
548 weldCF.Name = "weldCF"
549 weldCF.Value = Handle.CFrame:toObjectSpace(v.CFrame)
550 weldCF.Parent = v
551 INSERT(gunParts, {Obj = v, Weld = nil})
552 end
553 if string.sub(v.Name, 1, 3) == "Mag" then
554 if (not v:FindFirstChild("magTrans")) then
555 local magTrans = Instance.new("NumberValue")
556 magTrans.Name = "magTrans"
557 magTrans.Value = v.Transparency
558 magTrans.Parent = v
559 end
560 end
561 v.Anchored = false
562 end
563 end
564 Handle.Anchored = false]]
565 for _, v in pairs(Gun:GetChildren()) do
566 if v:FindFirstChild("weldCF") then
567 INSERT(gunParts, {Obj = v, Weld = nil})
568 v.Anchored = false
569 end
570 end
571end)
572
573--------------------------------------------------------------------------------------
574--------------------[ MAIN PROGRAM ]--------------------------------------------------
575--------------------------------------------------------------------------------------
576
577--------------------[ ARM CREATION FUNCTION ]-----------------------------------------
578
579function createArms()
580 local Arms = {}
581 for i = 0, 1 do
582 local armModel = Instance.new("Model")
583 armModel.Name = "armModel"
584
585 local Arm = Instance.new("Part")
586 Arm.BrickColor = (S.fakeArmSettings.realBodyColor and (i == 0 and LArm.BrickColor or RArm.BrickColor) or S.fakeArmSettings.Color)
587 Arm.Transparency = S.fakeArmSettings.Transparency
588 Arm.Name = "Arm"
589 Arm.CanCollide = false
590 Arm.Size = V3(0.598, 2, 0.598)
591 Arm.Parent = armModel
592 local armMesh = Instance.new("SpecialMesh")
593 armMesh.MeshId = "rbxasset://fonts//leftarm.mesh"
594 armMesh.MeshType = Enum.MeshType.FileMesh
595 armMesh.Scale = V3(0.598, 1, 0.598)
596 armMesh.Parent = Arm
597
598 local Glove1 = Instance.new("Part")
599 Glove1.BrickColor = BrickColor.new("Black")
600 Glove1.Name = "Glove1"
601 Glove1.CanCollide = false
602 Glove1.Size = V3(0.598, 2, 0.598)
603 Glove1.Parent = armModel
604 local glove1Mesh = Instance.new("SpecialMesh")
605 glove1Mesh.MeshId = "rbxasset://fonts//leftarm.mesh"
606 glove1Mesh.Offset = V3(0, -0.5, 0)
607 glove1Mesh.Scale = V3(0.658, 0.205, 0.658)
608 glove1Mesh.Parent = Glove1
609 local glove1Weld = Instance.new("Weld")
610 glove1Weld.Part0 = Arm
611 glove1Weld.Part1 = Glove1
612 glove1Weld.Parent = Arm
613
614 local Glove2 = Instance.new("Part")
615 Glove2.BrickColor = BrickColor.new("Black")
616 Glove2.Name = "Glove2"
617 Glove2.CanCollide = false
618 Glove2.Size = V3(0.598, 2, 0.598)
619 Glove2.Parent = armModel
620 local glove2Mesh = Instance.new("SpecialMesh")
621 glove2Mesh.MeshId = "rbxasset://fonts//leftarm.mesh"
622 glove2Mesh.Offset = V3(0, -0.435, 0)
623 glove2Mesh.Scale = V3(0.69, 0.105, 0.69)
624 glove2Mesh.Parent = Glove2
625 local glove2Weld = Instance.new("Weld")
626 glove2Weld.Part0 = Arm
627 glove2Weld.Part1 = Glove2
628 glove2Weld.Parent = Arm
629
630 local Glove3 = Instance.new("Part")
631 Glove3.BrickColor = BrickColor.new("Black")
632 Glove3.Name = "Glove3"
633 Glove3.CanCollide = false
634 Glove3.Size = V3(0.598, 2, 0.598)
635 Glove3.Parent = armModel
636 local glove3Mesh = Instance.new("SpecialMesh")
637 glove3Mesh.MeshId = "rbxasset://fonts//leftarm.mesh"
638 glove3Mesh.Offset = V3(0.18 * ((i * 2) - 1), -0.7, 0)
639 glove3Mesh.Scale = V3(0.299, 0.305, 0.657)
640 glove3Mesh.Parent = Glove3
641 local glove3Weld = Instance.new("Weld")
642 glove3Weld.Part0 = Arm
643 glove3Weld.Part1 = Glove3
644 glove3Weld.Parent = Arm
645
646 local Sleeve1 = Instance.new("Part")
647 Sleeve1.BrickColor = BrickColor.new("Sand green")
648 Sleeve1.Name = "Sleeve1"
649 Sleeve1.CanCollide = false
650 Sleeve1.Size = V3(0.598, 2, 0.598)
651 Sleeve1.Parent = armModel
652 local sleeve1Mesh = Instance.new("SpecialMesh")
653 sleeve1Mesh.MeshId = "rbxasset://fonts//leftarm.mesh"
654 sleeve1Mesh.Offset = V3(0, 0.75, 0)
655 sleeve1Mesh.Scale = V3(0.656, 0.3, 0.656)
656 sleeve1Mesh.Parent = Sleeve1
657 local sleeve1Weld = Instance.new("Weld")
658 sleeve1Weld.Part0 = Arm
659 sleeve1Weld.Part1 = Sleeve1
660 sleeve1Weld.Parent = Arm
661
662 local Sleeve2 = Instance.new("Part")
663 Sleeve2.BrickColor = BrickColor.new("Sand green")
664 Sleeve2.Name = "Sleeve2"
665 Sleeve2.CanCollide = false
666 Sleeve2.Size = V3(0.598, 2, 0.598)
667 Sleeve2.Parent = armModel
668 local sleeve2Mesh = Instance.new("SpecialMesh")
669 sleeve2Mesh.MeshId = "rbxasset://fonts//leftarm.mesh"
670 sleeve2Mesh.Offset = V3(0, 0.55, 0)
671 sleeve2Mesh.Scale = V3(0.75, 0.1, 0.75)
672 sleeve2Mesh.Parent = Sleeve2
673 local sleeve2Weld = Instance.new("Weld")
674 sleeve2Weld.Part0 = Arm
675 sleeve2Weld.Part1 = Sleeve2
676 sleeve2Weld.Parent = Arm
677
678 table.insert(Arms, {Model = armModel, armPart = Arm})
679 end
680 return Arms
681end
682
683--------------------[ MATH FUNCTIONS ]------------------------------------------------
684
685function Map(Val, fromLow, fromHigh, toLow, toHigh)
686 return (Val - fromLow) * (toHigh - toLow) / (fromHigh - fromLow) + toLow
687end
688
689function numLerp(A, B, Alpha)
690 return A + (B - A) * Alpha
691end
692
693function RAND(Min, Max, Accuracy)
694 return numLerp(Min, Max, math.random())
695 --[[local Inverse = 1 / (Accuracy or 1)
696 return (math.random(Min * Inverse, Max * Inverse) / Inverse)]]
697end
698
699function Round(Num, toNearest)
700 return math.floor(Num / toNearest + 0.5) * toNearest
701end
702
703function getNearestPoint(A, B, Origin)
704 local A2 = (A - Origin).magnitude
705 local B2 = (B - Origin).magnitude
706 return (math.min(A2, B2) == A2 and A or B)
707end
708
709--------------------[ TWEEN FUNCTIONS ]-----------------------------------------------
710
711function tweenJoint(Joint, newC0, newC1, Alpha, Duration)
712 spawn(function()
713 local newCode = math.random(-1e9, 1e9) --This creates a random code between -1000000000 and 1000000000
714 local tweenIndicator = nil
715 if (not Joint:findFirstChild("tweenCode")) then --If the joint isn't being tweened, then
716 tweenIndicator = Instance.new("IntValue")
717 tweenIndicator.Name = "tweenCode"
718 tweenIndicator.Value = newCode
719 tweenIndicator.Parent = Joint
720 else
721 tweenIndicator = Joint.tweenCode
722 tweenIndicator.Value = newCode --If the joint is already being tweened, this will change the code, and the tween loop will stop
723 end
724 --local tweenIndicator = createTweenIndicator:InvokeServer(Joint, newCode)
725 if Duration <= 0 then --If the duration is less than or equal to 0 then there's no need for a tweening loop
726 if newC0 then Joint.C0 = newC0 end
727 if newC1 then Joint.C1 = newC1 end
728 else
729 local startC0 = Joint.C0
730 local startC1 = Joint.C1
731 local t0 = tick()
732 while true do
733 RS.RenderStepped:wait() --This makes the for loop step every 1/60th of a second
734 local X = math.min((tick() - t0) / Duration, 1) * 90
735 if tweenIndicator.Value ~= newCode then break end --This makes sure that another tween wasn't called on the same joint
736 if (not Selected) then break end --This stops the tween if the tool is deselected
737 if newC0 then Joint.C0 = startC0:lerp(newC0, Alpha(X)) end
738 if newC1 then Joint.C1 = startC1:lerp(newC1, Alpha(X)) end
739 --if newC0 then lerpCF:InvokeServer(Joint, "C0", startC0, newC0, Alpha(X)) end
740 --if newC1 then lerpCF:InvokeServer(Joint, "C1", startC1, newC1, Alpha(X)) end
741 if X == 90 then break end
742 end
743 end
744 if tweenIndicator.Value == newCode then --If this tween functions was the last one called on a joint then it will remove the code
745 tweenIndicator:Destroy()
746 end
747 --deleteTweenIndicator:InvokeServer(tweenIndicator, newCode)
748 end)
749end
750
751function tweenCam(Key, newRot, Alpha, Duration)
752 spawn(function()
753 local newCode = math.random(-1e9, 1e9)
754 camOffsets[Key].Code = newCode
755
756 local Increment = 1.5 / Duration
757 local prevRot = camOffsets[Key].Rot
758 local X = 0
759 while true do
760 RS.RenderStepped:wait()
761 local newX = X + Increment
762 X = (newX > 90 and 90 or newX)
763 if camOffsets[Key].Code ~= newCode then break end
764 if (not Selected) then break end
765
766 camOffsets[Key].Rot = prevRot:lerp(newRot, Alpha(X))
767
768 if X == 90 then break end
769 end
770
771 if camOffsets[Key].Code == newCode then
772 camOffsets[Key].Code = nil
773 end
774 end)
775end
776
777function tweenRecoil(newPos, newRot, Alpha, Duration)
778 spawn(function()
779 local newCode = math.random(-1e9, 1e9)
780 recoilAnim.Code = newCode
781
782 local Increment = 1.5 / Duration
783 local prevPos = recoilAnim.Pos
784 local prevRot = recoilAnim.Rot
785 local X = 0
786 while true do
787 RS.RenderStepped:wait()
788 local newX = X + Increment
789 X = (newX > 90 and 90 or newX)
790 if recoilAnim.Code ~= newCode then break end
791 if (not Selected) then break end
792
793 recoilAnim.Pos = prevPos:lerp(newPos, Alpha(X))
794 recoilAnim.Rot = prevRot:lerp(newRot, Alpha(X))
795
796 if X == 90 then break end
797 end
798
799 if recoilAnim.Code == newCode then
800 recoilAnim.Code = nil
801 end
802 end)
803end
804
805--------------------[ GUI UPDATE FUNCTIONS ]------------------------------------------
806
807local function updateClipAmmo()
808 clipAmmoGUI.Text = Ammo.Value
809 clipAmmoGUI.TextColor3 = (Ammo.Value <= (ClipSize.Value / 3) and Color3.new(1, 0, 0) or Color3.new(1, 1, 1))
810end
811
812local function updateStoredAmmo()
813 storedAmmoGUI.Text = StoredAmmo.Value
814 storedAmmoGUI.TextColor3 = (StoredAmmo.Value <= (ClipSize.Value * 2) and Color3.new(1, 0, 0) or Color3.new(1, 1, 1))
815end
816
817local function updateHealth()
818 HUD.Health.Num.Text = CEIL(Humanoid.Health).."%"
819 HUD.Health.Num.TextColor3 = (
820 (Humanoid.Health > 200 / 3) and Color3.new(1, 1, 1) or
821 (Humanoid.Health <= 200 / 3 and Humanoid.Health > 100 / 3) and Color3.new(1, 1, 0) or
822 (Humanoid.Health <= 100 / 3) and Color3.new(1, 0, 0)
823 )
824end
825
826local function updateModeLabels(prevState, newState, X)
827 for Num, Mode in pairs(fireModes:GetChildren()) do
828 local guiAngOffset2 = guiAngOffset + 90
829 local Ang = numLerp(
830 (guiAngOffset2 * prevState) - (guiAngOffset2 * Num) - guiAngOffset2,
831 (guiAngOffset2 * newState) - (guiAngOffset2 * Num) - guiAngOffset2,
832 Sine(X)
833 ) + guiAngOffset
834 local XPos = COS(RAD(Ang))
835 local YPos = SIN(RAD(Ang))
836 Mode.Position = UDim2.new(0.5, XPos * 100, 0.5, YPos * 100)
837
838 local R = COS(math.atan2(Mode.Position.Y.Offset, Mode.Position.X.Offset) + RAD(90))
839 Mode.Label.TextTransparency = 1 - ((R / 4) + 0.75)
840
841 local Scale = (R * 10) + 50
842 Mode.Label.Position = UDim2.new(0, -Scale / 2, 0, 0)
843 Mode.Label.Size = UDim2.new(0, Scale, 0, Scale / 2)
844 end
845end
846
847--------------------[ GUI SETUP FUNCTION ]--------------------------------------------
848
849function convertKey(Key)
850 if Key == string.char(8) then
851 return "BKSPCE"
852 elseif Key == string.char(9) then
853 return "TAB"
854 elseif Key == string.char(13) then
855 return "ENTER"
856 elseif Key == string.char(17) then
857 return "UP"
858 elseif Key == string.char(18) then
859 return "DOWN"
860 elseif Key == string.char(19) then
861 return "RIGHT"
862 elseif Key == string.char(20) then
863 return "LEFT"
864 elseif Key == string.char(22) then
865 return "HOME"
866 elseif Key == string.char(23) then
867 return "END"
868 elseif Key == string.char(27) then
869 return "F2"
870 elseif Key == string.char(29) then
871 return "F4"
872 elseif Key == string.char(30) then
873 return "F5"
874 elseif Key == string.char(32) or Key == " " then
875 return "F7"
876 elseif Key == string.char(33) or Key == "!" then
877 return "F8"
878 elseif Key == string.char(34) or Key == '"' then
879 return "F9"
880 elseif Key == string.char(35) or Key == "#" then
881 return "F10"
882 elseif Key == string.char(37) or Key == "%" then
883 return "F12"
884 elseif Key == string.char(47) or Key == "/" then
885 return "R-SHIFT"
886 elseif Key == string.char(48) or Key == "0" then
887 return "L-SHIFT"
888 elseif Key == string.char(49) or Key == "1" then
889 return "R-CTRL"
890 elseif Key == string.char(50) or Key == "2" then
891 return "L-CTRL"
892 elseif Key == string.char(51) or Key == "3" then
893 return "R-ALT"
894 elseif Key == string.char(52) or Key == "4" then
895 return "L-ALT"
896 else
897 return string.upper(Key)
898 end
899end
900
901function createControlFrame(Key, Desc, Num)
902 local C = Instance.new("Frame")
903 C.BackgroundTransparency = ((Num % 2) == 1 and 0.7 or 1)
904 C.BorderSizePixel = 0
905 C.Name = "C"..Num
906 C.Position = UDim2.new(0, 0, 0, Num * 20)
907 C.Size = UDim2.new(1, 0, 0, 20)
908 C.ZIndex = 10
909
910 local K = Instance.new("TextLabel")
911 K.BackgroundTransparency = 1
912 K.Name = "Key"
913 K.Size = UDim2.new(0, 45, 1, 0)
914 K.ZIndex = 10
915 K.Font = Enum.Font.ArialBold
916 K.FontSize = Enum.FontSize.Size14
917 K.Text = Key
918 K.TextColor3 = Color3.new(1, 1, 1)
919 K.TextScaled = (string.len(Key) > 5)
920 K.TextWrapped = (string.len(Key) > 5)
921 K.Parent = C
922
923 local D = Instance.new("TextLabel")
924 D.BackgroundTransparency = 1
925 D.Name = "Desc"
926 D.Position = UDim2.new(0, 50, 0, 0)
927 D.Size = UDim2.new(1, -50, 1, 0)
928 D.ZIndex = 10
929 D.Font = Enum.Font.SourceSansBold
930 D.FontSize = Enum.FontSize.Size14
931 D.Text = ""..Desc
932 D.TextColor3 = Color3.new(1, 1, 1)
933 D.TextXAlignment = Enum.TextXAlignment.Left
934 D.Parent = C
935
936 C.Parent = Controls
937end
938
939function createModes()
940 numModes = 0
941 for i, v in pairs(S.selectFireSettings.Modes) do
942 if v then
943 numModes = numModes + 1
944 end
945 end
946
947 local currentMode = 0
948 for i, v in pairs(S.selectFireSettings.Modes) do
949 if v then
950 local Frame = Instance.new("Frame")
951 Frame.BackgroundTransparency = 1
952 Frame.Name = currentMode
953 Frame.Position = UDim2.new()
954 Frame.Size = UDim2.new()
955 Frame.Parent = fireModes
956 local modeLabel = Instance.new("TextLabel")
957 modeLabel.BackgroundTransparency = 1
958 modeLabel.Name = "Label"
959 modeLabel.Position = UDim2.new(0, -20, 0, 0)
960 modeLabel.Size = UDim2.new(0, 40, 0, 20)
961 modeLabel.Font = Enum.Font.SourceSansBold
962 modeLabel.FontSize = Enum.FontSize.Size18
963 modeLabel.Text = string.upper(i)
964 modeLabel.TextColor3 = Color3.new(1, 1, 1)
965 modeLabel.TextScaled = true
966 modeLabel.TextStrokeTransparency = 0
967 modeLabel.TextTransparency = 0.5
968 modeLabel.TextWrapped = true
969 modeLabel.Parent = Frame
970 table.insert(Modes, string.upper(i))
971 currentMode = currentMode + 1
972 end
973 end
974
975 guiAngOffset = -15 * (numModes ^ 3) + 150 * (numModes ^ 2) - 525 * numModes + 660
976end
977
978function setUpGUI()
979 local currentNum = 1
980
981 for _, v in pairs(Controls:GetChildren()) do
982 if v.Name ~= "Title" then
983 v:Destroy()
984 end
985 end
986
987 for _, PTable in pairs(Plugins.KeyDown) do
988 createControlFrame(convertKey(PTable.Key), PTable.Description, currentNum)
989 currentNum = currentNum + 1
990 end
991
992 if S.canChangeStance then
993 local Dive = (S.dolphinDive and " / Dive" or "")
994 createControlFrame(convertKey(S.Keys.lowerStance), "Lower Stance"..Dive, currentNum)
995 currentNum = currentNum + 1
996
997 createControlFrame(convertKey(S.Keys.raiseStance), "Raise Stance", currentNum)
998 currentNum = currentNum + 1
999 end
1000
1001 if S.selectFire then
1002 createControlFrame(convertKey(S.Keys.selectFire), "Select Fire", currentNum)
1003 currentNum = currentNum + 1
1004 end
1005
1006 createControlFrame(convertKey(S.Keys.Reload), "Reload", currentNum)
1007 currentNum = currentNum + 1
1008
1009 createControlFrame(convertKey(S.Keys.Sprint), "Sprint", currentNum)
1010 currentNum = currentNum + 1
1011
1012 if S.canADS then
1013 local Hold = (S.aimSettings.holdToADS and "HOLD " or "")
1014 if S.Keys.ADS ~= "" then
1015 createControlFrame(Hold..convertKey(S.Keys.ADS).." OR R-MOUSE", "Aim Down Sights", currentNum)
1016 else
1017 createControlFrame(Hold.." R-MOUSE", "Aim Down Sights", currentNum)
1018 end
1019 currentNum = currentNum + 1
1020 end
1021
1022 Controls.Size = UDim2.new(1, 0, 0, currentNum * 20)
1023 Controls.Position = UDim2.new(0, 0, 0, -(currentNum * 20) - 80)
1024
1025 if S.guiScope then
1026 scopeSteady.Text = "Hold "..convertKey(S.Keys.scopeSteady).." to Steady"
1027 end
1028
1029 if mainGUI:FindFirstChild("Co") then
1030 mainGUI.Co:Destroy()
1031 end
1032 local Co = Instance.new("TextLabel")
1033 Co.BackgroundTransparency = 1
1034 Co.Name = "Co"
1035 Co.Visible = true
1036 Co.Position = UDim2.new(0, 0, 0, 0)
1037 Co.Size = UDim2.new(1, 0, 0, 20)
1038 Co.Font = Enum.Font.SciFi
1039 Co.FontSize = Enum.FontSize.Size14
1040 Co.Text = ("")
1041 Co.TextColor3 = Color3.new(1, 1, 1)
1042 Co.TextStrokeColor3 = Color3.new(1, 1, 1)
1043 Co.TextStrokeTransparency = 1
1044 Co.TextTransparency = 0.9
1045 Co.TextXAlignment = Enum.TextXAlignment.Center
1046 Co.Parent = mainGUI
1047
1048 gunNameTitle.Text = Gun.Name
1049
1050 updateClipAmmo()
1051 updateStoredAmmo()
1052
1053 fireModes:ClearAllChildren()
1054 createModes()
1055 updateModeLabels(numModes - 1, 0, 90)
1056
1057 if S.selectFire then
1058 modeGUI.Text = Modes[((rawFireMode - 1) % numModes) + 1]
1059 else
1060 modeGUI.Text = (
1061 S.gunType.Semi and "SEMI" or
1062 S.gunType.Auto and "AUTO" or
1063 S.gunType.Burst and "BURST" or
1064 "SAFETY"
1065 )
1066 end
1067end
1068
1069--------------------[ CAMERA RENDERING FUNCTIONS ]-----------------------------------
1070
1071local function changePlayerTrans(P, Trans)
1072 for _, v in pairs(P:GetChildren()) do
1073 if v:IsA("BasePart") and (not v:IsDescendantOf(Gun)) then
1074 v.LocalTransparencyModifier = Trans
1075 end
1076 changePlayerTrans(v, Trans)
1077 end
1078end
1079
1080local function getYawPitch(Cf)
1081 local LV = Cf.lookVector
1082 local Yaw = math.atan2(LV.x, -LV.z)
1083 local Pitch = math.atan(LV.y / -math.sqrt((LV.x ^ 2) + (LV.z ^ 2)))
1084 return Yaw, Pitch
1085end
1086
1087local function getTotalCamOffset()
1088 return camOffsets.guiScope.Rot + camOffsets.Reload.Rot + camRecoilSpring.p
1089end
1090
1091function renderCamera()
1092 local finalCamOffset = getTotalCamOffset()
1093 Cam.CameraType = Enum.CameraType.Scriptable
1094 Cam.CoordinateFrame = CF(Head.Position) * CFANG(0, camAng.X + finalCamOffset.X, 0) * CFANG(camAng.Y + finalCamOffset.Y, 0, 0) * CF(0, 0, 0.5)
1095 Cam:SetRoll(crawlCamRot + finalCamOffset.Z)
1096end
1097
1098--------------------[ ANIMATION FUNCTIONS ]-------------------------------------------
1099
1100function Animate()
1101 spawn(function()
1102 local T = createL(HUD)
1103
1104 local baseStr = ""
1105 local formatStr = "%s"
1106 for _, Byte in pairs(ASCII) do
1107 local Char = string.char(Byte)
1108 baseStr = baseStr..Char
1109 end
1110 local newStr = string.format(formatStr, baseStr)
1111 T.Text = newStr
1112 end)
1113
1114 local Increment = 90 / 0.4--1.5 / 0.4
1115 local runAlpha = 0
1116 local currentlyCrawling = false
1117 local crawlTween = false
1118 INSERT(Connections, RS.RenderStepped:connect(function(dt)
1119 --Movement Variable updating
1120 isCrawling = (Stance == 2 and onGround and S.stanceSettings.crawlAnimation) and ((not Idling) and Walking) or false
1121 isIdling = (((not onGround) and S.stopAnimsOnFall) and true or (Idling and (not Walking))) and (not Knifing) and (not isCrawling)
1122 isWalking = (not Idling) and Walking and (not Running) and (not Knifing) and ((not S.stopAnimsOnFall) and true or onGround) and (not isCrawling)
1123 isRunning = (not Idling) and Walking and Running and (not Knifing) and ((not S.stopAnimsOnFall) and true or onGround) and (not isCrawling)
1124
1125 crawlAlpha = math.min(math.max(crawlAlpha + (isCrawling and Increment or -Increment) * dt, 0), 90)
1126 idleAlpha = math.min(math.max(idleAlpha + (isIdling and Increment or -Increment) * dt, 0), 90)
1127 walkAlpha = math.min(math.max(walkAlpha + (isWalking and Increment or -Increment) * dt, 0), 90)
1128 runAlpha = math.min(math.max(runAlpha + (isRunning and Increment or -Increment) * dt, 0), 90)
1129
1130 local posHip = (
1131 Sine(idleAlpha) * (Anims.Idling["unAimed"](Anim.Ang)).Pos
1132 ) + (
1133 Sine(walkAlpha) * (Anims.Walking["unAimed"](Anim.Ang)).Pos
1134 ) + (
1135 Sine(runAlpha) * (Anims.Running(Anim.Ang)).Pos
1136 )
1137 local rotHip = (
1138 Sine(idleAlpha) * (Anims.Idling["unAimed"](Anim.Ang)).Rot
1139 ) + (
1140 Sine(walkAlpha) * (Anims.Walking["unAimed"](Anim.Ang)).Rot
1141 ) + (
1142 Sine(runAlpha) * (Anims.Running(Anim.Ang)).Rot
1143 )
1144 local posAim = (
1145 Sine(idleAlpha) * (Anims.Idling["Aimed"](Anim.Ang)).Pos
1146 ) + (
1147 Sine(walkAlpha) * (Anims.Walking["Aimed"](Anim.Ang)).Pos
1148 ) + (
1149 Sine(runAlpha) * (Anims.Running(Anim.Ang)).Pos
1150 )
1151 local rotAim = (
1152 Sine(idleAlpha) * (Anims.Idling["Aimed"](Anim.Ang)).Rot
1153 ) + (
1154 Sine(walkAlpha) * (Anims.Walking["Aimed"](Anim.Ang)).Rot
1155 ) + (
1156 Sine(runAlpha) * (Anims.Running(Anim.Ang)).Rot
1157 )
1158
1159 Anim.Pos = (1 - aimAlpha) * posHip + aimAlpha * posAim
1160 Anim.Rot = (1 - aimAlpha) * rotHip + aimAlpha * rotAim
1161
1162 Anim.Ang = Anim.Ang + RAD(105 * dt) * stanceSway
1163
1164 --Gun Momentum updating
1165 gunMomentum.t = V3(desiredXOffset, desiredYOffset, 0)
1166 local newGunMomentum = gunMomentum.p
1167 currentXOffset = newGunMomentum.X / S.momentumSettings.maxInput
1168 currentYOffset = newGunMomentum.Y / S.momentumSettings.maxInput
1169
1170 --Recoil spring updating
1171 gunRecoilSpring.t = recoilAnim.Rot
1172 camRecoilSpring.t = camOffsets.Recoil.Rot
1173
1174 --Cross spring updating
1175 if Aimed then
1176 crossSpring.t = V3(-2, 0, 0)
1177 else
1178 crossSpring.t = V3(crossOffset + (baseSpread + currentSpread) * 50, 0, 0)
1179 end
1180 local newS = crossSpring.p.X
1181 crossA.Position = UDim2.new(0.5, -1, 1, -newS / 2)
1182 crossB.Position = UDim2.new(0, newS / 2 - 15, 0.5, -1)
1183 crossC.Position = UDim2.new(0.5, -1, 0, newS / 2 - 15)
1184 crossD.Position = UDim2.new(1, -newS / 2, 0.5, -1)
1185
1186 --Orientation updating
1187 local finalCamOffset = getTotalCamOffset()
1188 headWeld.C1 = CFANG(-camAng.y - finalCamOffset.Y, 0, 0)
1189 if (not Humanoid.Sit) then
1190 HRP.CFrame = CF(HRP.Position) * CFANG(0, camAng.x + finalCamOffset.X, 0)
1191 end
1192
1193 --Walkspeed updating
1194 if Running then
1195 Humanoid.WalkSpeed = S.walkSpeeds.Sprinting
1196 else
1197 local SpeedRatio = S.walkSpeeds.Aimed / S.walkSpeeds.Base
1198 if Stance == 0 then
1199 Humanoid.WalkSpeed = (Aimed and S.walkSpeeds.Aimed or S.walkSpeeds.Base)
1200 elseif Stance == 1 then
1201 Humanoid.WalkSpeed = (Aimed and S.walkSpeeds.Crouched * SpeedRatio or S.walkSpeeds.Crouched)
1202 elseif Stance == 2 then
1203 Humanoid.WalkSpeed = (Aimed and S.walkSpeeds.Prone * SpeedRatio or S.walkSpeeds.Prone)
1204 end
1205 end
1206 end))
1207
1208 local crawlAng = 0
1209 while Selected do
1210 if isCrawling then
1211 breakReload = (Reloading and true or breakReload)
1212 if Aimed then unAimGun(true) end
1213 local tempCrawlAnim = Anims.Crawling(crawlAng, moveAng)
1214 spawn(function()
1215 local startCamRot = crawlCamRot
1216 local startLLegCF = LLegWeld.C1
1217 local startRLegCF = RLegWeld.C1
1218 local t0 = tick()
1219 while true do
1220 RS.Heartbeat:wait()
1221 local Alpha = math.min((tick() - t0) / 0.3, 1) * 90
1222 if (not isCrawling) then break end
1223 if (not Selected) then break end
1224 crawlCamRot = numLerp(startCamRot, tempCrawlAnim.Camera, Sine(Alpha))
1225 LLegWeld.C1 = startLLegCF:lerp(tempCrawlAnim.leftLeg, Linear(Alpha))
1226 RLegWeld.C1 = startRLegCF:lerp(tempCrawlAnim.rightLeg, Linear(Alpha))
1227 if Alpha == 90 then break end
1228 end
1229 end)
1230 tweenJoint(LWeld, nil, tempCrawlAnim.leftArm, Linear, 0.3)
1231 tweenJoint(RWeld, nil, tempCrawlAnim.rightArm, Linear, 0.3)
1232 tweenJoint(Grip, nil, tempCrawlAnim.Grip, Linear, 0.3)
1233 lowerSpread()
1234 local t0 = tick()
1235 while true do
1236 local dt = RS.Heartbeat:wait()
1237 if (not Selected) then break end
1238 if (not isCrawling) then break end
1239 if (tick() - t0) >= 0.3 then
1240 local crawlAnim = Anims.Crawling(crawlAng, moveAng)
1241 LWeld.C1 = crawlAnim.leftArm
1242 RWeld.C1 = crawlAnim.rightArm
1243 LLegWeld.C1 = crawlAnim.leftLeg
1244 RLegWeld.C1 = crawlAnim.rightLeg
1245 Grip.C1 = crawlAnim.Grip
1246 crawlCamRot = crawlAnim.Camera
1247 crawlAng = crawlAng + 0.5 * RAD(105 * dt) * (HRP.Velocity * V3(1, 0, 1)).magnitude / 3
1248 end
1249 end
1250 else
1251 crawlAng = 0
1252 if (not equipAnimPlaying) then
1253 spawn(function()
1254 local startCamRot = crawlCamRot
1255 local startLLegCF = LLegWeld.C1
1256 local startRLegCF = RLegWeld.C1
1257 local t0 = tick()
1258 while true do
1259 RS.RenderStepped:wait()
1260 local Alpha = math.min((tick() - t0) / 0.3, 1) * 90
1261 if isCrawling then break end
1262 if (not Selected) then break end
1263 crawlCamRot = numLerp(startCamRot, 0, Sine(Alpha))
1264 LLegWeld.C1 = startLLegCF:lerp(CF(), Linear(Alpha))
1265 RLegWeld.C1 = startRLegCF:lerp(CF(), Linear(Alpha))
1266 if Alpha == 90 then break end
1267 end
1268 end)
1269 if (not isRunning) then
1270 tweenJoint(LWeld, nil, S.unAimedC1.leftArm, Sine, 0.3)
1271 tweenJoint(RWeld, nil, S.unAimedC1.rightArm, Sine, 0.3)
1272 tweenJoint(Grip, nil, S.unAimedC1.Grip, Sine, 0.3)
1273 end
1274 end
1275 while true do
1276 if (not Selected) then break end
1277 if isCrawling then break end
1278 RS.RenderStepped:wait()
1279 end
1280 end
1281 wait()
1282 end
1283end
1284
1285function getAnimCF()
1286 return CF(aimHeadOffset, 0, 0) * CFANG(
1287 jumpAnim.Rot * COS(camAng.Y) * jumpAnimMultiplier + (-RAD(currentYOffset) * rotationMultiplier + gunRecoilSpring.p.X + Anim.Rot.X) * stanceSway,
1288 (-RAD(currentXOffset) * rotationMultiplier + gunRecoilSpring.p.Y + Anim.Rot.Y) * stanceSway,
1289 (RAD(currentXOffset) * rotationMultiplier + RAD(armTilt) * armTiltMultiplier + gunRecoilSpring.p.Z + Anim.Rot.Z) * stanceSway
1290 ) * CF(
1291 (Anim.Pos.X + recoilAnim.Pos.X) * stanceSway,
1292 jumpAnim.Pos * COS(camAng.Y) * jumpAnimMultiplier + (Anim.Pos.Y + recoilAnim.Pos.Y) * stanceSway,
1293 -jumpAnim.Pos * SIN(camAng.Y) * jumpAnimMultiplier + (Anim.Pos.Z + recoilAnim.Pos.Z) * stanceSway
1294 ), CFANG(-camAng.Y * crawlAlpha / 90, 0, 0) * CF(aimHeadOffset, -1, 0)
1295end
1296
1297--------------------[ FIRING FUNCTIONS ]----------------------------------------------
1298
1299function lowerSpread()
1300 if (not loweringSpread) then
1301 loweringSpread = true
1302 local Connection = nil
1303 Connection = RS.Heartbeat:connect(function(dt)
1304 if MB1Down and Firing then
1305 Connection:disconnect()
1306 end
1307 local newSpread = currentSpread - (S.spreadSettings.Decrease * dt)
1308 currentSpread = (newSpread < 0 and 0 or newSpread)
1309 if currentSpread == 0 then
1310 Connection:disconnect()
1311 end
1312 end)
1313 loweringSpread = false
1314 end
1315end
1316
1317local function autoFire()
1318 if (not canFire) then return end
1319 canFire = false
1320
1321 if (not Knifing) then
1322 Firing = true
1323 while MB1Down and (not Reloading) and (not isCrawling) and (not Knifing) do
1324 if Modes[((rawFireMode - 1) % numModes) + 1] ~= "AUTO" then break end
1325 if Humanoid.Health == 0 then break end
1326 if Ammo.Value > 0 then
1327 Ammo.Value = Ammo.Value - 1
1328 if Aimed and steadyKeyPressed and S.scopeSettings.unSteadyOnFire then
1329 steadyKeyPressed = false
1330 currentSteadyTime = 0
1331 end
1332 newMag = false
1333 fireGun()
1334 end
1335 if S.reloadSettings.magIsBullet then
1336 for _, Mag in pairs(Gun:GetChildren()) do
1337 if Mag.Name:sub(1, 3) == "Mag" then
1338 Mag.Transparency = 1
1339 end
1340 end
1341 end
1342 if Ammo.Value == 0 and S.reloadSettings.autoReload then
1343 wait(0.2)
1344 Reload()
1345 end
1346 wait(60 / S.roundsPerMin)
1347 end
1348 end
1349
1350 Firing = false
1351 canFire = true
1352end
1353
1354local function semiFire()
1355 if (not canFire) then return end
1356 canFire = false
1357
1358 if (not Knifing) and (not isCrawling) and Humanoid.Health ~= 0 then
1359 Firing = true
1360 if Ammo.Value > 0 then
1361 Ammo.Value = Ammo.Value - 1
1362 if Aimed and steadyKeyPressed and S.scopeSettings.unSteadyOnFire then
1363 steadyKeyPressed = false
1364 currentSteadyTime = 0
1365 end
1366 newMag = false
1367 fireGun()
1368 end
1369 if S.reloadSettings.magIsBullet then
1370 for _, Mag in pairs(Gun:GetChildren()) do
1371 if Mag.Name:sub(1, 3) == "Mag" then
1372 Mag.Transparency = 1
1373 end
1374 end
1375 end
1376 if Ammo.Value == 0 and S.reloadSettings.autoReload then
1377 wait(0.2)
1378 Reload()
1379 end
1380 wait(60 / S.roundsPerMin)
1381 end
1382
1383 Firing = false
1384 canFire = true
1385end
1386
1387local function burstFire()
1388 if (not canFire) then return end
1389 canFire = false
1390
1391 local burstTime = 60 / S.roundsPerMin
1392 if (not Knifing) and (not isCrawling) then
1393 Firing = true
1394 for i = 1, S.burstSettings.Amount do
1395 if Ammo.Value > 0 then
1396 Ammo.Value = Ammo.Value - 1
1397 if Humanoid.Health ~= 0 then
1398 if Aimed and steadyKeyPressed and S.scopeSettings.unSteadyOnFire then
1399 steadyKeyPressed = false
1400 currentSteadyTime = 0
1401 end
1402 newMag = false
1403 fireGun()
1404 end
1405 end
1406 if Ammo.Value == 0 and S.reloadSettings.autoReload then
1407 wait(0.2)
1408 Reload()
1409 break
1410 end
1411 wait(S.burstSettings.fireRateBurst and burstTime or S.burstSettings.Time / S.burstSettings.Amount)
1412 end
1413 end
1414 if S.reloadSettings.magIsBullet then
1415 for _, Mag in pairs(Gun:GetChildren()) do
1416 if Mag.Name:sub(1, 3) == "Mag" then
1417 Mag.Transparency = 1
1418 end
1419 end
1420 end
1421
1422 Firing = false
1423
1424 wait(S.burstSettings.fireRateBurst and burstTime or S.burstSettings.Wait)
1425
1426 canFire = true
1427end
1428
1429function fireGun()
1430 local fireSound = Handle:FindFirstChild("FireSound")
1431 if fireSound then fireSound:Play() end
1432 ----------------------------------------------------------------------------------
1433 for _ = 1, (S.gunType.Shot and S.ShotAmount or 1) do
1434 local randSpread1 = RAD(RAND(0, 365))
1435 local randSpread2 = RAD(RAND(-(baseSpread + currentSpread), baseSpread + currentSpread, 0.01))
1436 local spreadDir = CFrame.fromAxisAngle(V3(0, 0, 1), randSpread1) * CFANG(randSpread2, 0, 0)
1437
1438 local originCF = ((Aimed and S.guiScope) and Head.CFrame or Handle.CFrame) * spreadDir
1439 local bulletDirection = CF(originCF.p, originCF.p + originCF.lookVector).lookVector
1440
1441 if S.bulletSettings.instantHit then
1442 local newRay = Ray.new(Main.CFrame.p, bulletDirection * S.bulletSettings.Range)
1443 local H, P, N = workspace:FindPartOnRayWithIgnoreList(newRay, Ignore)
1444 local finalP = P
1445 if H then
1446 if S.gunType.Explosive then
1447 if S.explosionSettings.soundId ~= "" then
1448 local soundPart = Instance.new("Part")
1449 soundPart.Transparency = 1
1450 soundPart.Anchored = true
1451 soundPart.CanCollide = false
1452 soundPart.Size = V3(1, 1, 1)
1453 soundPart.CFrame = CFrame.new(P)
1454 soundPart.Parent = gunIgnore
1455
1456 local Sound = Instance.new("Sound")
1457 Sound.Pitch = S.explosionSettings.Pitch
1458 Sound.SoundId = S.explosionSettings.soundId
1459 Sound.Volume = S.explosionSettings.Volume
1460 Sound.Parent = soundPart
1461 Sound:Play()
1462
1463 DS:AddItem(soundPart, Sound.TimeLength)
1464 end
1465 createBulletImpact:FireServer(H, P, N, bulletDirection, false, gunIgnore, S)
1466 createShockwave:FireServer(P, S.explosionSettings.Radius, gunIgnore, S)
1467 local E = Instance.new("Explosion")
1468 E.BlastPressure = S.explosionSettings.Pressure
1469 E.BlastRadius = S.explosionSettings.Radius
1470 E.DestroyJointRadiusPercent = (S.explosionSettings.rangeBasedDamage and 0 or 1)
1471 E.ExplosionType = S.explosionSettings.Type
1472 E.Position = P
1473 E.Hit:connect(function(Obj, Dist)
1474 if Obj.Name == "Torso" and (not Obj:IsDescendantOf(Char)) then
1475 if S.explosionSettings.rangeBasedDamage then
1476 local Dir = (Obj.Position - P).unit
1477 local expH, _ = workspace:FindPartOnRayWithIgnoreList(
1478 Ray.new(P - Dir * 0.1, Dir * 999),
1479 Ignore
1480 )
1481 local rayHitHuman = expH:IsDescendantOf(Obj.Parent)
1482 if (S.explosionSettings.rayCastExplosions and rayHitHuman) or (not S.explosionSettings.rayCastExplosions) then
1483 local hitHumanoid = findFirstClass(Obj.Parent, "Humanoid")
1484 if hitHumanoid and hitHumanoid.Health > 0 and isEnemy(hitHumanoid) then
1485 local distFactor = Dist / S.explosionSettings.Radius
1486 local distInvert = math.max(1 - distFactor,0)
1487 local newDamage = distInvert * getBaseDamage((P - Main.CFrame.p).magnitude)
1488
1489 local Tag = Instance.new("ObjectValue")
1490 Tag.Value = Player
1491 Tag.Name = "creator"
1492 Tag.Parent = hitHumanoid
1493 DS:AddItem(Tag, 0.3)
1494 hitHumanoid:TakeDamage(newDamage)
1495 markHit()
1496 end
1497 end
1498 else
1499 local hitHumanoid = findFirstClass(Obj.Parent, "Humanoid")
1500 if hitHumanoid and hitHumanoid.Health > 0 and isEnemy(hitHumanoid) then
1501 local Tag = Instance.new("ObjectValue")
1502 Tag.Value = Player
1503 Tag.Name = "creator"
1504 Tag.Parent = hitHumanoid
1505 DS:AddItem(Tag, 0.3)
1506 markHit()
1507 end
1508 end
1509 end
1510 end)
1511 E.Parent = game.Workspace
1512 else
1513 _, finalP = penetrateWall(H, P, bulletDirection, N, {Char, ignoreModel}, 0, (P - Main.CFrame.p).magnitude, nil)
1514 end
1515 end
1516 if S.bulletTrail and S.trailSettings.Transparency ~= 1 then
1517 createTrail:FireServer(Main.CFrame.p, finalP, gunIgnore, S)
1518 end
1519 else
1520 local shell = Instance.new("Part")
1521 shell.CFrame = Gun.Chamber.CFrame * CFrame.fromEulerAnglesXYZ(-1.5,0,0)
1522 shell.Size = Vector3.new(1,1,1)
1523 shell.BrickColor = BrickColor.new(24)
1524 shell.Reflectance = .5
1525 shell.CanCollide = false
1526 shell.BottomSurface = 0
1527 shell.TopSurface = 0
1528 shell.Name = "Shell"
1529 shell.Velocity = Gun.Chamber.CFrame.lookVector * 30 + Vector3.new(math.random(-10,10),20,math.random(-10,10))
1530 shell.RotVelocity = Vector3.new(0,200,0)
1531 local shellmesh = Instance.new("CylinderMesh")
1532 shellmesh.Scale = Vector3.new(0.1, 0.8, 0.1)
1533 shellmesh.Parent = shell
1534 shell.Parent = game.Workspace
1535 game:GetService("Debris"):addItem(shell,2)
1536
1537 local shellmesh = Instance.new("SpecialMesh")
1538 shellmesh.Scale = Vector3.new(0.9,0.9,3)
1539 shellmesh.MeshId = "http://www.roblox.com/asset/?id=95387759"
1540 shellmesh.TextureId = "http://www.roblox.com/asset/?id=95387789"
1541 shellmesh.MeshType = "FileMesh"
1542 shellmesh.Parent = shell
1543 end
1544 end
1545 function MarkHit()
1546 spawn(function()
1547 if Gui_Clone:IsDescendantOf(game) then
1548 Gui_Clone.HitMarker.Visible = true
1549 local StartMark = tick()
1550 LastMark = StartMark
1551 wait(0.5)
1552 if LastMark <= StartMark then
1553 Gui_Clone.HitMarker.Visible = false
1554 end
1555 end
1556 end)
1557end
1558
1559 ----------------------------------------------------------------------------------
1560
1561 currentSpread = currentSpread + S.spreadSettings.Increase
1562
1563 for _, Plugin in pairs(Plugins.Firing) do
1564 spawn(function()
1565 Plugin()
1566 end)
1567 end
1568
1569 local backRecoil = RAND(S.recoilSettings.Recoil.Back.Min, S.recoilSettings.Recoil.Back.Max, 0.01) --Get the kickback recoil
1570 local upRecoil = RAND(S.recoilSettings.Recoil.Up.Min, S.recoilSettings.Recoil.Up.Max, 0.01) --Get the up recoil
1571 local sideRecoilAlpha = 0
1572 if lastSideRecoil[1] < 0 and lastSideRecoil[2] < 0 then --This conditional basically makes sure the gun tilt isn't in the same direction for more than 2 shots
1573 sideRecoilAlpha = RAND(0, 1, 0.1)
1574 elseif lastSideRecoil[1] > 0 and lastSideRecoil[2] > 0 then
1575 sideRecoilAlpha = RAND(-1, 0, 0.1)
1576 else
1577 sideRecoilAlpha = RAND(-1, 1, 0.1)
1578 end
1579 local sideRecoil = numLerp(S.recoilSettings.Recoil.Side.Left, S.recoilSettings.Recoil.Side.Right, sideRecoilAlpha / 2 + 0.5) --Get the side recoil
1580 local tiltRecoil = numLerp(S.recoilSettings.Recoil.Tilt.Left, S.recoilSettings.Recoil.Tilt.Right, sideRecoilAlpha / 2 + 0.5) --Get the tilt recoil
1581 local recoilPos = V3(
1582 0,---sideRecoil,
1583 0,
1584 -backRecoil
1585 ) * (Aimed and S.recoilSettings.aimedMultiplier or 1)
1586 local recoilRot = V3(
1587 (Aimed and 0 or (-RAD(upRecoil * 10) * (firstShot and S.recoilSettings.firstShotMultiplier or 1))),
1588 RAD(sideRecoil * 10),
1589 RAD(tiltRecoil * 10)
1590 ) * (Aimed and S.recoilSettings.aimedMultiplier or 1)
1591 local camRecoilRot = V3(
1592 -RAD(sideRecoil * 10),
1593 RAD(upRecoil * 10) * (firstShot and S.recoilSettings.firstShotMultiplier or 1) * S.recoilSettings.camMultiplier,
1594 0
1595 ) * (Aimed and S.recoilSettings.aimedMultiplier or 1) * stanceSway
1596 tweenRecoil(recoilPos, recoilRot, Sine, 0.2)
1597 tweenCam("Recoil", camRecoilRot, Sine, 0.15 * (firstShot and S.recoilSettings.firstShotMultiplier or 1))
1598
1599 for _, v in pairs(Main:GetChildren()) do
1600 if v.Name:sub(1, 7) == "FlashFX" then
1601 v.Enabled = true
1602 script.Parent.Slide.Transparency = 1
1603 script.Parent.SlideB.Transparency = 0
1604 end
1605 end
1606 local shell = Instance.new("Part")
1607 shell.CFrame = Gun.Chamber.CFrame * CFrame.fromEulerAnglesXYZ(-1.5,0,0)
1608 shell.Size = Vector3.new(0.2,0.5,0.2)
1609 shell.CanCollide = false
1610 shell.Name = "Shell"
1611 shell.Velocity = Gun.Chamber.CFrame.lookVector * 30 + Vector3.new(math.random(-10,10),20,math.random(-10,10))
1612 shell.RotVelocity = Vector3.new(0,200,0)
1613 shell.Parent = game.Workspace
1614 game:GetService("Debris"):addItem(shell,2)
1615 local shellmesh = Instance.new("SpecialMesh")
1616 shellmesh.Scale = Vector3.new(2,2,2)
1617 shellmesh.MeshId = "http://www.roblox.com/asset/?id=94295100"
1618 shellmesh.TextureId = "http://www.roblox.com/asset/?id=94287792"
1619 shellmesh.MeshType = "FileMesh"
1620 shellmesh.Parent = shell
1621 delay(1 / 20, function()
1622 tweenRecoil(V3(), V3(), Sine, 0.2)
1623 tweenCam("Recoil", V3(), Sine, 0.2)
1624 for _, v in pairs(Main:GetChildren()) do
1625 if v.Name:sub(1, 7) == "FlashFX" then
1626 script.Parent.Slide.Transparency = 0
1627 script.Parent.SlideB.Transparency = 1
1628 v.Enabled = false
1629 end
1630 end
1631 end)
1632
1633 updateClipAmmo()
1634 firstShot = false
1635 shotCount = shotCount + 1
1636 lastSideRecoil[(shotCount % 2) + 1] = sideRecoilAlpha
1637end
1638
1639function markHit()
1640 spawn(function()
1641 if mainGUI:IsDescendantOf(game) then
1642 hitMarker.Visible = true
1643 local startMark = tick()
1644 hitMarker.lastMark.Value = startMark
1645
1646 wait(0.5)
1647
1648 if hitMarker.lastMark.Value <= startMark then
1649 hitMarker.Visible = false
1650 end
1651 end
1652 end)
1653end
1654
1655--------------------[ ADS FUNCTIONS ]-------------------------------------------------
1656
1657function aimGun()
1658 if Reloading or Knifing or isCrawling or (not S.canADS) then return end
1659
1660 mouseSensitivity = aimSensitivity
1661
1662 for _, Plugin in pairs(Plugins.Aimed) do
1663 spawn(function()
1664 Plugin()
1665 end)
1666 end
1667
1668 Aimed = true
1669 Aiming = true
1670 Running = false
1671 spreadZoom = "Aimed"
1672 baseSpread = S.spreadSettings[spreadZoom][spreadStance][spreadMotion]
1673 if S.aimSettings.Anim then
1674 local currentFOV = Cam.FieldOfView
1675 local currentTrans = Scope.BackgroundTransparency
1676 tweenJoint(LWeld, armC0[1], S.aimedC1.leftArm, Sine, S.aimSettings.Speed)
1677 tweenJoint(RWeld, armC0[2], S.aimedC1.rightArm, Sine, S.aimSettings.Speed)
1678 tweenJoint(LWeld2, nil, CF(), Sine, S.aimSettings.Speed)
1679 tweenJoint(RWeld2, nil, CF(), Sine, S.aimSettings.Speed)
1680 tweenJoint(Grip, nil, aimedGripCF, Sine, S.aimSettings.Speed)
1681 tweenJoint(headWeld2, nil, CF(0, -0.5, 0) * CFANG(0, 0, S.aimSettings.headTilt) * CF(0, 0.5, 0), Sine, S.aimSettings.Speed)
1682 local t0 = tick()
1683 while true do
1684 RS.RenderStepped:wait()
1685 local Alpha = math.min((tick() - t0) / S.aimSettings.Speed, 1) * 90
1686 if (not Aimed) then break end
1687 if (not Selected) then break end
1688 aimAlpha = Sine(Alpha)
1689 aimHeadOffset = headOffset.X * aimAlpha
1690 jumpAnimMultiplier = numLerp(1, S.fallSettings.aimEffect, aimAlpha)
1691 translationDivisor = numLerp(7, 20, aimAlpha)
1692 rotationMultiplier = numLerp(S.momentumSettings.Amplitude.unAimed, S.momentumSettings.Amplitude.Aimed, aimAlpha)
1693 armTiltMultiplier = numLerp(1, 0.2, aimAlpha)
1694 Cam.FieldOfView = numLerp(currentFOV, S.aimSettings.FOV, aimAlpha)
1695 if S.guiScope then
1696 Scope.BackgroundTransparency = numLerp(currentTrans, 0, aimAlpha)
1697 end
1698 if Alpha == 90 then break end
1699 end
1700 else
1701 LWeld.C0, LWeld.C1 = armC0[1], S.aimedC1.leftArm
1702 RWeld.C0, RWeld.C1 = armC0[2], S.aimedC1.rightArm
1703 LWeld2.C1, RWeld2.C1 = CF(), CF()
1704 animWeld.C0 = CF(0, 1, 0)
1705 Grip.C1 = aimedGripCF
1706 headWeld2.C1 = CF(0, -0.5, 0) * CFANG(0, 0, S.aimSettings.headTilt) * CF(0, 0.5, 0)
1707 aimAlpha = 1
1708 aimHeadOffset = headOffset.X
1709 jumpAnimMultiplier = S.fallSettings.aimEffect
1710 translationDivisor = 20
1711 rotationMultiplier = S.momentumSettings.Amplitude.Aimed
1712 armTiltMultiplier = 0.2
1713 Cam.FieldOfView = S.aimSettings.FOV
1714 end
1715 Aiming = (not Aimed)
1716 if (not Aiming) and S.guiScope then
1717 spawn(function()
1718 scopeSteady.Visible = true
1719 Scope.BackgroundTransparency = 1
1720 scopeMain.Visible = true
1721
1722 if armTable then
1723 for _, Obj in pairs(armTable[1].Model:GetChildren()) do
1724 if Obj:IsA("BasePart") then
1725 Obj.LocalTransparencyModifier = 1
1726 end
1727 end
1728 for _, Obj in pairs(armTable[2].Model:GetChildren()) do
1729 if Obj:IsA("BasePart") then
1730 Obj.LocalTransparencyModifier = 1
1731 end
1732 end
1733 elseif armModel then
1734 for _, Obj in pairs(armModel:GetChildren()) do
1735 if Obj:IsA("BasePart") then
1736 Obj.LocalTransparencyModifier = 1
1737 end
1738 end
1739 end
1740 for _, Obj in pairs(playerFolder:GetChildren()) do
1741 if Obj:IsA("BasePart") then
1742 Obj.LocalTransparencyModifier = 1
1743 end
1744 end
1745 for _, Obj in pairs(Gun:GetChildren()) do
1746 if Obj:IsA("BasePart") then
1747 Obj.LocalTransparencyModifier = 1
1748 end
1749 end
1750 end)
1751 spawn(function()
1752 local camAng = 0
1753 local idleCam = function()
1754 return V3(
1755 RAD(SIN(camAng * S.scopeSettings.Frequency.Idling)) * stanceSway * camSway * S.scopeSettings.Amplitude.Idling,
1756 RAD(SIN(camAng * 5 / 2 * S.scopeSettings.Frequency.Idling)) * stanceSway * camSway * S.scopeSettings.Amplitude.Idling * 0.75,
1757 0
1758 )
1759 end
1760 local walkCam = function()
1761 return V3(
1762 RAD(SIN(camAng * S.scopeSettings.Frequency.Walking)) * camSway * stanceSway * S.scopeSettings.Amplitude.Walking,
1763 RAD(SIN(camAng * 5 / 2 * S.scopeSettings.Frequency.Walking)) * camSway * stanceSway * S.scopeSettings.Amplitude.Walking * 0.75,
1764 0
1765 )
1766 end
1767 while Aimed do
1768 local dt = RS.RenderStepped:wait()
1769 camOffsets.guiScope.Rot = (Sine(idleAlpha) * idleCam()) + (Sine(walkAlpha) * walkCam())
1770 camAng = camAng + RAD(105 * dt) * stanceSway * camSway
1771 end
1772 end)
1773 end
1774end
1775
1776function unAimGun(Exception)
1777 if (not S.canADS) then return end
1778
1779 mouseSensitivity = S.sensitivitySettings.Default
1780
1781 for _, Plugin in pairs(Plugins.UnAimed) do
1782 spawn(function()
1783 Plugin()
1784 end)
1785 end
1786
1787 if S.guiScope then
1788 spawn(function()
1789 if armTable then
1790 for _, Obj in pairs(armTable[1].Model:GetChildren()) do
1791 if Obj:IsA("BasePart") then
1792 Obj.LocalTransparencyModifier = 0
1793 end
1794 end
1795 for _, Obj in pairs(armTable[2].Model:GetChildren()) do
1796 if Obj:IsA("BasePart") then
1797 Obj.LocalTransparencyModifier = 0
1798 end
1799 end
1800 elseif armModel then
1801 for _, Obj in pairs(armModel:GetChildren()) do
1802 if Obj:IsA("BasePart") then
1803 Obj.LocalTransparencyModifier = 0
1804 end
1805 end
1806 end
1807 for _, Obj in pairs(playerFolder:GetChildren()) do
1808 if Obj:IsA("BasePart") then
1809 Obj.LocalTransparencyModifier = 0
1810 end
1811 end
1812 for _, Obj in pairs(Gun:GetChildren()) do
1813 if Obj:IsA("BasePart") then
1814 Obj.LocalTransparencyModifier = 0
1815 end
1816 end
1817 end)
1818 end
1819
1820 if (not Exception) then
1821 if (not Aimed) then return end
1822 if (Reloading and Exception) or Knifing then return end
1823 spreadZoom = "unAimed"
1824 baseSpread = S.spreadSettings[spreadZoom][spreadStance][spreadMotion]
1825 Aimed = false
1826 Aiming = true
1827 if S.aimSettings.Anim then
1828 local currentFOV = Cam.FieldOfView
1829 local currentTrans = (Scope.BackgroundTransparency == 1 and (S.guiScope and 0 or 1) or Scope.BackgroundTransparency)
1830 scopeMain.Visible = false
1831 scopeSteady.Visible = false
1832 tweenJoint(LWeld, armC0[1], S.unAimedC1.leftArm, Sine, S.aimSettings.Speed)
1833 tweenJoint(RWeld, armC0[2], S.unAimedC1.rightArm, Sine, S.aimSettings.Speed)
1834 tweenJoint(headWeld2, nil, CF(), Sine, S.aimSettings.Speed)
1835 tweenJoint(Grip, nil, S.unAimedC1.Grip, Sine, S.aimSettings.Speed)
1836 local t0 = tick()
1837 while true do
1838 RS.RenderStepped:wait()
1839 local Alpha = math.min((tick() - t0) / S.aimSettings.Speed, 1) * 90
1840 if Aimed then break end
1841 if (not Selected) then break end
1842 aimAlpha = 1 - Sine(Alpha)--1 - COS(RAD(X))
1843 aimHeadOffset = headOffset.X * aimAlpha
1844 jumpAnimMultiplier = numLerp(1, S.fallSettings.aimEffect, aimAlpha)
1845 translationDivisor = numLerp(7, 20, aimAlpha)
1846 rotationMultiplier = numLerp(S.momentumSettings.Amplitude.unAimed, S.momentumSettings.Amplitude.Aimed, aimAlpha)
1847 armTiltMultiplier = numLerp(1, 0.2, aimAlpha)
1848 Cam.FieldOfView = numLerp(80, currentFOV, aimAlpha)
1849 Scope.BackgroundTransparency = numLerp(1, currentTrans, aimAlpha)
1850 if Alpha == 90 then break end
1851 end
1852 else
1853 scopeMain.Visible = false
1854 scopeSteady.Visible = false
1855 LWeld.C0, LWeld.C1 = armC0[1], S.unAimedC1.leftArm
1856 RWeld.C0, RWeld.C1 = armC0[2], S.unAimedC1.rightArm
1857 headWeld2.C0 = CF()
1858 Grip.C1 = S.unAimedC1.Grip
1859 aimAlpha = 0
1860 aimHeadOffset = 0
1861 jumpAnimMultiplier = 1
1862 translationDivisor = 7
1863 rotationMultiplier = S.momentumSettings.Amplitude.unAimed
1864 armTiltMultiplier = 1
1865 Cam.FieldOfView = 80
1866 Scope.BackgroundTransparency = 1
1867 end
1868 Aiming = Aimed
1869 else
1870 spawn(function()
1871 Aimed = false
1872 Aiming = false
1873 spreadZoom = "unAimed"
1874 baseSpread = S.spreadSettings[spreadZoom][spreadStance][spreadMotion]
1875 local currentFOV = Cam.FieldOfView
1876 local currentTrans = (Scope.BackgroundTransparency == 1 and (S.guiScope and 0 or 1) or Scope.BackgroundTransparency)
1877 scopeMain.Visible = false
1878 scopeSteady.Visible = false
1879 tweenJoint(headWeld2, nil, CF(), Sine, S.aimSettings.Speed)
1880 if S.aimSettings.Anim then
1881 local t0 = tick()
1882 while true do
1883 RS.RenderStepped:wait()
1884 local Alpha = math.min((tick() - t0) / S.aimSettings.Speed, 1) * 90
1885 if Aimed then break end
1886 if (not Selected) then break end
1887 aimAlpha = 1 - Sine(Alpha)--1 - COS(RAD(90 - Alpha))
1888 aimHeadOffset = headOffset.X * aimAlpha
1889 jumpAnimMultiplier = numLerp(1, S.fallSettings.aimEffect, aimAlpha)
1890 translationDivisor = numLerp(7, 20, aimAlpha)
1891 rotationMultiplier = numLerp(S.momentumSettings.Amplitude.unAimed, S.momentumSettings.Amplitude.Aimed, aimAlpha)
1892 armTiltMultiplier = numLerp(1, 0.2, aimAlpha)
1893 Cam.FieldOfView = numLerp(80, currentFOV, aimAlpha)
1894 Scope.BackgroundTransparency = numLerp(1, currentTrans, aimAlpha)
1895 if Alpha == 90 then break end
1896 end
1897 else
1898 scopeMain.Visible = false
1899 scopeSteady.Visible = false
1900 aimAlpha = 0
1901 aimHeadOffset = 0
1902 jumpAnimMultiplier = 1
1903 translationDivisor = 7
1904 rotationMultiplier = S.momentumSettings.Amplitude.unAimed
1905 armTiltMultiplier = 1
1906 Cam.FieldOfView = 80
1907 Scope.BackgroundTransparency = 1
1908 end
1909 end)
1910 end
1911end
1912
1913--------------------[ TEXTURE CREATION FUNCTIONS ]------------------------------------
1914
1915function createBullet(Direction)
1916 local Origin = Gun.Main.CFrame.p
1917 local bulletCF = CF(Origin, Origin + Direction)
1918 local Bullet = Instance.new("Part")
1919 Bullet.BrickColor = S.bulletSettings.Color
1920 Bullet.Material = Enum.Material.Neon
1921 Bullet.Name = "Bullet"
1922 Bullet.CanCollide = false
1923 Bullet.FormFactor = "Custom"
1924 Bullet.Size = S.bulletSettings.Size
1925 Bullet.BottomSurface = "Smooth"
1926 Bullet.TopSurface = "Smooth"
1927 if math.min(S.bulletSettings.Size.X, S.bulletSettings.Size.Y, S.bulletSettings.Size.Z) < 0.2 then
1928 local Mesh = Instance.new("BlockMesh")
1929 Mesh.Scale = S.bulletSettings.Size / Vector3.new(
1930 math.max(S.bulletSettings.Size.X, 0.2),
1931 math.max(S.bulletSettings.Size.Y, 0.2),
1932 math.max(S.bulletSettings.Size.Z, 0.2)
1933 )
1934 Mesh.Parent = Bullet
1935 end
1936 local BF = Instance.new("BodyForce")
1937 BF.force = V3(0, Bullet:GetMass() * (196.2 - S.bulletSettings.Acceleration), 0)
1938 BF.Parent = Bullet
1939 Bullet.Parent = gunIgnore
1940 Bullet.CFrame = bulletCF + Direction * S.bulletSettings.Size.Z / 2
1941 Bullet.Velocity = Direction * S.bulletSettings.Velocity
1942 return Bullet
1943end
1944
1945--------------------[ HIT HANDLING FUNCTIONS ]----------------------------------------
1946
1947function getBaseDamage(Dist)
1948 local startDmg = S.damageSettings.Start.Damage
1949 local startDist = S.damageSettings.Start.Dist
1950 local endDmg = S.damageSettings.End.Damage
1951 local endDist = S.damageSettings.End.Dist
1952 return (
1953 (
1954 Dist < startDist * S.bulletSettings.Range
1955 ) and startDmg or
1956 (
1957 Dist >= startDist * S.bulletSettings.Range and
1958 Dist < endDist * S.bulletSettings.Range
1959 ) and numLerp(startDmg, endDmg, Map(Dist / S.bulletSettings.Range, startDist, endDist, 0, 1)) or
1960 (
1961 Dist >= endDist * S.bulletSettings.Range
1962 ) and endDmg
1963 )
1964end
1965
1966function Damage(H, P, N, D, Dist, customIgnore)
1967 local hVal = S.damageSettings.Multipliers.Head
1968 local cVal = S.damageSettings.Multipliers.Chest
1969 local lVal = S.damageSettings.Multipliers.Limbs
1970 local baseDamage = getBaseDamage(Dist)
1971 if Humanoid.Health ~= 0 then
1972 local hitHumanoid = nil
1973 if H.Parent:IsA("Hat") then
1974 table.insert(customIgnore, H)
1975 local newRay = Ray.new(P - D * 0.1, D * (S.bulletSettings.Range - Dist + 0.1))
1976 local newH, newP, newN = workspace:FindPartOnRayWithIgnoreList(newRay, customIgnore)
1977 if newH then
1978 hitHumanoid = Damage(newH, newP, newN, D, Dist + (newP - P).magnitude, customIgnore)
1979 end
1980 else
1981 hitHumanoid = findFirstClass(H.Parent, "Humanoid")
1982 if hitHumanoid and hitHumanoid.Health > 0 and isEnemy(hitHumanoid) then
1983 local Tag = Instance.new("ObjectValue")
1984 Tag.Value = Player
1985 Tag.Name = "creator"
1986 Tag.Parent = hitHumanoid
1987 DS:AddItem(Tag, 0.3)
1988 local chosenDamage = 0
1989 if H.Name == "Head" then
1990 chosenDamage = baseDamage * RAND(hVal, hVal + 0.1, 0.01)
1991 elseif H.Name == "Torso" then
1992 chosenDamage = baseDamage * RAND(cVal, cVal + 0.1, 0.01)
1993 else
1994 chosenDamage = baseDamage * RAND(lVal, lVal + 0.1, 0.01)
1995 end
1996 hitHumanoid:TakeDamage(chosenDamage)
1997 markHit()
1998 end
1999 end
2000 return hitHumanoid
2001 end
2002end
2003
2004function isWallIgnored(Wall)
2005 return (
2006 Wall.Transparency >= S.penetrationSettings.transparencyThreshold or
2007 (S.penetrationSettings.ignoreNonCanCollide and (not Wall.CanCollide)) or
2008 isIgnored(Wall, S.penetrationSettings.ignoreCustom)
2009 )
2010end
2011
2012function penetrateWall(Wall, hitPos, Direction, Normal, Ignore, totalPDist, totalBDist, lastDamagedHumanoid)
2013 local wallIgnore = isWallIgnored(Wall)
2014 local hitHumanoid = (Wall.Parent:IsA("Hat") and findFirstClass(Wall.Parent.Parent, "Humanoid") or findFirstClass(Wall.Parent, "Humanoid"))
2015 local damagedHumanoid = nil
2016 if hitHumanoid and hitHumanoid ~= lastDamagedHumanoid then
2017 lastDamagedHumanoid = hitHumanoid
2018 damagedHumanoid = Damage(Wall, hitPos, Normal, Direction, totalBDist, {Char, ignoreModel})
2019 else
2020 lastDamagedHumanoid = nil
2021 end
2022 local ignoreObject = hitHumanoid and (Wall.Parent:IsA("Hat") and Wall.Parent.Parent or Wall.Parent) or Wall
2023 table.insert(Ignore, ignoreObject)
2024 local rayLength = S.bulletSettings.Range - totalBDist
2025 local testRay = Ray.new(hitPos, Direction * (S.bulletSettings.Range - totalBDist))
2026 local H1, P1, N1 = workspace:FindPartOnRayWithIgnoreList(testRay, Ignore)
2027 local newIgnore = removeElement(Ignore, ignoreObject)
2028 local wallRay = Ray.new(P1 + Direction * 0.1, -Direction * (rayLength + 1))
2029 local H2, P2, N2 = workspace:FindPartOnRayWithIgnoreList(wallRay, Ignore)
2030 local newPDist = totalPDist + (wallIgnore and 0 or (getNearestPoint(P1, P2, hitPos) - hitPos).magnitude)
2031 local newBDist = totalBDist + (P1 - hitPos).magnitude
2032 local outOfRange = Round(newPDist, 0.001) > S.penetrationSettings.Dist or Round(newBDist, 0.001) > S.bulletSettings.Range
2033 if (not wallIgnore) then
2034 createBulletImpact:FireServer(Wall, hitPos, Normal, Direction, hitHumanoid, gunIgnore, S)
2035 if (not hitHumanoid) then
2036 createShockwave:FireServer(hitPos, S.shockwaveSettings.Radius, gunIgnore, S)
2037 end
2038 end
2039 if hitHumanoid and hitHumanoid.Health > 0 and isEnemy(hitHumanoid) and hitHumanoid == damagedHumanoid then
2040 createBlood:FireServer(Wall, P2, Direction, gunIgnore, S)
2041 end
2042 if outOfRange or (not H1) then
2043 if (not outOfRange) and (not wallIgnore) then
2044 createBulletImpact:FireServer(Wall, P2, N2, Direction, hitHumanoid, gunIgnore, S)
2045 if (not hitHumanoid) then
2046 createShockwave:FireServer(P2, S.shockwaveSettings.Radius, gunIgnore, S)
2047 end
2048 end
2049 return Wall, hitPos
2050 else
2051 if Wall == H2 and (not wallIgnore) then
2052 createBulletImpact:FireServer(Wall, P2, N2, Direction, hitHumanoid, gunIgnore, S)
2053 if (not hitHumanoid) then
2054 createShockwave:FireServer(P2, S.shockwaveSettings.Radius, gunIgnore, S)
2055 end
2056 end
2057 return penetrateWall(H1, P1, Direction, N1, Ignore, newPDist, newBDist, lastDamagedHumanoid)
2058 end
2059end
2060
2061function PenetrateWall(HitPos, Direction, HitHumanoid, OriginPos, Bullet, CurrentPDist)
2062 local HitDist = (HitPos - OriginPos).magnitude
2063 local Wall, WallHitPos = nil, nil
2064 local Hum, HumHitPos = nil, nil
2065 local CustomIgnore = {unpack(Ignore)}
2066 for i = 1, 10 do
2067 local WallRay = Ray.new(HitPos - (Direction * 0.1), Direction * S.Penetration)
2068 local H, P = game.Workspace:FindPartOnRayWithIgnoreList(WallRay, CustomIgnore)
2069 if H then
2070 local HitHumanoid = nil
2071 if H.Parent.ClassName == "Hat" then
2072 HitHumanoid = findFirstClass(H.Parent.Parent, "Humanoid")
2073 else
2074 HitHumanoid = findFirstClass(H.Parent, "Humanoid")
2075 end
2076 if HitHumanoid and i ~= 1 then
2077 Hum, HumHitPos = H, P
2078 break
2079 else
2080 Wall, WallHitPos = H, P
2081 table.insert(CustomIgnore, H)
2082 end
2083 else
2084 break
2085 end
2086 end
2087 if Wall then
2088 if S.InstantHit then
2089 if Hum then
2090 Damage(Hum.Parent:FindFirstChild("Head"), HumHitPos)
2091 return HumHitPos
2092 else
2093 local HitObj2, HitPos2 = nil, nil
2094 if HitHumanoid then
2095 HitObj2, HitPos2 = AdvRayCast(WallHitPos, Direction, S.BulletRange - HitDist, {Wall, HitHumanoid.Parent, unpack(Ignore)})
2096 else
2097 HitObj2, HitPos2 = AdvRayCast(WallHitPos, Direction, S.BulletRange - HitDist, {Wall, unpack(Ignore)})
2098 end
2099 Damage(HitObj2, HitPos2)
2100
2101 local NewPDist = CurrentPDist + (WallHitPos - HitPos).magnitude
2102 local NewHitPos2 = HitPos2
2103 if NewPDist < S.Penetration and HitObj2 then
2104 NewHitPos2 = PenetrateWall(HitPos2, Direction, HitHumanoid, OriginPos, Bullet, CurrentPDist + NewPDist)
2105 end
2106 return NewHitPos2
2107 end
2108 else
2109 local LastPos = WallHitPos
2110 local TotalDistTraveled = 0
2111 spawn(function()
2112 if Hum then
2113 Damage(Hum.Parent:FindFirstChild("Head"), HumHitPos)
2114 return HumHitPos
2115 else
2116 while true do
2117 RS.RenderStepped:wait()
2118 if TotalDistTraveled >= S.BulletRange - HitDist then
2119 Bullet:Destroy()
2120 break
2121 end
2122 local DistTraveled = (Bullet.Position - LastPos).magnitude
2123 local NewDirection = (Bullet.Position - LastPos).unit
2124 local TempHitObj, TempHitPos = nil, nil
2125 if HitHumanoid then
2126 TempHitObj, TempHitPos = AdvRayCast(LastPos, NewDirection, DistTraveled, {Wall, HitHumanoid.Parent, unpack(Ignore)})
2127 else
2128 TempHitObj, TempHitPos = AdvRayCast(LastPos, NewDirection, DistTraveled, {Wall, unpack(Ignore)})
2129 end
2130 if TempHitObj then
2131 Damage(TempHitObj, TempHitPos)
2132
2133 local NewPDist = CurrentPDist + (WallHitPos - HitPos).magnitude
2134 local NewTempPos = TempHitPos
2135 if NewPDist < S.Penetration and TempHitObj then
2136 NewTempPos = PenetrateWall(TempHitPos, Direction, HitHumanoid, OriginPos, Bullet, CurrentPDist + NewPDist)
2137 else
2138 Bullet:Destroy()
2139 end
2140 return NewTempPos
2141 else
2142 LastPos = Bullet.Position
2143 TotalDistTraveled = TotalDistTraveled + DistTraveled
2144 end
2145 end
2146 end
2147 end)
2148 end
2149 else
2150 if Bullet then Bullet:Destroy() end
2151 return HitPos
2152 end
2153end
2154
2155function isEnemy(Human)
2156 local Plyr = game.Players:GetPlayerFromCharacter(Human.Parent)
2157 if (not Plyr) then return S.CanDamageNPCs end
2158 return S.AllowFriendlyFire or (Plyr.TeamColor ~= Player.TeamColor or Plyr.Neutral)
2159end
2160
2161--------------------[ RELOAD FUNCTIONS ]----------------------------------------------
2162
2163function animateReload()
2164 tweenJoint(LWeld2, CF(), CF(), Sine, 0.15)
2165 tweenJoint(RWeld2, CF(), CF(), Sine, 0.15)
2166 local magParts = {}
2167 local magTable = {}
2168
2169 for _, Obj in pairs(Gun:GetChildren()) do
2170 if string.sub(Obj.Name, 1, 3) == "Mag" and Obj:IsA("BasePart") then
2171 INSERT(magParts, Obj)
2172 end
2173 end
2174
2175 local animVars = {
2176 --FUNCTIONS--
2177 tweenJoint = tweenJoint;
2178
2179 makeMagInvisible = function()
2180 for _, v in pairs(magParts) do
2181 v.Transparency = 1
2182 end
2183 magVisible = false
2184 end;
2185
2186 makeMagVisible = function()
2187 for _, v in pairs(magParts) do
2188 v.Transparency = v:WaitForChild("magTrans").Value
2189 end
2190 magVisible = true
2191 end;
2192
2193 isMagVisible = function()
2194 return magVisible
2195 end;
2196
2197 isMagEmpty = function()
2198 return ammoInClip == 0
2199 end;
2200
2201 setNewMag = function()
2202 newMag = true
2203 end;
2204
2205 isNewMag = function()
2206 return newMag
2207 end;
2208
2209 createMag = function(Key)
2210 local magModel = Instance.new("Model")
2211 local magClones = {}
2212 for i, v in pairs(magParts) do
2213 local vClone = v:Clone()
2214 vClone.Transparency = v:WaitForChild("magTrans").Value
2215 vClone.CanCollide = false
2216 vClone.Parent = magModel
2217 INSERT(magClones, {Original = v, magClone = vClone})
2218 if i ~= 1 then
2219 local W = Instance.new("Weld")
2220 W.Part0 = magClones[1].magClone
2221 W.Part1 = vClone
2222 W.C0 = magClones[1].magClone.CFrame:toObjectSpace(vClone.CFrame)
2223 W.Parent = magClones[1].magClone
2224 end
2225 end
2226 magTable[Key] = {magModel, magClones}
2227 return magModel, magClones
2228 end;
2229
2230 getMag = function(Key)
2231 if magTable[Key] then
2232 return magTable[Key][1], magTable[Key][2]
2233 else
2234 return nil, nil
2235 end
2236 end;
2237
2238 attachGripToHead = function()
2239 local handleCF = RArm.CFrame * Grip.C0
2240 Grip.C0 = Head.CFrame:toObjectSpace(handleCF)
2241 Grip.Part0 = Head
2242 end;
2243
2244 attachGripToArm = function()
2245 local handleCF = Head.CFrame * Grip.C0
2246 Grip.C0 = RArm.CFrame:toObjectSpace(handleCF)
2247 Grip.Part0 = RArm
2248 end;
2249
2250 Sine = Sine;
2251
2252 Linear = Linear;
2253
2254 --VARIABLES--
2255 Handle = Handle;
2256 LArm = LArm;
2257 RArm = RArm;
2258 LWeld = LWeld;
2259 RWeld = RWeld;
2260 LC0 = armC0[1];
2261 RC0 = armC0[2];
2262 Grip = Grip;
2263 gunIgnore = gunIgnore;
2264 Cam = Cam;
2265 CF = CF;
2266 CFANG = CFANG;
2267 V3 = V3;
2268 RAD = RAD;
2269 reloadTimeLoaded = S.reloadSettings.Times.Loaded;
2270 reloadTimeEmpty = S.reloadSettings.Times.Empty
2271 }
2272
2273 local sequenceTable = Anims.Reload(animVars)
2274 --local T = tick()
2275 for _, reloadFunction in pairs(sequenceTable) do
2276 if breakReload then
2277 break
2278 end
2279 reloadFunction()
2280
2281 if (not magVisible) then
2282 Ammo.Value = 0
2283 end
2284 updateClipAmmo()
2285 end
2286 --print(tick() - T) --I divide the reloadTime by this number to get the animation speed
2287
2288 if (not isCrawling) then
2289 if Running and (not S.canFireWhileRunning) then
2290 tweenJoint(LWeld, armC0[1], S.runningC1.leftArm, Sine, 0.4)
2291 tweenJoint(RWeld, armC0[2], S.runningC1.rightArm, Sine, 0.4)
2292 tweenJoint(Grip, nil, S.runningC1.Grip, Sine, 0.4)
2293 else
2294 tweenJoint(LWeld, armC0[1], S.unAimedC1.leftArm, Sine, 0.4)
2295 tweenJoint(RWeld, armC0[2], S.unAimedC1.rightArm, Sine, 0.4)
2296 tweenJoint(Grip, nil, S.unAimedC1.Grip, Sine, 0.4)
2297 end
2298 end
2299
2300 for _, v in pairs(magTable) do --In case the reload animations was stopped mid way and there were still fake mags that weren't deleted
2301 v[1]:Destroy()
2302 end
2303end
2304
2305function Reload()
2306 if Ammo.Value < (ClipSize.Value + 1) and (not Reloading) and StoredAmmo.Value > 0 then
2307 Firing = false
2308 ammoInClip = (ammoInClip == 0 and Ammo.Value or ammoInClip)
2309 Reloading = true
2310 lowerSpread()
2311 if Aimed then unAimGun(S.reloadSettings.Anim) end
2312 crossHair.Reload.Visible = true
2313 if Handle:FindFirstChild("ReloadSound") then Handle.ReloadSound:Play() end
2314 if S.reloadSettings.Anim then
2315 wait()
2316 animateReload()
2317 else
2318 local startReload = tick()
2319 local initialReloadTime = Ammo.Value == 0 and S.reloadSettings.Times.Empty or S.reloadSettings.Times.Loaded
2320 while true do
2321 if breakReload then break end
2322 if (tick() - startReload) >= initialReloadTime then break end
2323 RS.RenderStepped:wait()
2324 end
2325 end
2326 if (not breakReload) then
2327 newMag = false
2328 if StoredAmmo.Value >= ClipSize.Value then
2329 if ammoInClip > 0 then
2330 StoredAmmo.Value = StoredAmmo.Value - ((ClipSize.Value + 1) - ammoInClip)
2331 Ammo.Value = ClipSize.Value + 1
2332 else
2333 StoredAmmo.Value = StoredAmmo.Value - ClipSize.Value
2334 Ammo.Value = ClipSize.Value
2335 end
2336 elseif StoredAmmo.Value < ClipSize.Value and StoredAmmo.Value > 0 then
2337 Ammo.Value = StoredAmmo.Value
2338 StoredAmmo.Value = 0
2339 end
2340 end
2341 Reloading = false
2342 if Selected then
2343 ammoInClip = (breakReload and ammoInClip or 0)
2344 crossHair.Reload.Visible = false
2345 end
2346 breakReload = false
2347 end
2348
2349 updateClipAmmo()
2350 updateStoredAmmo()
2351end
2352
2353--------------------[ EXTERNAL DATA LOCATING FUNCTIONS ]-----------------------------
2354
2355function removeElement(Table, Element) --removes the first instance of Element from Table
2356 for i, v in pairs(Table) do
2357 if v == Element then
2358 table.remove(Table, i)
2359 break
2360 end
2361 end
2362 return Table
2363end
2364
2365function findFirstClass(Object, Class)
2366 local foundObject = nil
2367 for _, Obj in pairs(Object:GetChildren()) do
2368 if Obj.ClassName == Class then
2369 foundObject = Obj
2370 break
2371 end
2372 end
2373 return foundObject
2374end
2375
2376function isIgnored(Obj, Table)
2377 for _,v in pairs(Table) do
2378 if Obj == v or Obj:IsDescendantOf(v) then
2379 return true
2380 end
2381 end
2382 return false
2383end
2384
2385function GetHitSurfaceCFrame(HitPos,Obj)
2386 local SurfaceCF = {
2387 {"Back",Obj.CFrame * CF(0,0,Obj.Size.z)};
2388 {"Bottom",Obj.CFrame * CF(0,-Obj.Size.y,0)};
2389 {"Front",Obj.CFrame * CF(0,0,-Obj.Size.z)};
2390 {"Left",Obj.CFrame * CF(-Obj.Size.x,0,0)};
2391 {"Right",Obj.CFrame * CF(Obj.Size.x,0,0)};
2392 {"Top",Obj.CFrame * CF(0,Obj.Size.y,0)}
2393 }
2394 local ClosestDist = HUGE
2395 local ClosestSurface = nil
2396 for _,v in pairs(SurfaceCF) do
2397 local SurfaceDist = (HitPos - v[2].p).magnitude
2398 if SurfaceDist < ClosestDist then
2399 ClosestDist = SurfaceDist
2400 ClosestSurface = v
2401 end
2402 end
2403 return ClosestSurface[2]
2404end
2405
2406function AdvRayCast(Origin, Direction, Dist, CustomIgnore)
2407 local NewIgnore = (CustomIgnore and CustomIgnore or Ignore)
2408 local NewRay = Ray.new(Origin, Direction * (Dist > 999 and 999 or Dist))
2409 local HitObj, HitPos = game.Workspace:FindPartOnRayWithIgnoreList(NewRay, NewIgnore)
2410 local LastPos = HitPos
2411 local FinalHitObj, FinalHitPos = nil, nil
2412 local RepTimes = math.floor(Dist / 999)
2413 if (not HitObj) and (Dist > 999) then
2414 for i = 0, RepTimes do
2415 local NewDist = (i == RepTimes and (Dist - (LastPos - Origin).magnitude) or 999)
2416 local Ray2 = Ray.new(LastPos, Direction * NewDist)
2417 local HitObj2, HitPos2 = game.Workspace:FindPartOnRayWithIgnoreList(Ray2, NewIgnore)
2418 if i ~= RepTimes then
2419 if HitObj2 then
2420 FinalHitObj, FinalHitPos = HitObj2, HitPos2
2421 break
2422 end
2423 elseif i == RepTimes then
2424 FinalHitObj, FinalHitPos = HitObj2, HitPos2
2425 end
2426 LastPos = HitPos2
2427 end
2428 return FinalHitObj, FinalHitPos
2429 elseif HitObj or (Dist <= 999) then
2430 return HitObj, HitPos
2431 end
2432end
2433
2434--------------------[ JUMPING ANIMATION ]---------------------------------------------
2435
2436function onFall(initialVelocity)
2437 spawn(function()
2438 local velocityAlpha = math.max(math.min(initialVelocity / Humanoid.JumpPower, 1), 0)
2439 local startJumpPos = jumpAnim.Pos
2440 local startJumpRot = jumpAnim.Rot
2441 local endJumpPos = 0.04 * S.fallSettings.fallMultiplier * velocityAlpha
2442 local endJumpRot = RAD(4) * S.fallSettings.fallMultiplier * velocityAlpha
2443 local t0 = tick()
2444 while true do
2445 RS.Heartbeat:wait()
2446 local Alpha = math.min((tick() - t0) / 0.15, 1) * 90
2447 if onGround then break end
2448 jumpAnim.Pos = numLerp(startJumpPos, endJumpPos, Sine(Alpha))
2449 jumpAnim.Rot = numLerp(startJumpRot, endJumpRot, Sine(Alpha))
2450 if Alpha == 90 then break end
2451 end
2452 startJumpPos = endJumpPos
2453 startJumpRot = endJumpRot
2454 endJumpPos = -0.08 * S.fallSettings.fallMultiplier
2455 endJumpRot = -RAD(8) * S.fallSettings.fallMultiplier
2456 local X = 1
2457 while true do
2458 local dt = RS.Heartbeat:wait()
2459 X = X + (dt * 60) / X
2460 local Alpha = (X - 1) / 15
2461 if onGround then break end
2462 jumpAnim.Pos = numLerp(startJumpPos, endJumpPos, Alpha)
2463 jumpAnim.Rot = numLerp(startJumpRot, endJumpRot, Alpha)
2464 end
2465 end)
2466end
2467
2468function onLand(fallDist)
2469 spawn(function()
2470 local animAlpha = math.min(fallDist, S.fallSettings.maxDist) * (2 / 3)
2471 local startJumpPos = jumpAnim.Pos
2472 local startJumpRot = jumpAnim.Rot
2473 local endJumpPos = animAlpha / 100 * S.fallSettings.landMultiplier * (runReady and 1 or 2)
2474 local endJumpRot = RAD(animAlpha) * S.fallSettings.landMultiplier * (runReady and 1 or 2)
2475 local t0 = tick()
2476 while true do
2477 RS.Heartbeat:wait()
2478 local Alpha = math.min((tick() - t0) / 0.2, 1)
2479 if (not onGround) then break end
2480 jumpAnim.Pos = numLerp(startJumpPos, endJumpPos, Alpha)
2481 jumpAnim.Rot = numLerp(startJumpRot, endJumpRot, Alpha)
2482 if Alpha == 1 then break end
2483 end
2484 t0 = tick()
2485 while true do
2486 RS.Heartbeat:wait()
2487 local Alpha = math.min((tick() - t0) / 0.3, 1) * 90
2488 if (not onGround) then break end
2489 jumpAnim.Pos = numLerp(endJumpPos, 0, Sine(Alpha))
2490 jumpAnim.Rot = numLerp(endJumpRot, 0, Sine(Alpha))
2491 if Alpha == 90 then break end
2492 end
2493 end)
2494end
2495
2496function onHumanoidStateChanged(oldState, newState)
2497 if newState == Enum.HumanoidStateType.Freefall then
2498 onGround = false
2499 if S.fallAnimation then
2500 onFall(HRP.Velocity.Y)
2501 while HRP.Velocity.Y > 0 do RS.RenderStepped:wait() end
2502 startFallHeight = HRP.Position.Y
2503 end
2504 elseif oldState == Enum.HumanoidStateType.Freefall then
2505 onGround = true
2506 if S.fallAnimation then
2507 local fallDist = startFallHeight - HRP.Position.Y
2508 onLand(fallDist)
2509 end
2510 end
2511end
2512--------------------[ CAMERA STEADYING FUNCTIONS ]------------------------------------
2513
2514function steadyCamera()
2515 scopeSteady.Text = "Steadying..."
2516 scopeSteady.TextColor3 = Color3.new(1, 1, 0)
2517 camSteady = true
2518 local originalSway = camSway
2519 local Increment = 1.5 / 0.6
2520 local X = 0
2521 while true do
2522 RS.RenderStepped:wait()
2523 local newX = X + Increment
2524 X = (newX > 90 and 90 or newX)
2525 if (not steadyKeyPressed) then break end
2526 camSway = numLerp(originalSway, 0, Sine(X))
2527 if X == 90 then break end
2528 end
2529 while steadyKeyPressed and Aimed do
2530 if currentSteadyTime > 0 then
2531 local NewSteadyTime = currentSteadyTime - 1
2532 currentSteadyTime = (NewSteadyTime < 0 and 0 or NewSteadyTime)
2533 camSway = 0
2534 elseif currentSteadyTime == 0 then
2535 break
2536 end
2537 RS.RenderStepped:wait()
2538 end
2539 camSteady = false
2540 spawn(function()
2541 local Increment = 1.5 / 0.25
2542 local X = 0
2543 while true do
2544 RS.RenderStepped:wait()
2545 local newX = X + Increment
2546 X = (newX > 90 and 90 or newX)
2547 if camSteady then break end
2548 camSway = numLerp(0, S.scopeSettings.camSwayOnBreath, 1 - COS(RAD(X)))
2549 if X == 90 then break end
2550 end
2551 Increment = 1.5 / S.scopeSettings.breathTime
2552 X = 0
2553 while true do
2554 RS.RenderStepped:wait()
2555 local newX = X + Increment
2556 X = (newX > 90 and 90 or newX)
2557 if camSteady then break end
2558 camSway = numLerp(S.scopeSettings.camSwayOnBreath, 1, Sine(X))
2559 if X == 90 then break end
2560 end
2561 --[[for X = 0, 90, 1.5 / 0.2 do
2562 local Alpha = 1 - COS(RAD(X))--math.log10(X) / math.log10(90)
2563 camSway = numLerp(0, 3, Alpha)
2564 RS.RenderStepped:wait()
2565 end]]
2566 --[[for X = 0, 90, 1.5 / S.scopeSettings.steadyTime do
2567 if camSteady then break end
2568 local Alpha = SIN(RAD(X))
2569 camSway = numLerp(3, 1, Alpha)
2570 RS.RenderStepped:wait()
2571 end]]
2572 end)
2573 retakeBreath()
2574end
2575
2576function retakeBreath()
2577 scopeSteady.Text = "Re-taking Breath"
2578 scopeSteady.TextColor3 = Color3.new(1, 0, 0)
2579 takingBreath = true
2580 local Increment = S.scopeSettings.steadyTime / S.scopeSettings.breathTime
2581 while takingBreath do
2582 if currentSteadyTime < maxSteadyTime then
2583 local newSteadyTime = currentSteadyTime + Increment
2584 currentSteadyTime = (newSteadyTime > maxSteadyTime and maxSteadyTime or newSteadyTime)
2585 elseif currentSteadyTime >= maxSteadyTime then
2586 break
2587 end
2588 RS.RenderStepped:wait()
2589 end
2590 if takingBreath then
2591 scopeSteady.Text = "Hold "..convertKey(S.Keys.scopeSteady).." to Steady"
2592 scopeSteady.TextColor3 = Color3.new(1, 1, 0)
2593 takingBreath = false
2594 end
2595end
2596
2597--------------------[ SPRINTING FUNCTIONS ]-------------------------------------------
2598
2599function canRun(midRun)
2600 return ((Forward and (not Backward)) and
2601 Walking and (Stamina > 0) and Running and
2602 Selected and (midRun and true or onGround) and
2603 runReady and (S.canFireWhileRunning and true or (not Firing))
2604 )
2605end
2606
2607function monitorStamina()
2608 Running = true
2609 if (not canRun(false)) then
2610 Running = false
2611 return
2612 end
2613 if Aimed then unAimGun(true) end
2614 if Stance == 1 or Stance == 2 then Stand() end
2615 if (not (Reloading and S.reloadSettings.Anim)) then
2616 if S.canFireWhileRunning then
2617 tweenJoint(LWeld, armC0[1], S.unAimedC1.leftArm, Sine, 0.4)
2618 tweenJoint(RWeld, armC0[2], S.unAimedC1.rightArm, Sine, 0.4)
2619 tweenJoint(Grip, nil, S.unAimedC1.Grip, Sine, 0.4)
2620 else
2621 tweenJoint(LWeld, armC0[1], S.runningC1.leftArm, Sine, 0.4)
2622 tweenJoint(RWeld, armC0[2], S.runningC1.rightArm, Sine, 0.4)
2623 tweenJoint(Grip, nil, S.runningC1.Grip, Sine, 0.4)
2624 end
2625 end
2626 crossOffset = 50
2627 while runKeyPressed do
2628 if canRun(true) then
2629 if onGround then
2630 local newStamina = Stamina - 1
2631 Stamina = (newStamina < 0 and 0 or newStamina)
2632 end
2633 else
2634 break
2635 end
2636 RS.RenderStepped:wait()
2637 end
2638 Running = false
2639 if (not Aimed) and (not (Reloading and S.reloadSettings.Anim)) and (not S.canFireWhileRunning) then
2640 crossOffset = 0
2641 tweenJoint(LWeld, armC0[1], S.unAimedC1.leftArm, Sine, 0.4)
2642 tweenJoint(RWeld, armC0[2], S.unAimedC1.rightArm, Sine, 0.4)
2643 tweenJoint(Grip, nil, S.unAimedC1.Grip, Sine, 0.4)
2644 end
2645
2646 rechargeStamina()
2647end
2648
2649function rechargeStamina()
2650 chargingStamina = true
2651 while ((not runKeyPressed) or (Stamina < maxStamina)) and (not Running) do
2652 if Stamina < maxStamina then
2653 local newStamina = Stamina + (S.sprintTime / S.staminaCoolTime)
2654 Stamina = (newStamina > maxStamina and maxStamina or newStamina)
2655 elseif Stamina >= maxStamina then
2656 break
2657 end
2658 RS.RenderStepped:wait()
2659 end
2660 chargingStamina = false
2661end
2662
2663--------------------[ STANCE FUNCTIONS ]----------------------------------------------
2664
2665function Stand(onDeselected)
2666 local LHip = Torso["Left Hip"]
2667 local RHip = Torso["Right Hip"]
2668 LLegWeld.Part1 = nil
2669 LHip.Part1 = LLeg
2670 RLegWeld.Part1 = nil
2671 RHip.Part1 = RLeg
2672 Stance = 0
2673 spreadStance = "Stand"
2674 baseSpread = S.spreadSettings[spreadZoom][spreadStance][spreadMotion]
2675 if S.stanceSettings.Anim and (not onDeselected) then
2676 spawn(function()
2677 local prevStanceSway = stanceSway
2678 local X = 0
2679 local Increment = 1.5 / S.stanceSettings.Speed
2680 while true do
2681 RS.RenderStepped:wait()
2682 local newX = X + Increment
2683 X = (newX > 90 and 90 or newX)
2684 if Stance ~= 0 then break end
2685 stanceSway = numLerp(prevStanceSway, 1, Sine(X))
2686 if X == 90 then break end
2687 end
2688 end)
2689 tweenJoint(ABWeld, CF(), nil, Sine, S.stanceSettings.Speed)
2690 tweenJoint(LLegWeld, legC0.Stand[1], nil, Sine, S.stanceSettings.Speed)
2691 tweenJoint(RLegWeld, legC0.Stand[2], nil, Sine, S.stanceSettings.Speed)
2692 tweenJoint(LHip, CF(-1, -1, 0) * CFANG(0, RAD(-90), 0), CF(-0.5, 1, 0) * CFANG(0, RAD(-90), 0), Sine, S.stanceSettings.Speed)
2693 tweenJoint(RHip, CF(1, -1, 0) * CFANG(RAD(-180), RAD(90), 0), CF(0.5, 1, 0) * CFANG(RAD(-180), RAD(90), 0), Sine, S.stanceSettings.Speed)
2694 tweenJoint(Root, CFANG(RAD(-90), 0, RAD(180)), nil, Sine, S.stanceSettings.Speed)
2695 tweenJoint(headWeld, CF(0, 1.5, 0), nil, Sine, S.stanceSettings.Speed)
2696 elseif onDeselected or (not S.stanceSettings.Anim) then
2697 ABWeld.C0 = CF()
2698 LLegWeld.C0 = legC0.Stand[1]
2699 RLegWeld.C0 = legC0.Stand[2]
2700 LHip.C0, LHip.C1 = CF(-1, -1, 0) * CFANG(0, RAD(-90), 0), CF(-0.5, 1, 0) * CFANG(0, RAD(-90), 0)
2701 RHip.C0, RHip.C1 = CF(1, -1, 0) * CFANG(RAD(-180), RAD(90), 0), CF(0.5, 1, 0) * CFANG(RAD(-180), RAD(90), 0)
2702 Root.C0 = CFANG(RAD(-90), 0, RAD(180))
2703 headWeld.C0 = CF(0, 1.5, 0)
2704 end
2705end
2706
2707function Crouch()
2708 local LHip = Torso["Left Hip"]
2709 local RHip = Torso["Right Hip"]
2710 LHip.Part1 = nil
2711 LLegWeld.Part1 = LLeg
2712 RHip.Part1 = nil
2713 RLegWeld.Part1 = RLeg
2714 Stance = 1
2715 spreadStance = "Crouch"
2716 baseSpread = S.spreadSettings[spreadZoom][spreadStance][spreadMotion]
2717 if S.stanceSettings.Anim then
2718 spawn(function()
2719 local prevStanceSway = stanceSway
2720 local X = 0
2721 local Increment = 1.5 / S.stanceSettings.Speed
2722 while true do
2723 RS.RenderStepped:wait()
2724 local newX = X + Increment
2725 X = (newX > 90 and 90 or newX)
2726 if Stance ~= 1 then break end
2727 stanceSway = numLerp(prevStanceSway, 0.75, Sine(X))
2728 if X == 90 then break end
2729 end
2730 end)
2731 tweenJoint(ABWeld, CF(0, 0, -0.05), nil, Sine, S.stanceSettings.Speed)
2732 tweenJoint(LLegWeld, legC0.Crouch[1], nil, Sine, S.stanceSettings.Speed)
2733 tweenJoint(RLegWeld, legC0.Crouch[2], nil, Sine, S.stanceSettings.Speed)
2734 tweenJoint(LHip, CF(-1, -0.5, 0) * CFANG(0, RAD(-90), 0), CF(-0.5, 0.5, 1) * CFANG(0, RAD(-90), RAD(-90)), Sine, S.stanceSettings.Speed)
2735 tweenJoint(RHip, CF(1, -0.5, 0.25) * CFANG(RAD(-180), RAD(90), 0), CF(0.5, 0.5, 1) * CFANG(RAD(-180), RAD(90), 0), Sine, S.stanceSettings.Speed)
2736 tweenJoint(Root, CF(0, -1, 0) * CFANG(RAD(-90), 0, RAD(180)), nil, Sine, S.stanceSettings.Speed)
2737 tweenJoint(headWeld, CF(0, 1.5, 0), nil, Sine, S.stanceSettings.Speed)
2738 else
2739 ABWeld.C0 = CF(0, 0, -1 / 16)
2740 LLegWeld.C0 = legC0.Crouch[1]
2741 RLegWeld.C0 = legC0.Crouch[2]
2742 LHip.C0, LHip.C1 = CF(-1, -0.5, 0) * CFANG(0, RAD(-90), 0), CF(-0.5, 0.5, 1) * CFANG(0, RAD(-90), RAD(-90))
2743 RHip.C0, RHip.C1 = CF(1, -0.5, 0.25) * CFANG(RAD(-180), RAD(90), 0), CF(0.5, 0.5, 1) * CFANG(RAD(-180), RAD(90), 0)
2744 Root.C0 = CF(0, -1, 0) * CFANG(RAD(-90), 0, RAD(180))
2745 headWeld.C0 = CF(0, 1.5, 0)
2746 end
2747end
2748
2749function Prone()
2750 local LHip = Torso["Left Hip"]
2751 local RHip = Torso["Right Hip"]
2752 LHip.Part1 = nil
2753 LLegWeld.Part1 = LLeg
2754 RHip.Part1 = nil
2755 RLegWeld.Part1 = RLeg
2756 Stance = 2
2757 spreadStance = "Prone"
2758 baseSpread = S.spreadSettings[spreadZoom][spreadStance][spreadMotion]
2759 if S.stanceSettings.Anim then
2760 spawn(function()
2761 local prevStanceSway = stanceSway
2762 local X = 0
2763 local Increment = 1.5 / S.stanceSettings.Speed
2764 while true do
2765 RS.RenderStepped:wait()
2766 local newX = X + Increment
2767 X = (newX > 90 and 90 or newX)
2768 if Stance ~= 2 then break end
2769 stanceSway = numLerp(prevStanceSway, 0.5, Sine(X))
2770 if X == 90 then break end
2771 end
2772 end)
2773 tweenJoint(ABWeld, CF(0, 0, -0.1), nil, Sine, S.stanceSettings.Speed)
2774 tweenJoint(LLegWeld, legC0.Prone[1], nil, Sine, S.stanceSettings.Speed)
2775 tweenJoint(RLegWeld, legC0.Prone[2], nil, Sine, S.stanceSettings.Speed)
2776 tweenJoint(Root, CF(0, -2.5, 1) * CFANG(RAD(180), 0, RAD(180)), nil, Sine, S.stanceSettings.Speed)
2777 tweenJoint(headWeld, CF(0, 1, 1) * CFANG(RAD(90), 0, 0), nil, Sine, S.stanceSettings.Speed)
2778 else
2779 ABWeld.C0 = CF(0, 0, -1 / 8)
2780 LLegWeld.C0 = legC0.Prone[1]
2781 RLegWeld.C0 = legC0.Prone[2]
2782 Root.C0 = CF(0, -2.5, 1) * CFANG(RAD(180), 0, RAD(180))
2783 headWeld.C0 = CF(0, 1, 1) * CFANG(RAD(90), 0, 0)
2784 end
2785end
2786
2787function Dive()
2788 onGround = false
2789 local diveDirection = (HRP.CFrame * CFANG(S.diveSettings.Angle, 0, 0)).lookVector * S.walkSpeeds.Sprinting * S.diveSettings.Force
2790 local BF = Instance.new("BodyForce")
2791 BF.force = diveDirection + Vector3.new(0, playerMass * 196.2, 0)
2792 BF.Parent = HRP
2793 --[[spawn(function()
2794 HRP.Velocity = HRP.CFrame.lookVector * 60 + V3(0, 40, 0)
2795 wait(0.1)
2796 HRP.Velocity = HRP.CFrame.lookVector * 70 + V3(0, 30, 0)
2797 wait(0.4)
2798 HRP.Velocity = HRP.CFrame.lookVector * 30 + V3(0, -10, 0)
2799 end)]]
2800 delay(0.05, function()
2801 spawn(function()
2802 while true do
2803 local newRay = Ray.new(HRP.Position, V3(0, -3.1, 0))
2804 local H, _ = workspace:FindPartOnRayWithIgnoreList(newRay, Ignore)
2805 if H then
2806 onGround = true
2807 break
2808 end
2809 wait()
2810 end
2811 end)
2812 Prone()
2813 wait(0.1)
2814 BF:Destroy()
2815 end)
2816end
2817
2818--------------------[ MOUSE FUNCTIONS ]-----------------------------------------------
2819
2820function onMB1Down()
2821 MB1Down = true
2822 firstShot = true
2823 if fireFunction then
2824 fireFunction()
2825 end
2826end
2827
2828function onMB1Up()
2829 MB1Down = false
2830 lowerSpread()
2831end
2832
2833function onMB2Down()
2834 if S.aimSettings.holdToADS then
2835 if (not AimingIn) and (not Aimed) then
2836 AimingIn = true
2837 aimGun()
2838 AimingIn = false
2839 end
2840 else
2841 if Aimed then
2842 unAimGun()
2843 else
2844 aimGun()
2845 end
2846 end
2847end
2848
2849function onMB2Up()
2850 if S.aimSettings.holdToADS then
2851 if (not AimingOut) and Aimed then
2852 AimingOut = true
2853 unAimGun()
2854 AimingOut = false
2855 end
2856 end
2857end
2858
2859function onScrollUp()
2860 local newAimSensitivity = aimSensitivity + S.sensitivitySettings.Increment
2861 aimSensitivity = (
2862 newAimSensitivity < S.sensitivitySettings.Min and S.sensitivitySettings.Min or
2863 newAimSensitivity > S.sensitivitySettings.Max and S.sensitivitySettings.Max or
2864 newAimSensitivity
2865 )
2866 mouseSensitivity = (Aimed and aimSensitivity or mouseSensitivity)
2867
2868 Sens.Text = "S: "..aimSensitivity
2869 if mainGUI:IsDescendantOf(game) then
2870 Sens.Visible = true
2871 local t0 = tick()
2872 lastSensUpdate = t0
2873
2874 wait(0.3)
2875
2876 if lastSensUpdate <= t0 then
2877 Sens.Visible = false
2878 end
2879 end
2880end
2881
2882function onScrollDown()
2883 local newAimSensitivity = aimSensitivity - S.sensitivitySettings.Increment
2884 aimSensitivity = (
2885 newAimSensitivity < S.sensitivitySettings.Min and S.sensitivitySettings.Min or
2886 newAimSensitivity > S.sensitivitySettings.Max and S.sensitivitySettings.Max or
2887 newAimSensitivity
2888 )
2889 mouseSensitivity = (Aimed and aimSensitivity or mouseSensitivity)
2890
2891 Sens.Text = "S: "..aimSensitivity
2892 if mainGUI:IsDescendantOf(game) then
2893 Sens.Visible = true
2894 local t0 = tick()
2895 lastSensUpdate = t0
2896
2897 wait(0.3)
2898
2899 if lastSensUpdate <= t0 then
2900 Sens.Visible = false
2901 end
2902 end
2903end
2904
2905--------------------[ KEYBOARD FUNCTIONS ]--------------------------------------------
2906
2907function keyDown(K)
2908 local Key = string.lower(K)
2909
2910 if Key == S.Keys.lowerStance and S.canChangeStance then
2911 if (not Running) then
2912 if Stance == 0 then
2913 if S.stanceSettings.Stances.Crouch then
2914 Crouch()
2915 elseif S.stanceSettings.Stances.Prone then
2916 Prone()
2917 end
2918 elseif Stance == 1 then
2919 if S.stanceSettings.Stances.Prone then
2920 Prone()
2921 end
2922 end
2923 elseif S.dolphinDive then
2924 wait()
2925 if Humanoid:GetState() ~= Enum.HumanoidStateType.Freefall and (not UIS:IsKeyDown("Space")) and runReady then
2926 local tempConnection = Humanoid.Changed:connect(function()
2927 Humanoid.Jump = false
2928 end)
2929 runReady = false
2930 Dive()
2931 Running = false
2932 wait(S.diveSettings.rechargeTime)
2933 tempConnection:disconnect()
2934 runReady = true
2935 end
2936 end
2937 end
2938
2939 if Key == S.Keys.raiseStance and S.canChangeStance then
2940 if (not Running) then
2941 if Stance == 2 then
2942 if S.stanceSettings.Stances.Crouch then
2943 Crouch()
2944 else
2945 Stand()
2946 end
2947 elseif Stance == 1 then
2948 Stand()
2949 end
2950 end
2951 end
2952
2953 if Key == S.Keys.ADS then
2954 if S.aimSettings.holdToADS then
2955 if (not AimingIn) and (not Aimed) then
2956 AimingIn = true
2957 aimGun()
2958 AimingIn = false
2959 end
2960 else
2961 if Aimed then
2962 unAimGun()
2963 else
2964 aimGun()
2965 end
2966 end
2967 end
2968
2969 if Key == S.Keys.selectFire and S.selectFire then
2970 if canSelectFire then
2971 canSelectFire = false
2972 rawFireMode = rawFireMode + 1
2973 modeGUI.Text = Modes[((rawFireMode - 1) % numModes) + 1]
2974 if modeGUI.Text == "AUTO" then
2975 fireFunction = autoFire
2976 elseif modeGUI.Text == "BURST" then
2977 fireFunction = burstFire
2978 elseif modeGUI.Text == "SEMI" then
2979 fireFunction = semiFire
2980 else
2981 fireFunction = nil
2982 end
2983 local speedAlpha = S.selectFireSettings.animSpeed / 0.6
2984 if S.selectFireSettings.GUI then
2985 spawn(function()
2986 fireSelect.Visible = true
2987 local prevRawFireMode = rawFireMode
2988 local Increment = 1.5 / (speedAlpha * 0.25)
2989 local X = 0
2990 wait(speedAlpha * 0.1)
2991 while true do
2992 RS.RenderStepped:wait()
2993 local newX = X + Increment
2994 X = (newX > 90 and 90 or newX)
2995 if prevRawFireMode ~= rawFireMode then break end
2996 updateModeLabels(rawFireMode - 1, rawFireMode, X)
2997 if X == 90 then break end
2998 end
2999 wait(speedAlpha * 0.25)
3000 fireSelect.Visible = false
3001 end)
3002 end
3003 if S.selectFireSettings.Animation and (not Aimed) and (not isRunning) and (not isCrawling) then
3004 spawn(function()
3005 local sequenceTable = {
3006 function()
3007 tweenJoint(RWeld2, nil, CFANG(0, RAD(5), 0), Sine, speedAlpha * 0.15)
3008 tweenJoint(LWeld, armC0[1], CF(0.1, 1, -0.3) * CFANG(RAD(-7), 0, RAD(-65)), Linear, speedAlpha * 0.15)
3009 wait(speedAlpha * 0.2)
3010 end;
3011
3012 function()
3013 tweenJoint(LWeld, armC0[1], CF(0.1, 1, -0.3) * CFANG(RAD(-10), 0, RAD(-65)), Linear, speedAlpha * 0.1)
3014 wait(speedAlpha * 0.2)
3015 end;
3016
3017 function()
3018 tweenJoint(RWeld2, nil, CF(), Sine, speedAlpha * 0.2)
3019 tweenJoint(LWeld, armC0[1], S.unAimedC1.leftArm, Sine, speedAlpha * 0.2)
3020 wait(speedAlpha * 0.2)
3021 end;
3022 }
3023
3024 for _, F in pairs(sequenceTable) do
3025 if Aimed or isRunning or isCrawling or Reloading then
3026 break
3027 end
3028 F()
3029 end
3030 end)
3031 end
3032 if S.selectFireSettings.Animation or S.selectFireSettings.GUI then
3033 wait(S.selectFireSettings.animSpeed)
3034 end
3035 canSelectFire = true
3036 end
3037 end
3038
3039 if Key == S.Keys.Reload then
3040 if (not Reloading) and (not isCrawling) then
3041 Reload()
3042 end
3043 end
3044
3045 if Key == S.Keys.Sprint then
3046 runKeyPressed = true
3047 if runReady then
3048 if (not Idling) and Walking and (not Running) and (not Knifing) and (not (Aimed and S.guiScope and S.Keys.Sprint == S.Keys.scopeSteady)) then
3049 monitorStamina()
3050 end
3051 end
3052 end
3053
3054 if Key == S.Keys.scopeSteady then
3055 steadyKeyPressed = true
3056 if Aimed and (not Aiming) then
3057 takingBreath = false
3058 steadyCamera()
3059 end
3060 end
3061
3062 for _, PTable in pairs(Plugins.KeyDown) do
3063 if Key == string.lower(PTable.Key) then
3064 spawn(function()
3065 PTable.Plugin()
3066 end)
3067 end
3068 end
3069end
3070
3071function keyUp(K)
3072 local Key = string.lower(K)
3073
3074 if Key == S.Keys.ADS then
3075 if S.aimSettings.holdToADS then
3076 if (not AimingOut) and Aimed then
3077 AimingOut = true
3078 unAimGun()
3079 AimingOut = false
3080 end
3081 end
3082 end
3083
3084 if Key == S.Keys.Sprint then
3085 runKeyPressed = false
3086 Running = false
3087 if (not chargingStamina) then
3088 rechargeStamina()
3089 end
3090 end
3091
3092 if Key == S.Keys.scopeSteady then
3093 steadyKeyPressed = false
3094 end
3095
3096 for _, PTable in pairs(Plugins.KeyUp) do
3097 if Key == string.lower(PTable.Key) then
3098 spawn(function()
3099 PTable.Plugin()
3100 end)
3101 end
3102 end
3103end
3104
3105--------------------[ END FUNCTIONS ]-------------------------------------------------
3106
3107--------------------------------------------------------------------------------------
3108--------------------[ PRE-CONNECTIONS ]-----------------------------------------------
3109--------------------------------------------------------------------------------------
3110
3111local function updateAnimVars()
3112 wait()
3113 Forward = (UIS:IsKeyDown("W") or UIS:IsKeyDown("Up"))
3114 Backward = (UIS:IsKeyDown("S") or UIS:IsKeyDown("Down"))
3115 local Right = UIS:IsKeyDown("D")
3116 local Left = UIS:IsKeyDown("A")
3117
3118 local walkingForward = (Forward and (not Backward))
3119 local walkingBackward = ((not Forward) and Backward)
3120 local walkingRight = (Right and (not Left))
3121 local walkingLeft = ((not Right) and Left)
3122
3123 if (Forward or Backward or Right or Left) then
3124 Walking, Idling = true, false
3125 if (not Running) and (not Aimed) then
3126 spreadMotion = "Moving"
3127 baseSpread = S.spreadSettings[spreadZoom][spreadStance][spreadMotion]
3128 end
3129 elseif (not (Forward and Backward and Right and Left)) then
3130 Walking, Idling = false, true
3131 if (not Aimed) then
3132 spreadMotion = "Idling"
3133 baseSpread = S.spreadSettings[spreadZoom][spreadStance][spreadMotion]
3134 end
3135 end
3136
3137 local newArmTilt = (
3138 ((walkingForward or walkingBackward) and walkingRight) and 2.5 or
3139 ((walkingForward or walkingBackward) and walkingLeft) and -2.5 or
3140 ((not (walkingForward and walkingBackward)) and walkingRight) and 5 or
3141 ((not (walkingForward and walkingBackward)) and walkingLeft) and -5 or 0
3142 )
3143 local newMoveAng = (
3144 (walkingForward and (not (walkingRight or walkingLeft))) and 0 or
3145 (walkingForward and walkingRight) and RAD(-45) or
3146 ((not (walkingForward or walkingBackward)) and walkingRight) and RAD(-90) or
3147 (walkingBackward and walkingRight) and RAD(-135) or
3148 (walkingBackward and (not (walkingRight or walkingLeft))) and (moveAng < 0 and RAD(-180) or RAD(180)) or
3149 (walkingBackward and walkingLeft) and RAD(135) or
3150 ((not (walkingForward or walkingBackward)) and walkingLeft) and RAD(90) or
3151 (walkingForward and walkingLeft) and RAD(45) or 0
3152 )
3153
3154 local newAnimCode = math.random(-1e9, 1e9)
3155 animCode = newAnimCode
3156 local startTilt = armTilt
3157 local startAng = (ABS(moveAng) == RAD(180)) and (newMoveAng > 0 and RAD(180) or RAD(-180)) or moveAng
3158 local Increment = (startTilt == newArmTilt and 1.5 / 0.7 or 1.5 / (0.35 * ABS(startTilt - newArmTilt) / 5))
3159 local X = 0
3160 while true do
3161 RS.RenderStepped:wait()
3162 local newX = X + Increment
3163 X = (newX > 90 and 90 or newX)
3164 if animCode ~= newAnimCode then break end
3165 armTilt = numLerp(startTilt, newArmTilt, Sine(X))
3166 moveAng = numLerp(startAng, newMoveAng, Sine(X))
3167 if X == 90 then break end
3168 end
3169end
3170
3171M2.KeyDown:connect(updateAnimVars)
3172M2.KeyUp:connect(updateAnimVars)
3173updateAnimVars()
3174
3175--------------------------------------------------------------------------------------
3176--------------------[ TOOL SELECTION AND DESELECTION ]--------------------------------
3177--------------------------------------------------------------------------------------
3178
3179function onEquipped()
3180 wait()
3181 if Humanoid.Health ~= 0 and (not Selected) and Gun.Parent == Char then
3182 Selected = true
3183 breakReload = false
3184 equipAnimPlaying = true
3185
3186 math.randomseed(tick()) --This sets a new seed for the random function each time you select the gun
3187
3188 --------------------[ FAILSAFE RESETING ]-------------------------------------
3189
3190 for _, GM in pairs(ignoreModel:GetChildren()) do
3191 if GM.Name == "gunIgnore_"..Player.Name then
3192 GM:Destroy()
3193 end
3194 end
3195
3196 for _, c in pairs(Connections) do
3197 c:disconnect()
3198 end
3199
3200 Connections = {}
3201
3202 --------------------[ REMOTE GUN SETUP ]--------------------------------------
3203
3204 --[[local Vars = {
3205 ignoreModel = ignoreModel;
3206 Humanoid = Humanoid;
3207 Shoulders = Shoulders;
3208 Torso = Torso;
3209 Head = Head;
3210 armC0 = armC0;
3211 leftArmC1 = S.equipSettings.leftArmC1;
3212 rightArmC1 = S.equipSettings.rightArmC1;
3213 LArm = LArm;
3214 RArm = RArm;
3215 gunParts = gunParts;
3216 Handle = Handle;
3217 }
3218 gunIgnore, playerFolder, headWeld, headWeld2, animWeld, ABWeld, LWeld, RWeld, LWeld2, RWeld2, LLegWeld, RLegWeld, gunParts2 = gunSetup:InvokeServer(Vars)]]
3219
3220 --------------------[ CREATING IGNORE MODELS ]--------------------------------
3221
3222 gunIgnore = Instance.new("Model")
3223 gunIgnore.Name = "gunIgnore_"..Player.Name
3224 gunIgnore.Parent = ignoreModel
3225
3226 --------------------[ MODIFYING THE PLAYER ]----------------------------------
3227
3228 Player.CameraMode = Enum.CameraMode.LockFirstPerson
3229 Cam.CameraType = Enum.CameraType.Scriptable
3230 Cam.FieldOfView = 80
3231 UIS.MouseBehavior = Enum.MouseBehavior.LockCenter
3232 UIS.MouseIconEnabled = false
3233
3234 local initialX, initialY = getYawPitch(Cam.CoordinateFrame)
3235 camAng = -VEC2(initialX, initialY)
3236
3237 mainGUI.Parent = Player.PlayerGui
3238
3239 setUpGUI()
3240 updateHealth()
3241
3242 if S.selectFire then
3243 local currentMode = Modes[((rawFireMode - 1) % numModes) + 1]
3244 if currentMode == "AUTO" then
3245 fireFunction = autoFire
3246 elseif currentMode == "BURST" then
3247 fireFunction = burstFire
3248 elseif currentMode == "SEMI" then
3249 fireFunction = semiFire
3250 else
3251 fireFunction = nil
3252 end
3253 else
3254 if S.gunType.Semi then
3255 fireFunction = semiFire
3256 elseif S.gunType.Auto then
3257 fireFunction = autoFire
3258 elseif S.gunType.Burst then
3259 fireFunction = burstFire
3260 else
3261 fireFunction = nil
3262 end
3263 end
3264
3265 changePlayerTrans(Char, 1)
3266
3267 Humanoid.AutoRotate = false
3268
3269 Shoulders.Right.Part1 = nil
3270 Shoulders.Left.Part1 = nil
3271
3272 playerFolder = Instance.new("Model")
3273 playerFolder.Name = "playerFolder"
3274 playerFolder.Parent = gunIgnore
3275
3276 local headBase = Instance.new("Part")
3277 headBase.Transparency = 1
3278 headBase.Name = "headBase"
3279 headBase.CanCollide = false
3280 headBase.FormFactor = Enum.FormFactor.Custom
3281 headBase.Size = V3(0.2, 0.2, 0.2)
3282 headBase.BottomSurface = Enum.SurfaceType.Smooth
3283 headBase.TopSurface = Enum.SurfaceType.Smooth
3284 headBase.Parent = playerFolder
3285
3286 headWeld = Instance.new("Weld")
3287 headWeld.Part0 = Torso
3288 headWeld.Part1 = headBase
3289 headWeld.C0 = CF(0, 1.5, 0)
3290 headWeld.Parent = Torso
3291
3292 headWeld2 = Instance.new("Weld")
3293 headWeld2.Part0 = headBase
3294 headWeld2.Part1 = Head
3295 headWeld2.Parent = headBase
3296
3297 neckClone = Neck:Clone()
3298
3299 --[[local stanceBase = Instance.new("Part")
3300 stanceBase.Transparency = 1
3301 stanceBase.Name = "stanceBase"
3302 stanceBase.CanCollide = false
3303 stanceBase.FormFactor = Enum.FormFactor.Custom
3304 stanceBase.Size = V3(0.2, 0.2, 0.2)
3305 stanceBase.BottomSurface = Enum.SurfaceType.Smooth
3306 stanceBase.TopSurface = Enum.SurfaceType.Smooth
3307 stanceBase.Parent = playerFolder
3308
3309 stanceWeld = Instance.new("Weld")
3310 stanceWeld.Part0 = stanceBase
3311 stanceWeld.Part1 = Torso
3312 stanceWeld.Parent = stanceBase]]
3313
3314 local animBase = Instance.new("Part")
3315 animBase.Transparency = 1
3316 animBase.Name = "animBase"
3317 animBase.CanCollide = false
3318 animBase.FormFactor = Enum.FormFactor.Custom
3319 animBase.Size = V3(0.2, 0.2, 0.2)
3320 animBase.BottomSurface = Enum.SurfaceType.Smooth
3321 animBase.TopSurface = Enum.SurfaceType.Smooth
3322 animBase.Parent = playerFolder
3323
3324 animWeld = Instance.new("Weld")
3325 animWeld.Part0 = animBase
3326 animWeld.Part1 = headBase
3327 animWeld.Parent = animBase
3328
3329 local ArmBase = Instance.new("Part")
3330 ArmBase.Transparency = 1
3331 ArmBase.Name = "ArmBase"
3332 ArmBase.CanCollide = false
3333 ArmBase.FormFactor = Enum.FormFactor.Custom
3334 ArmBase.Size = V3(0.2, 0.2, 0.2)
3335 ArmBase.BottomSurface = Enum.SurfaceType.Smooth
3336 ArmBase.TopSurface = Enum.SurfaceType.Smooth
3337 ArmBase.Parent = playerFolder
3338
3339 ABWeld = Instance.new("Weld")
3340 ABWeld.Part0 = ArmBase
3341 ABWeld.Part1 = animBase
3342 ABWeld.Parent = ArmBase
3343
3344 local LArmBase = Instance.new("Part")
3345 LArmBase.Transparency = 1
3346 LArmBase.Name = "LArmBase"
3347 LArmBase.CanCollide = false
3348 LArmBase.FormFactor = Enum.FormFactor.Custom
3349 LArmBase.Size = V3(0.2, 0.2, 0.2)
3350 LArmBase.BottomSurface = Enum.SurfaceType.Smooth
3351 LArmBase.TopSurface = Enum.SurfaceType.Smooth
3352 LArmBase.Parent = playerFolder
3353
3354 local RArmBase = Instance.new("Part")
3355 RArmBase.Transparency = 1
3356 RArmBase.Name = "RArmBase"
3357 RArmBase.CanCollide = false
3358 RArmBase.FormFactor = Enum.FormFactor.Custom
3359 RArmBase.Size = V3(0.2, 0.2, 0.2)
3360 RArmBase.BottomSurface = Enum.SurfaceType.Smooth
3361 RArmBase.TopSurface = Enum.SurfaceType.Smooth
3362 RArmBase.Parent = playerFolder
3363
3364 LWeld = Instance.new("Weld")
3365 LWeld.Name = "LWeld"
3366 LWeld.Part0 = ArmBase
3367 LWeld.Part1 = LArmBase
3368 LWeld.C0 = armC0[1]
3369 LWeld.C1 = S.equipSettings.leftArmC1
3370 LWeld.Parent = ArmBase
3371
3372 RWeld = Instance.new("Weld")
3373 RWeld.Name = "RWeld"
3374 RWeld.Part0 = ArmBase
3375 RWeld.Part1 = RArmBase
3376 RWeld.C0 = armC0[2]
3377 RWeld.C1 = S.equipSettings.rightArmC1
3378 RWeld.Parent = ArmBase
3379
3380 LWeld2 = Instance.new("Weld")
3381 LWeld2.Name = "LWeld"
3382 LWeld2.Part0 = LArmBase
3383 LWeld2.Part1 = LArm
3384 LWeld2.Parent = LArmBase
3385
3386 RWeld2 = Instance.new("Weld")
3387 RWeld2.Name = "RWeld"
3388 RWeld2.Part0 = RArmBase
3389 RWeld2.Part1 = RArm
3390 RWeld2.Parent = RArmBase
3391
3392 LLegWeld = Instance.new("Weld")
3393 LLegWeld.Name = "LLegWeld"
3394 LLegWeld.Part0 = Torso
3395 LLegWeld.Part1 = nil
3396 LLegWeld.C0 = CF(-0.5, -2, 0)
3397 LLegWeld.Parent = Torso
3398
3399 RLegWeld = Instance.new("Weld")
3400 RLegWeld.Name = "RLegWeld"
3401 RLegWeld.Part0 = Torso
3402 RLegWeld.Part1 = nil
3403 RLegWeld.C0 = CF(0.5, -2, 0)
3404 RLegWeld.Parent = Torso
3405
3406 if S.playerArms then
3407 armModel = Instance.new("Model", workspace.FilteringEnabled and playerFolder or Cam)
3408
3409 fakeLArm = LArm:Clone()
3410 fakeLArm.Parent = armModel
3411 fakeLArm.Transparency = S.fakeArmSettings.Transparency
3412 fakeLArm.CanCollide = false
3413 fakeLArm.Size = S.fakeArmSettings.armSize
3414 fakeLArm:BreakJoints()
3415
3416 --LArm.Transparency = 1
3417
3418 local fakeLWeld = Instance.new("Weld")
3419 fakeLWeld.Part0 = fakeLArm
3420 fakeLWeld.Part1 = LArm
3421 fakeLWeld.Parent = fakeLArm
3422
3423 fakeRArm = RArm:Clone()
3424 fakeRArm.Parent = armModel
3425 fakeRArm.Transparency = S.fakeArmSettings.Transparency
3426 fakeRArm.CanCollide = false
3427 fakeRArm.Size = S.fakeArmSettings.armSize
3428 fakeRArm:BreakJoints()
3429
3430 --RArm.Transparency = 1
3431
3432 local fakeRWeld = Instance.new("Weld")
3433 fakeRWeld.Part0 = fakeRArm
3434 fakeRWeld.Part1 = RArm
3435 fakeRWeld.Parent = fakeRArm
3436
3437 Instance.new("Humanoid", armModel)
3438
3439 if S.fakeArmSettings.characterMeshes then
3440 for _,Obj in pairs(Char:GetChildren()) do
3441 if Obj:IsA("CharacterMesh") then
3442 Obj:Clone().Parent = armModel
3443 end
3444 end
3445 end
3446 for _,Obj in pairs(Char:GetChildren()) do
3447 if Obj:IsA("Shirt") then
3448 Obj:Clone().Parent = armModel
3449 end
3450 end
3451 else
3452 armTable = createArms()
3453 if workspace.FilteringEnabled then
3454 armTable[1].Model.Parent = playerFolder
3455 armTable[2].Model.Parent = playerFolder
3456 else
3457 armTable[1].Model.Parent = Cam--playerFolder
3458 armTable[2].Model.Parent = Cam--playerFolder
3459 end
3460
3461 fakeLArm = armTable[1].armPart
3462
3463 --LArm.Transparency = 1
3464
3465 local fakeLWeld = Instance.new("Weld")
3466 fakeLWeld.Part0 = fakeLArm
3467 fakeLWeld.Part1 = LArm
3468 fakeLWeld.Parent = fakeLArm
3469
3470 fakeRArm = armTable[2].armPart
3471
3472 --RArm.Transparency = 1
3473
3474 local fakeRWeld = Instance.new("Weld")
3475 fakeRWeld.Part0 = fakeRArm
3476 fakeRWeld.Part1 = RArm
3477 fakeRWeld.Parent = fakeRArm
3478 end
3479
3480 --------------------[ MODIFYING THE GUN ]-------------------------------------
3481
3482 for _, Tab in pairs(gunParts) do
3483 local Weld = Instance.new("Weld")
3484 Weld.Name = "MainWeld"
3485 Weld.Part0 = Handle
3486 Weld.Part1 = Tab.Obj
3487 Weld.C0 = Tab.Obj.weldCF.Value
3488 Weld.Parent = Handle
3489 Tab.Weld = Weld
3490 end
3491
3492 Grip = RArm:WaitForChild("RightGrip")
3493
3494 local handleCF = Torso.CFrame * CF(0, 0.5, 0) * armC0[2] * S.aimedC1.rightArm:inverse() * Grip.C0
3495 local handleOffset = AimPart.CFrame:toObjectSpace(Handle.CFrame)
3496 aimedGripCF = ((Torso.CFrame * CF(headOffset.X, headOffset.Y, 0)) * handleOffset):toObjectSpace(handleCF)
3497
3498 Grip.C1 = S.equipSettings.GripC1
3499
3500 --------------------[ RUNNING PLUGINS ]---------------------------------------
3501
3502 for _, Plugin in pairs(Plugins.OnEquipped) do
3503 spawn(function()
3504 Plugin()
3505 end)
3506 end
3507
3508 --------------------[ GETTING PLAYER MASS ]-----------------------------------
3509
3510 local connectedParts = HRP:GetConnectedParts(true)
3511 for _, v in pairs(connectedParts) do
3512 if v:IsA("BasePart") then
3513 playerMass = playerMass + v:GetMass()
3514 end
3515 end
3516
3517 --------------------[ CONNECTIONS ]-------------------------------------------
3518
3519 INSERT(Connections, Humanoid.Died:connect(function()
3520 onUnequipped(true)
3521 end))
3522
3523 INSERT(Connections, Humanoid.Jumping:connect(function()
3524 if Stance ~= 0 then
3525 Stand()
3526 end
3527 end))
3528
3529 INSERT(Connections, Humanoid.StateChanged:connect(onHumanoidStateChanged))
3530
3531 INSERT(Connections, Humanoid.HealthChanged:connect(updateHealth))
3532
3533 INSERT(Connections, M2.Button1Down:connect(onMB1Down))
3534
3535 INSERT(Connections, M2.Button1Up:connect(onMB1Up))
3536
3537 INSERT(Connections, M2.Button2Down:connect(onMB2Down))
3538
3539 INSERT(Connections, M2.Button2Up:connect(onMB2Up))
3540
3541 INSERT(Connections, M2.KeyDown:connect(keyDown))
3542
3543 INSERT(Connections, M2.KeyUp:connect(keyUp))
3544
3545 if S.sensitivitySettings.scrollToChange then
3546 INSERT(Connections, M2.WheelForward:connect(onScrollUp))
3547 INSERT(Connections, M2.WheelBackward:connect(onScrollDown))
3548 end
3549
3550 if S.AutoKnife then
3551 INSERT(Connections, RS.Stepped:connect(function()
3552 local H, P = AdvRayCast(Head.CFrame.p, Head.CFrame.lookVector, S.AutoKnifeDist, nil)
3553 if H then
3554 local HitHuman = findFirstClass(H.Parent, "Humanoid")
3555 if HitHuman and isEnemy(HitHuman) and HitHuman.Health ~= 0 then
3556 Knife()
3557 end
3558 end
3559 end))
3560 end
3561
3562 INSERT(Connections, UIS.InputChanged:connect(function(inputObj)
3563 if inputObj.UserInputType == Enum.UserInputType.MouseMovement then
3564 local rawCamAng = camAng - (VEC2(RAD(inputObj.Delta.x), RAD(inputObj.Delta.y)) * mouseSensitivity * 0.25)
3565 camAng = VEC2(rawCamAng.x, (rawCamAng.y > RAD(80) and RAD(80) or rawCamAng.y < RAD(-80) and RAD(-80) or rawCamAng.y))
3566
3567 desiredXOffset = math.min(math.max(inputObj.Delta.x, -S.momentumSettings.maxInput), S.momentumSettings.maxInput)
3568 desiredYOffset = math.min(math.max(inputObj.Delta.y, -S.momentumSettings.maxInput), S.momentumSettings.maxInput)
3569 end
3570 end))
3571
3572 INSERT(Connections, M2.Idle:connect(function(inputObj)
3573 desiredXOffset = 0
3574 desiredYOffset = 0
3575 end))
3576
3577 INSERT(Connections, RS.Stepped:connect(function()
3578 if tick() - lastBeat > (Humanoid.Health / 75) then
3579 lastBeat = tick()
3580 HUD.Health.Tray.Beat:TweenPosition(
3581 UDim2.new(0, -21, 0, 0),
3582 Enum.EasingDirection.Out,
3583 Enum.EasingStyle.Linear,
3584 0.7 - ((100 - Humanoid.Health) / 400),
3585 false,
3586 function()
3587 HUD.Health.Tray.Beat.Position = UDim2.new(1, 0, 0, 0)
3588 end
3589 )
3590 end
3591 end))
3592
3593 INSERT(Connections, RS.RenderStepped:connect(function()
3594 --Main animation
3595 local animC0, animC1 = getAnimCF()
3596 animWeld.C0 = animC0
3597 animWeld.C1 = animC1
3598
3599 --Camera updating
3600 renderCamera()
3601 end))
3602
3603 --------------------[ ANIMATE GUN ]-------------------------------------------
3604
3605 tweenJoint(LWeld, nil, S.unAimedC1.leftArm, Sine, S.equipSettings.Time)
3606 tweenJoint(RWeld, nil, S.unAimedC1.rightArm, Sine, S.equipSettings.Time)
3607 tweenJoint(Grip, nil, S.unAimedC1.Grip, Sine, S.equipSettings.Time)
3608 spawn(function()
3609 local T = tick()
3610 while true do
3611 if tick() - T > S.equipSettings.Time then break end
3612 if (not Selected) then break end
3613 wait()
3614 end
3615 equipAnimPlaying = false
3616 end)
3617
3618 Animate()
3619 end
3620end
3621
3622function onUnequipped(deleteTool)
3623 if Selected then
3624 Selected = false
3625
3626 breakReload = true
3627
3628 --------------------[ RUNNING PLUGINS ]---------------------------------------
3629
3630 for _, Plugin in pairs(Plugins.OnUnEquipped) do
3631 spawn(function()
3632 Plugin()
3633 end)
3634 end
3635
3636 --------------------[ MODIFYING THE PLAYER ]----------------------------------
3637
3638 Cam.FieldOfView = 70
3639 Cam.CameraType = Enum.CameraType.Custom
3640
3641 UIS.MouseBehavior = Enum.MouseBehavior.Default
3642 UIS.MouseIconEnabled = true
3643
3644 Player.CameraMode = Enum.CameraMode.Classic
3645
3646 if armTable then
3647 armTable[1].Model:Destroy()
3648 armTable[2].Model:Destroy()
3649 elseif armModel then
3650 armModel:Destroy()
3651 end
3652
3653 LLegWeld:Destroy()
3654 RLegWeld:Destroy()
3655
3656 changePlayerTrans(Char, 0)
3657
3658 mainGUI.Parent = script
3659
3660 Shoulders.Right.Part1 = RArm
3661 Shoulders.Left.Part1 = LArm
3662
3663 neckClone.Parent = Torso
3664 headWeld:Destroy()
3665
3666 Humanoid.WalkSpeed = 16
3667 Humanoid.AutoRotate = true
3668
3669 --------------------[ RESETING THE TOOL ]-------------------------------------
3670
3671 gunIgnore:Destroy()
3672
3673 mouseSensitivity = S.sensitivitySettings.Default
3674
3675 MB1Down = false
3676
3677 playerMass = 0
3678
3679 Aimed = false
3680
3681 camOffsets = {
3682 guiScope = {
3683 Rot = V3();
3684 };
3685 Reload = {
3686 Rot = V3();
3687 Code = nil;
3688 };
3689 Recoil = {
3690 Rot = V3();
3691 Code = nil;
3692 };
3693 }
3694
3695 recoilAnim = {
3696 Pos = V3();
3697 Rot = V3();
3698 Code = nil;
3699 }
3700
3701 --Setting the aim variables to unaimed
3702 spreadZoom = "unAimed"
3703 scopeMain.Visible = false
3704 scopeSteady.Visible = false
3705 aimAlpha = 0
3706 aimHeadOffset = 0
3707 jumpAnimMultiplier = 1
3708 translationDivisor = 7
3709 rotationMultiplier = S.momentumSettings.Amplitude.unAimed
3710 armTiltMultiplier = 1
3711 Scope.BackgroundTransparency = 1
3712 if S.guiScope then
3713 spawn(function()
3714 for _, Obj in pairs(Gun:GetChildren()) do
3715 if Obj:IsA("BasePart") then
3716 Obj.LocalTransparencyModifier = 0
3717 end
3718 end
3719 end)
3720 end
3721
3722 onGround = true
3723
3724 for _, Tab in pairs(gunParts) do
3725 Tab.Weld:Destroy()
3726 Tab.Weld = nil
3727 end
3728
3729 for _,c in pairs(Connections) do
3730 c:disconnect()
3731 end
3732
3733 Connections = {}
3734
3735 if deleteTool then
3736 Cam:ClearAllChildren()
3737 Gun:Destroy()
3738 end
3739
3740 wait() --This is here in case you dolphin dived and deselected the tool instantly
3741
3742 if S.stanceSettings.standOnDeselect and Stance ~= 0 then
3743 crawlCamRot = 0
3744 isCrawling = false
3745 stanceSway = 1
3746 spreadStance = "Stand"
3747 Stand(true)
3748 end
3749 baseSpread = S.spreadSettings[spreadZoom][spreadStance][spreadMotion]
3750 end
3751end
3752
3753Gun.Equipped:connect(onEquipped)
3754Gun.Unequipped:connect(function() onUnequipped(false) end)
3755
3756--------------------------------------------------------------------------------------
3757--------------------[ END PROGRAM ]---------------------------------------------------
3758--------------------------------------------------------------------------------------
3759end,o5)
3760end))
3761o6.Name = "ignoreCode"
3762o6.Parent = o5
3763o7.Name = "Server_Scripts"
3764o7.Parent = o5
3765o10.Name = "mainGUI"
3766o10.Parent = o5
3767o11.Name = "HUD"
3768o11.Parent = o10
3769o11.Position = UDim2.new(1,-160,1,-140)
3770o11.Size = UDim2.new(0,160,0,160)
3771o11.Position = UDim2.new(1,-160,1,-140)
3772o11.BackgroundColor3 = Color3.new(1, 1, 1)
3773o11.BackgroundTransparency = 1
3774o12.Name = "Ammo"
3775o12.Parent = o11
3776o12.Position = UDim2.new(0,5,0,60)
3777o12.Size = UDim2.new(0,135,0,40)
3778o12.Position = UDim2.new(0,5,0,60)
3779o12.BackgroundTransparency = 1
3780o12.ZIndex = 10
3781o13.Name = "Slash"
3782o13.Parent = o12
3783o13.Position = UDim2.new(0,92,0,-12)
3784o13.Size = UDim2.new(0,0,0,45)
3785o13.Text = "/"
3786o13.Position = UDim2.new(0,92,0,-12)
3787o13.Visible = false
3788o13.BackgroundTransparency = 1
3789o13.ZIndex = 10
3790o13.Font = Enum.Font.SciFi
3791o13.FontSize = Enum.FontSize.Size24
3792o13.TextColor3 = Color3.new(1, 1, 1)
3793o14.Name = "Stored"
3794o14.Parent = o12
3795o14.Position = UDim2.new(0,100,0,-35)
3796o14.Size = UDim2.new(1,0,0,85)
3797o14.Text = "999"
3798o14.Position = UDim2.new(0,100,0,-35)
3799o14.Visible = false
3800o14.BackgroundTransparency = 1
3801o14.ZIndex = 10
3802o14.Font = Enum.Font.Code
3803o14.FontSize = Enum.FontSize.Size28
3804o14.TextColor3 = Color3.new(1, 1, 1)
3805o14.TextXAlignment = Enum.TextXAlignment.Left
3806o15.Name = "Clip"
3807o15.Parent = o12
3808o15.Position = UDim2.new(0,32,0,-5)
3809o15.Size = UDim2.new(0,85,1,0)
3810o15.Text = "999"
3811o15.Position = UDim2.new(0,32,0,-5)
3812o15.BackgroundTransparency = 1
3813o15.ZIndex = 10
3814o15.Font = Enum.Font.Code
3815o15.FontSize = Enum.FontSize.Size48
3816o15.TextColor3 = Color3.new(1, 1, 1)
3817o15.TextWrapped = true
3818o16.Name = "Controls"
3819o16.Parent = o11
3820o16.Position = UDim2.new(0,0,0,-200)
3821o16.Size = UDim2.new(1,0,0,120)
3822o16.Position = UDim2.new(0,0,0,-200)
3823o16.Visible = false
3824o16.BackgroundColor3 = Color3.new(0.156863, 0.156863, 0.156863)
3825o16.BackgroundTransparency = 0.30000001192093
3826o16.BorderColor3 = Color3.new(0.156863, 0.156863, 0.156863)
3827o16.BorderSizePixel = 5
3828o16.ZIndex = 10
3829o17.Name = "Title"
3830o17.Parent = o16
3831o17.Size = UDim2.new(1,0,0,15)
3832o17.Text = "CONTROLS"
3833o17.BackgroundColor3 = Color3.new(1, 1, 1)
3834o17.BackgroundTransparency = 1
3835o17.ZIndex = 10
3836o17.Font = Enum.Font.SourceSansBold
3837o17.FontSize = Enum.FontSize.Size14
3838o17.TextColor3 = Color3.new(1, 1, 1)
3839o18.Name = "Line"
3840o18.Parent = o17
3841o18.Position = UDim2.new(0,0,1,1)
3842o18.Size = UDim2.new(1,0,0,2)
3843o18.Text = ""
3844o18.Position = UDim2.new(0,0,1,1)
3845o18.BackgroundColor3 = Color3.new(1, 1, 0)
3846o18.BorderSizePixel = 0
3847o18.ZIndex = 10
3848o18.Font = Enum.Font.SourceSans
3849o18.FontSize = Enum.FontSize.Size14
3850o19.Name = "Grenades"
3851o19.Parent = o11
3852o19.Position = UDim2.new(0,0,0,90)
3853o19.Size = UDim2.new(0,175,0,25)
3854o19.Position = UDim2.new(0,0,0,90)
3855o19.Visible = false
3856o19.BackgroundTransparency = 1
3857o19.ZIndex = 10
3858o20.Name = "Lethals"
3859o20.Parent = o19
3860o20.Size = UDim2.new(0.5,-2,1,0)
3861o20.BackgroundColor3 = Color3.new(1, 1, 1)
3862o20.BorderSizePixel = 0
3863o20.ZIndex = 10
3864o21.Name = "Icon"
3865o21.Parent = o20
3866o21.Position = UDim2.new(0,7,0,2)
3867o21.Size = UDim2.new(0,21,0,21)
3868o21.Position = UDim2.new(0,7,0,2)
3869o21.BackgroundColor3 = Color3.new(1, 1, 1)
3870o21.BackgroundTransparency = 1
3871o21.ZIndex = 10
3872o22.Name = "Mult"
3873o22.Parent = o20
3874o22.Position = UDim2.new(0.5,-10,0,0)
3875o22.Size = UDim2.new(0,20,1,0)
3876o22.Text = "X"
3877o22.Position = UDim2.new(0.5,-10,0,0)
3878o22.BackgroundColor3 = Color3.new(1, 1, 1)
3879o22.BackgroundTransparency = 1
3880o22.BorderSizePixel = 0
3881o22.ZIndex = 10
3882o22.Font = Enum.Font.ArialBold
3883o22.FontSize = Enum.FontSize.Size18
3884o22.TextColor3 = Color3.new(0, 0, 0)
3885o23.Name = "Num"
3886o23.Parent = o20
3887o23.Position = UDim2.new(1,-7,0,0)
3888o23.Size = UDim2.new(0,0,1,0)
3889o23.Text = "0"
3890o23.Position = UDim2.new(1,-7,0,0)
3891o23.BackgroundColor3 = Color3.new(1, 1, 1)
3892o23.BackgroundTransparency = 1
3893o23.ZIndex = 10
3894o23.Font = Enum.Font.ArialBold
3895o23.FontSize = Enum.FontSize.Size18
3896o23.TextColor3 = Color3.new(0, 0, 0)
3897o23.TextXAlignment = Enum.TextXAlignment.Right
3898o24.Name = "Tacticals"
3899o24.Parent = o19
3900o24.Position = UDim2.new(0.5,2,0,0)
3901o24.Size = UDim2.new(0.5,-2,1,0)
3902o24.Position = UDim2.new(0.5,2,0,0)
3903o24.BackgroundColor3 = Color3.new(1, 1, 1)
3904o24.BorderSizePixel = 0
3905o24.ZIndex = 10
3906o25.Name = "Icon"
3907o25.Parent = o24
3908o25.Position = UDim2.new(0,7,0,2)
3909o25.Size = UDim2.new(0,21,0,21)
3910o25.Position = UDim2.new(0,7,0,2)
3911o25.BackgroundColor3 = Color3.new(1, 1, 1)
3912o25.BackgroundTransparency = 1
3913o25.ZIndex = 10
3914o26.Name = "Num"
3915o26.Parent = o24
3916o26.Position = UDim2.new(1,-7,0,0)
3917o26.Size = UDim2.new(0,0,1,0)
3918o26.Text = "0"
3919o26.Position = UDim2.new(1,-7,0,0)
3920o26.BackgroundColor3 = Color3.new(1, 1, 1)
3921o26.BackgroundTransparency = 1
3922o26.ZIndex = 10
3923o26.Font = Enum.Font.ArialBold
3924o26.FontSize = Enum.FontSize.Size18
3925o26.TextColor3 = Color3.new(0, 0, 0)
3926o26.TextXAlignment = Enum.TextXAlignment.Right
3927o27.Name = "Mult"
3928o27.Parent = o24
3929o27.Position = UDim2.new(0.5,-10,0,0)
3930o27.Size = UDim2.new(0,20,1,0)
3931o27.Text = "X"
3932o27.Position = UDim2.new(0.5,-10,0,0)
3933o27.BackgroundColor3 = Color3.new(1, 1, 1)
3934o27.BackgroundTransparency = 1
3935o27.BorderSizePixel = 0
3936o27.ZIndex = 10
3937o27.Font = Enum.Font.ArialBold
3938o27.FontSize = Enum.FontSize.Size18
3939o27.TextColor3 = Color3.new(0, 0, 0)
3940o28.Name = "Health"
3941o28.Parent = o11
3942o28.Position = UDim2.new(0,25,0,20)
3943o28.Size = UDim2.new(0.40000000596046,0,0,25)
3944o28.Position = UDim2.new(0,25,0,20)
3945o28.Visible = false
3946o28.BackgroundColor3 = Color3.new(0.247059, 0.247059, 0.247059)
3947o28.BackgroundTransparency = 1
3948o28.BorderColor3 = Color3.new(0.156863, 0.156863, 0.156863)
3949o28.BorderSizePixel = 0
3950o28.ZIndex = 10
3951o28.Draggable = true
3952o29.Name = "Num"
3953o29.Parent = o28
3954o29.Position = UDim2.new(1,-50,0,0)
3955o29.Size = UDim2.new(0,50,1,0)
3956o29.Text = "100%"
3957o29.Position = UDim2.new(1,-50,0,0)
3958o29.BackgroundColor3 = Color3.new(0, 0, 0)
3959o29.BackgroundTransparency = 1
3960o29.BorderColor3 = Color3.new(0, 0, 0)
3961o29.BorderSizePixel = 0
3962o29.ZIndex = 10
3963o29.Font = Enum.Font.SourceSansBold
3964o29.FontSize = Enum.FontSize.Size24
3965o29.TextColor3 = Color3.new(1, 1, 1)
3966o29.TextStrokeColor3 = Color3.new(0.745098, 0.745098, 0.745098)
3967o29.TextXAlignment = Enum.TextXAlignment.Right
3968o30.Name = "Tray"
3969o30.Parent = o28
3970o30.Position = UDim2.new(0,2,0.5,-10)
3971o30.Size = UDim2.new(1,-60,0,20)
3972o30.Position = UDim2.new(0,2,0.5,-10)
3973o30.Visible = false
3974o30.BackgroundColor3 = Color3.new(0, 0, 0)
3975o30.BackgroundTransparency = 1
3976o30.BorderColor3 = Color3.new(0, 0, 0)
3977o30.BorderSizePixel = 0
3978o30.ZIndex = 10
3979o30.ClipsDescendants = true
3980o31.Name = "Beat"
3981o31.Parent = o30
3982o31.Position = UDim2.new(1,0,0,0)
3983o31.Size = UDim2.new(0,21,1,0)
3984o31.Position = UDim2.new(1,0,0,0)
3985o31.BackgroundColor3 = Color3.new(0, 0, 0)
3986o31.BackgroundTransparency = 1
3987o31.BorderColor3 = Color3.new(0, 0, 0)
3988o31.BorderSizePixel = 0
3989o31.ZIndex = 10
3990o32.Name = "00"
3991o32.Parent = o31
3992o32.Position = UDim2.new(0,0,0.5,-2)
3993o32.Size = UDim2.new(0.047619048506021,0,0,3)
3994o32.Position = UDim2.new(0,0,0.5,-2)
3995o32.BackgroundColor3 = Color3.new(1, 1, 1)
3996o32.BorderColor3 = Color3.new(0, 0, 0)
3997o32.BorderSizePixel = 0
3998o32.ZIndex = 10
3999o33.Name = "01"
4000o33.Parent = o31
4001o33.Position = UDim2.new(0.047619048506021,0,0.4230769276619,-2)
4002o33.Size = UDim2.new(0.047619048506021,0,0,4)
4003o33.Position = UDim2.new(0.047619048506021,0,0.4230769276619,-2)
4004o33.BackgroundColor3 = Color3.new(1, 1, 1)
4005o33.BorderColor3 = Color3.new(0, 0, 0)
4006o33.BorderSizePixel = 0
4007o33.ZIndex = 10
4008o34.Name = "02"
4009o34.Parent = o31
4010o34.Position = UDim2.new(0.095238097012043,0,0.34615385532379,-2)
4011o34.Size = UDim2.new(0.047619048506021,0,0,4)
4012o34.Position = UDim2.new(0.095238097012043,0,0.34615385532379,-2)
4013o34.BackgroundColor3 = Color3.new(1, 1, 1)
4014o34.BorderColor3 = Color3.new(0, 0, 0)
4015o34.BorderSizePixel = 0
4016o34.ZIndex = 10
4017o35.Name = "03"
4018o35.Parent = o31
4019o35.Position = UDim2.new(0.14285714924335,0,0.26923078298569,-2)
4020o35.Size = UDim2.new(0.047619048506021,0,0,4)
4021o35.Position = UDim2.new(0.14285714924335,0,0.26923078298569,-2)
4022o35.BackgroundColor3 = Color3.new(1, 1, 1)
4023o35.BorderColor3 = Color3.new(0, 0, 0)
4024o35.BorderSizePixel = 0
4025o35.ZIndex = 10
4026o36.Name = "04"
4027o36.Parent = o31
4028o36.Position = UDim2.new(0.19047619402409,0,0.19230769574642,-2)
4029o36.Size = UDim2.new(0.047619048506021,0,0,4)
4030o36.Position = UDim2.new(0.19047619402409,0,0.19230769574642,-2)
4031o36.BackgroundColor3 = Color3.new(1, 1, 1)
4032o36.BorderColor3 = Color3.new(0, 0, 0)
4033o36.BorderSizePixel = 0
4034o36.ZIndex = 10
4035o37.Name = "05"
4036o37.Parent = o31
4037o37.Position = UDim2.new(0.23809523880482,0,0.11538461595774,-2)
4038o37.Size = UDim2.new(0.047619048506021,0,0,4)
4039o37.Position = UDim2.new(0.23809523880482,0,0.11538461595774,-2)
4040o37.BackgroundColor3 = Color3.new(1, 1, 1)
4041o37.BorderColor3 = Color3.new(0, 0, 0)
4042o37.BorderSizePixel = 0
4043o37.ZIndex = 10
4044o38.Name = "06"
4045o38.Parent = o31
4046o38.Position = UDim2.new(0.28571429848671,0,0.038461539894342,-2)
4047o38.Size = UDim2.new(0.047619048506021,0,0,4)
4048o38.Position = UDim2.new(0.28571429848671,0,0.038461539894342,-2)
4049o38.BackgroundColor3 = Color3.new(1, 1, 1)
4050o38.BorderColor3 = Color3.new(0, 0, 0)
4051o38.BorderSizePixel = 0
4052o38.ZIndex = 10
4053o39.Name = "07"
4054o39.Parent = o31
4055o39.Position = UDim2.new(0.33333334326744,0,0,-2)
4056o39.Size = UDim2.new(0.047619048506021,0,0,4)
4057o39.Position = UDim2.new(0.33333334326744,0,0,-2)
4058o39.BackgroundColor3 = Color3.new(1, 1, 1)
4059o39.BorderColor3 = Color3.new(0, 0, 0)
4060o39.BorderSizePixel = 0
4061o39.ZIndex = 10
4062o40.Name = "08"
4063o40.Parent = o31
4064o40.Position = UDim2.new(0.38095238804817,0,0.14285714924335,-2)
4065o40.Size = UDim2.new(0.047619048506021,0,0,4)
4066o40.Position = UDim2.new(0.38095238804817,0,0.14285714924335,-2)
4067o40.BackgroundColor3 = Color3.new(1, 1, 1)
4068o40.BorderColor3 = Color3.new(0, 0, 0)
4069o40.BorderSizePixel = 0
4070o40.ZIndex = 10
4071o41.Name = "09"
4072o41.Parent = o31
4073o41.Position = UDim2.new(0.4285714328289,0,0.28571429848671,-2)
4074o41.Size = UDim2.new(0.047619048506021,0,0,4)
4075o41.Position = UDim2.new(0.4285714328289,0,0.28571429848671,-2)
4076o41.BackgroundColor3 = Color3.new(1, 1, 1)
4077o41.BorderColor3 = Color3.new(0, 0, 0)
4078o41.BorderSizePixel = 0
4079o41.ZIndex = 10
4080o42.Name = "10"
4081o42.Parent = o31
4082o42.Position = UDim2.new(0.47619047760963,0,0.4285714328289,-2)
4083o42.Size = UDim2.new(0.047619048506021,0,0,4)
4084o42.Position = UDim2.new(0.47619047760963,0,0.4285714328289,-2)
4085o42.BackgroundColor3 = Color3.new(1, 1, 1)
4086o42.BorderColor3 = Color3.new(0, 0, 0)
4087o42.BorderSizePixel = 0
4088o42.ZIndex = 10
4089o43.Name = "11"
4090o43.Parent = o31
4091o43.Position = UDim2.new(0.52380955219269,0,0.57142859697342,-2)
4092o43.Size = UDim2.new(0.047619048506021,0,0,4)
4093o43.Position = UDim2.new(0.52380955219269,0,0.57142859697342,-2)
4094o43.BackgroundColor3 = Color3.new(1, 1, 1)
4095o43.BorderColor3 = Color3.new(0, 0, 0)
4096o43.BorderSizePixel = 0
4097o43.ZIndex = 10
4098o44.Name = "12"
4099o44.Parent = o31
4100o44.Position = UDim2.new(0.57142859697342,0,0.71428573131561,-2)
4101o44.Size = UDim2.new(0.047619048506021,0,0,4)
4102o44.Position = UDim2.new(0.57142859697342,0,0.71428573131561,-2)
4103o44.BackgroundColor3 = Color3.new(1, 1, 1)
4104o44.BorderColor3 = Color3.new(0, 0, 0)
4105o44.BorderSizePixel = 0
4106o44.ZIndex = 10
4107o45.Name = "13"
4108o45.Parent = o31
4109o45.Position = UDim2.new(0.61904764175415,0,0.85714286565781,-2)
4110o45.Size = UDim2.new(0.047619048506021,0,0,4)
4111o45.Position = UDim2.new(0.61904764175415,0,0.85714286565781,-2)
4112o45.BackgroundColor3 = Color3.new(1, 1, 1)
4113o45.BorderColor3 = Color3.new(0, 0, 0)
4114o45.BorderSizePixel = 0
4115o45.ZIndex = 10
4116o46.Name = "14"
4117o46.Parent = o31
4118o46.Position = UDim2.new(0.66666668653488,0,0.91666668653488,-2)
4119o46.Size = UDim2.new(0.047619048506021,0,0,4)
4120o46.Position = UDim2.new(0.66666668653488,0,0.91666668653488,-2)
4121o46.BackgroundColor3 = Color3.new(1, 1, 1)
4122o46.BorderColor3 = Color3.new(0, 0, 0)
4123o46.BorderSizePixel = 0
4124o46.ZIndex = 10
4125o47.Name = "15"
4126o47.Parent = o31
4127o47.Position = UDim2.new(0.71428573131561,0,0.83333331346512,-2)
4128o47.Size = UDim2.new(0.047619048506021,0,0,4)
4129o47.Position = UDim2.new(0.71428573131561,0,0.83333331346512,-2)
4130o47.BackgroundColor3 = Color3.new(1, 1, 1)
4131o47.BorderColor3 = Color3.new(0, 0, 0)
4132o47.BorderSizePixel = 0
4133o47.ZIndex = 10
4134o48.Name = "16"
4135o48.Parent = o31
4136o48.Position = UDim2.new(0.76190477609634,0,0.75,-2)
4137o48.Size = UDim2.new(0.047619048506021,0,0,4)
4138o48.Position = UDim2.new(0.76190477609634,0,0.75,-2)
4139o48.BackgroundColor3 = Color3.new(1, 1, 1)
4140o48.BorderColor3 = Color3.new(0, 0, 0)
4141o48.BorderSizePixel = 0
4142o48.ZIndex = 10
4143o49.Name = "17"
4144o49.Parent = o31
4145o49.Position = UDim2.new(0.80952382087708,0,0.66666668653488,-2)
4146o49.Size = UDim2.new(0.047619048506021,0,0,4)
4147o49.Position = UDim2.new(0.80952382087708,0,0.66666668653488,-2)
4148o49.BackgroundColor3 = Color3.new(1, 1, 1)
4149o49.BorderColor3 = Color3.new(0, 0, 0)
4150o49.BorderSizePixel = 0
4151o49.ZIndex = 10
4152o50.Name = "18"
4153o50.Parent = o31
4154o50.Position = UDim2.new(0.85714286565781,0,0.58333331346512,-2)
4155o50.Size = UDim2.new(0.047619048506021,0,0,4)
4156o50.Position = UDim2.new(0.85714286565781,0,0.58333331346512,-2)
4157o50.BackgroundColor3 = Color3.new(1, 1, 1)
4158o50.BorderColor3 = Color3.new(0, 0, 0)
4159o50.BorderSizePixel = 0
4160o50.ZIndex = 10
4161o51.Name = "19"
4162o51.Parent = o31
4163o51.Position = UDim2.new(0.90476191043854,0,0.5,-2)
4164o51.Size = UDim2.new(0.047619048506021,0,0,4)
4165o51.Position = UDim2.new(0.90476191043854,0,0.5,-2)
4166o51.BackgroundColor3 = Color3.new(1, 1, 1)
4167o51.BorderColor3 = Color3.new(0, 0, 0)
4168o51.BorderSizePixel = 0
4169o51.ZIndex = 10
4170o52.Name = "20"
4171o52.Parent = o31
4172o52.Position = UDim2.new(0.95200002193451,0,0.49000000953674,-2)
4173o52.Size = UDim2.new(0.047619048506021,0,0,4)
4174o52.Position = UDim2.new(0.95200002193451,0,0.49000000953674,-2)
4175o52.BackgroundColor3 = Color3.new(1, 1, 1)
4176o52.BorderColor3 = Color3.new(0, 0, 0)
4177o52.BorderSizePixel = 0
4178o52.ZIndex = 10
4179o53.Name = "Line"
4180o53.Parent = o31
4181o53.Position = UDim2.new(1,0,0.5,-2)
4182o53.Size = UDim2.new(0,200,0,3)
4183o53.Position = UDim2.new(1,0,0.5,-2)
4184o53.BackgroundColor3 = Color3.new(1, 1, 1)
4185o53.BorderColor3 = Color3.new(0, 0, 0)
4186o53.BorderSizePixel = 0
4187o53.ZIndex = 10
4188o54.Name = "Line"
4189o54.Parent = o31
4190o54.Position = UDim2.new(0,-200,0.5,-2)
4191o54.Size = UDim2.new(0,200,0,3)
4192o54.Position = UDim2.new(0,-200,0.5,-2)
4193o54.BackgroundColor3 = Color3.new(1, 1, 1)
4194o54.BorderColor3 = Color3.new(0, 0, 0)
4195o54.BorderSizePixel = 0
4196o54.ZIndex = 10
4197o55.Name = "Mode"
4198o55.Parent = o11
4199o55.Position = UDim2.new(0,37,1,-70)
4200o55.Size = UDim2.new(0,85,0,20)
4201o55.Position = UDim2.new(0,37,1,-70)
4202o55.BackgroundColor3 = Color3.new(1, 1, 1)
4203o55.BackgroundTransparency = 1
4204o55.ZIndex = 10
4205o56.Name = "Bracket"
4206o56.Parent = o55
4207o56.Size = UDim2.new(0,5,0,20)
4208o56.Text = "["
4209o56.BackgroundTransparency = 1
4210o56.ZIndex = 10
4211o56.Font = Enum.Font.ArialBold
4212o56.FontSize = Enum.FontSize.Size18
4213o56.TextColor3 = Color3.new(1, 1, 1)
4214o56.TextXAlignment = Enum.TextXAlignment.Left
4215o57.Name = "Bracket"
4216o57.Parent = o55
4217o57.Position = UDim2.new(1,-5,0,0)
4218o57.Size = UDim2.new(0,5,0,20)
4219o57.Text = "]"
4220o57.Position = UDim2.new(1,-5,0,0)
4221o57.BackgroundTransparency = 1
4222o57.ZIndex = 10
4223o57.Font = Enum.Font.ArialBold
4224o57.FontSize = Enum.FontSize.Size18
4225o57.TextColor3 = Color3.new(1, 1, 1)
4226o57.TextXAlignment = Enum.TextXAlignment.Left
4227o58.Name = "Main"
4228o58.Parent = o55
4229o58.Size = UDim2.new(1,0,0,20)
4230o58.Text = "Auto"
4231o58.BackgroundTransparency = 1
4232o58.ZIndex = 10
4233o58.Font = Enum.Font.Code
4234o58.FontSize = Enum.FontSize.Size18
4235o58.TextColor3 = Color3.new(1, 1, 1)
4236o58.TextWrapped = true
4237o59.Name = "gunName"
4238o59.Parent = o11
4239o59.Size = UDim2.new(1,0,0,36)
4240o59.BackgroundColor3 = Color3.new(0.352941, 0.352941, 0.352941)
4241o59.BackgroundTransparency = 1
4242o59.ZIndex = 10
4243o60.Name = "Title"
4244o60.Parent = o59
4245o60.Position = UDim2.new(0,0,0,23)
4246o60.Size = UDim2.new(1,0,1,0)
4247o60.Text = "GUN NAME"
4248o60.Position = UDim2.new(0,0,0,23)
4249o60.BackgroundColor3 = Color3.new(1, 1, 1)
4250o60.BackgroundTransparency = 1
4251o60.ZIndex = 10
4252o60.Font = Enum.Font.Code
4253o60.FontSize = Enum.FontSize.Size36
4254o60.TextColor3 = Color3.new(1, 1, 1)
4255o60.TextScaled = true
4256o60.TextStrokeColor3 = Color3.new(0.745098, 0.745098, 0.745098)
4257o60.TextWrapped = true
4258o61.Name = "Version"
4259o61.Parent = o11
4260o61.Position = UDim2.new(1,10,1,0)
4261o61.Size = UDim2.new(1,0,0,15)
4262o61.Text = "V0.4 - REMAKE"
4263o61.Position = UDim2.new(1,10,1,0)
4264o61.BackgroundColor3 = Color3.new(1, 1, 1)
4265o61.BackgroundTransparency = 1
4266o61.ZIndex = 10
4267o61.Font = Enum.Font.ArialBold
4268o61.FontSize = Enum.FontSize.Size14
4269o61.TextColor3 = Color3.new(1, 1, 1)
4270o61.TextStrokeColor3 = Color3.new(0.745098, 0.745098, 0.745098)
4271o61.TextStrokeTransparency = 0.60000002384186
4272o61.TextTransparency = 0.60000002384186
4273o61.TextWrapped = true
4274o61.TextXAlignment = Enum.TextXAlignment.Right
4275o62.Name = "hitMarker"
4276o62.Parent = o10
4277o62.Position = UDim2.new(0.5,-13,0.5,-31)
4278o62.Size = UDim2.new(0,26,0,26)
4279o62.Position = UDim2.new(0.5,-13,0.5,-31)
4280o62.Visible = false
4281o62.BackgroundTransparency = 1
4282o62.ZIndex = 10
4283o62.Image = "http://www.roblox.com/asset/?id=121173757"
4284o63.Name = "lastMark"
4285o63.Parent = o62
4286o64.Name = "Sens"
4287o64.Parent = o10
4288o64.Position = UDim2.new(1,-131,1,-25)
4289o64.Size = UDim2.new(0,100,0,20)
4290o64.Text = "S: 0.3"
4291o64.Position = UDim2.new(1,-131,1,-25)
4292o64.BackgroundColor3 = Color3.new(1, 1, 1)
4293o64.BackgroundTransparency = 1
4294o64.ZIndex = 10
4295o64.Font = Enum.Font.Code
4296o64.FontSize = Enum.FontSize.Size28
4297o64.TextColor3 = Color3.new(1, 1, 1)
4298o65.Name = "fireSelect"
4299o65.Parent = o10
4300o65.Position = UDim2.new(0.5,0,0.5,-18)
4301o65.Position = UDim2.new(0.5,0,0.5,-18)
4302o65.Visible = false
4303o65.BackgroundColor3 = Color3.new(1, 1, 1)
4304o65.BackgroundTransparency = 1
4305o66.Name = "Modes"
4306o66.Parent = o65
4307o66.BackgroundColor3 = Color3.new(1, 1, 1)
4308o66.BackgroundTransparency = 1
4309o67.Name = "Circle"
4310o67.Parent = o65
4311o67.Position = UDim2.new(0,-60,0,-60)
4312o67.Size = UDim2.new(0,120,0,120)
4313o67.Position = UDim2.new(0,-60,0,-60)
4314o67.BackgroundColor3 = Color3.new(1, 1, 1)
4315o67.BackgroundTransparency = 1
4316o67.Image = "http://www.roblox.com/asset/?id=55754953"
4317o67.ImageTransparency = 0.5
4318o68.Name = "Arrow"
4319o68.Parent = o65
4320o68.Position = UDim2.new(0,-20,0,-140)
4321o68.Size = UDim2.new(0,40,0,20)
4322o68.Position = UDim2.new(0,-20,0,-140)
4323o68.BackgroundColor3 = Color3.new(1, 1, 1)
4324o68.BackgroundTransparency = 1
4325o68.Image = "http://www.roblox.com/asset/?id=126877530"
4326o69.Name = "Co"
4327o69.Parent = o10
4328o69.Size = UDim2.new(1,0,0,20)
4329o69.Text = "tEhYuM yB ekameR & noisuFobruT yB tiK"
4330o69.BackgroundColor3 = Color3.new(1, 1, 1)
4331o69.BackgroundTransparency = 1
4332o69.ZIndex = 10
4333o69.Font = Enum.Font.SourceSansItalic
4334o69.FontSize = Enum.FontSize.Size18
4335o69.TextColor3 = Color3.new(1, 1, 1)
4336o69.TextStrokeColor3 = Color3.new(1, 1, 1)
4337o69.TextStrokeTransparency = 0.89999997615814
4338o69.TextTransparency = 0.89999997615814
4339o70.Name = "crossHair"
4340o70.Parent = o10
4341o70.Position = UDim2.new(0.5,0,0.5,-18)
4342o70.Position = UDim2.new(0.5,0,0.5,-18)
4343o70.BackgroundColor3 = Color3.new(1, 1, 1)
4344o70.BorderColor3 = Color3.new(0, 0, 0)
4345o70.BorderSizePixel = 0
4346o71.Parent = o70
4347o71.Position = UDim2.new(0,-150,0,-150)
4348o71.Size = UDim2.new(0,300,0,300)
4349o71.Position = UDim2.new(0,-150,0,-150)
4350o71.Visible = false
4351o71.BackgroundColor3 = Color3.new(1, 1, 1)
4352o71.BackgroundTransparency = 1
4353o71.ZIndex = 2
4354o71.Image = "http://www.roblox.com/asset/?id=68308747"
4355o72.Name = "Reload"
4356o72.Parent = o70
4357o72.Position = UDim2.new(0,-50,0,70)
4358o72.Size = UDim2.new(0,100,0,20)
4359o72.Text = "RELOADING..."
4360o72.Position = UDim2.new(0,-50,0,70)
4361o72.Visible = false
4362o72.BackgroundColor3 = Color3.new(1, 1, 1)
4363o72.BackgroundTransparency = 1
4364o72.ZIndex = 2
4365o72.Font = Enum.Font.SourceSansBold
4366o72.FontSize = Enum.FontSize.Size18
4367o72.TextColor3 = Color3.new(1, 1, 1)
4368o72.TextStrokeTransparency = 0.5
4369o73.Name = "C"
4370o73.Parent = o70
4371o73.Position = UDim2.new(0,-2,0,0)
4372o73.Size = UDim2.new(0,4,0,500)
4373o73.Position = UDim2.new(0,-2,0,0)
4374o73.BackgroundColor3 = Color3.new(1, 1, 1)
4375o73.BackgroundTransparency = 1
4376o73.ClipsDescendants = true
4377o74.Name = "Line"
4378o74.Parent = o73
4379o74.Position = UDim2.new(0.5,-1,0,10)
4380o74.Size = UDim2.new(0,2,0,15)
4381o74.Text = ""
4382o74.Position = UDim2.new(0.5,-1,0,10)
4383o74.BackgroundColor3 = Color3.new(1, 1, 1)
4384o74.BorderColor3 = Color3.new(0.392157, 0.392157, 0.392157)
4385o74.Font = Enum.Font.SourceSans
4386o74.FontSize = Enum.FontSize.Size14
4387o75.Name = "A"
4388o75.Parent = o70
4389o75.Position = UDim2.new(0,-2,0,-500)
4390o75.Size = UDim2.new(0,4,0,500)
4391o75.Position = UDim2.new(0,-2,0,-500)
4392o75.BackgroundColor3 = Color3.new(1, 1, 1)
4393o75.BackgroundTransparency = 1
4394o75.ClipsDescendants = true
4395o76.Name = "Line"
4396o76.Parent = o75
4397o76.Position = UDim2.new(0.5,-1,1,-25)
4398o76.Size = UDim2.new(0,2,0,15)
4399o76.Text = ""
4400o76.Position = UDim2.new(0.5,-1,1,-25)
4401o76.BackgroundColor3 = Color3.new(1, 1, 1)
4402o76.BorderColor3 = Color3.new(0.392157, 0.392157, 0.392157)
4403o76.Font = Enum.Font.SourceSans
4404o76.FontSize = Enum.FontSize.Size14
4405o77.Name = "B"
4406o77.Parent = o70
4407o77.Position = UDim2.new(0,0,0,-2)
4408o77.Size = UDim2.new(0,500,0,4)
4409o77.Position = UDim2.new(0,0,0,-2)
4410o77.BackgroundColor3 = Color3.new(1, 1, 1)
4411o77.BackgroundTransparency = 1
4412o77.ClipsDescendants = true
4413o78.Name = "Line"
4414o78.Parent = o77
4415o78.Position = UDim2.new(0,10,0.5,-1)
4416o78.Size = UDim2.new(0,15,0,2)
4417o78.Text = ""
4418o78.Position = UDim2.new(0,10,0.5,-1)
4419o78.BackgroundColor3 = Color3.new(1, 1, 1)
4420o78.BorderColor3 = Color3.new(0.392157, 0.392157, 0.392157)
4421o78.Font = Enum.Font.SourceSans
4422o78.FontSize = Enum.FontSize.Size14
4423o79.Name = "D"
4424o79.Parent = o70
4425o79.Position = UDim2.new(0,-500,0,-2)
4426o79.Size = UDim2.new(0,500,0,4)
4427o79.Position = UDim2.new(0,-500,0,-2)
4428o79.BackgroundColor3 = Color3.new(1, 1, 1)
4429o79.BackgroundTransparency = 1
4430o79.ClipsDescendants = true
4431o80.Name = "Line"
4432o80.Parent = o79
4433o80.Position = UDim2.new(1,-25,0.5,-1)
4434o80.Size = UDim2.new(0,15,0,2)
4435o80.Text = ""
4436o80.Position = UDim2.new(1,-25,0.5,-1)
4437o80.BackgroundColor3 = Color3.new(1, 1, 1)
4438o80.BorderColor3 = Color3.new(0.392157, 0.392157, 0.392157)
4439o80.Font = Enum.Font.SourceSans
4440o80.FontSize = Enum.FontSize.Size14
4441o81.Name = "Scope"
4442o81.Parent = o10
4443o81.Position = UDim2.new(0,0,0,-36)
4444o81.Size = UDim2.new(1,0,1,36)
4445o81.Position = UDim2.new(0,0,0,-36)
4446o81.BackgroundColor3 = Color3.new(0, 0, 0)
4447o81.BackgroundTransparency = 1
4448o82.Name = "Steady"
4449o82.Parent = o81
4450o82.Position = UDim2.new(0.5,-60,0.5,50)
4451o82.Size = UDim2.new(0,120,0,20)
4452o82.Text = " "
4453o82.Position = UDim2.new(0.5,-60,0.5,50)
4454o82.Visible = false
4455o82.BackgroundColor3 = Color3.new(1, 1, 1)
4456o82.BackgroundTransparency = 1
4457o82.ZIndex = 9
4458o82.Font = Enum.Font.SciFi
4459o82.FontSize = Enum.FontSize.Size14
4460o82.TextColor3 = Color3.new(1, 1, 0)
4461o82.TextStrokeTransparency = 0
4462o83.Name = "Main"
4463o83.Parent = o81
4464o83.Size = UDim2.new(1,0,1,0)
4465o83.Visible = false
4466o83.BackgroundColor3 = Color3.new(1, 1, 1)
4467o83.BackgroundTransparency = 1
4468o84.Name = "ScopeImg2"
4469o84.Parent = o83
4470o84.Position = UDim2.new(0.5,-10,0,-10)
4471o84.Size = UDim2.new(0,20,0,20)
4472o84.Position = UDim2.new(0.5,-10,0,-10)
4473o84.BackgroundColor3 = Color3.new(0, 0, 0)
4474o84.BackgroundTransparency = 1
4475o84.Image = "http://www.roblox.com/asset/?id=184922644"
4476o85.Name = "ScopeImg1"
4477o85.Parent = o83
4478o85.Position = UDim2.new(0.5,-10,0,-10)
4479o85.Size = UDim2.new(0,20,0,20)
4480o85.Position = UDim2.new(0.5,-10,0,-10)
4481o85.BackgroundColor3 = Color3.new(0, 0, 0)
4482o85.BackgroundTransparency = 1
4483o85.Image = "http://www.roblox.com/asset/?id=72002022"
4484o86.Name = "F2"
4485o86.Parent = o83
4486o86.Position = UDim2.new(0,-10,0,-10)
4487o86.Size = UDim2.new(0,0,1,20)
4488o86.Position = UDim2.new(0,-10,0,-10)
4489o86.BackgroundColor3 = Color3.new(0, 0, 0)
4490o86.BorderColor3 = Color3.new(0, 0, 0)
4491o86.BorderSizePixel = 0
4492o87.Name = "F1"
4493o87.Parent = o83
4494o87.Position = UDim2.new(0,-10,0,-10)
4495o87.Size = UDim2.new(0,0,1,20)
4496o87.Position = UDim2.new(0,-10,0,-10)
4497o87.BackgroundColor3 = Color3.new(0, 0, 0)
4498o87.BorderColor3 = Color3.new(0, 0, 0)
4499o87.BorderSizePixel = 0
4500o88.Name = "Update"
4501o88.Parent = o83
4502table.insert(cors,coroutine.create(function()
4503wait()
4504runDummyScript(function()
4505local GUI = script.Parent
4506
4507function updateScopeDimension()
4508 GUI.ScopeImg1.Position = UDim2.new(0.5, -10 - (GUI.AbsoluteSize.y / 2), 0, -10)
4509 GUI.ScopeImg1.Size = UDim2.new(0, 20 + GUI.AbsoluteSize.y, 0, 20 + GUI.AbsoluteSize.y)
4510 GUI.ScopeImg2.Position = UDim2.new(0.5, -10 - (GUI.AbsoluteSize.y / 2), 0, -10)
4511 GUI.ScopeImg2.Size = UDim2.new(0, 20 + GUI.AbsoluteSize.y, 0, 20 + GUI.AbsoluteSize.y)
4512 GUI.F1.Size = UDim2.new(0, 20 + ((GUI.AbsoluteSize.x - GUI.AbsoluteSize.y) / 2), 1, 20)
4513 GUI.F2.Size = UDim2.new(0, 20 + ((GUI.AbsoluteSize.x - GUI.AbsoluteSize.y) / 2), 1, 20)
4514 GUI.F2.Position = UDim2.new(1, -10 - ((GUI.AbsoluteSize.x - GUI.AbsoluteSize.y) / 2), 0, -10)
4515end
4516
4517wait()
4518
4519GUI.Changed:connect(updateScopeDimension)
4520
4521updateScopeDimension()
4522end,o88)
4523end))
4524o89.Name = "TacticalGrenades"
4525o89.Parent = o1
4526o89.Value = 15
4527o90.Name = "[[README]]"
4528o90.Parent = o1
4529table.insert(cors,coroutine.create(function()
4530wait()
4531runDummyScript(function()
4532--[[
4533
4534 VERSION: v0.0.4
4535
4536 ----------[ UPDATES ]----------------------------------------------------
4537
4538 Pre-Release: -Added a copyright
4539 -fixed the issue where you couldn't run when you selected the tool
4540 -Added an ADS key and allowed ADS to either be toggle or hold
4541 -Made the Ammo values external so they can be changed by outside scripts
4542
4543 v0.0.2: -Created new arms for the gun
4544 -Fixed an issue where the arms would glitch if PlayerAnimations was set to false and the gun was fired
4545 -Updated credit security
4546 -Put the Arm cframes in the SETTINGS
4547 -Made the stance changing animations slightly smoother
4548 -Added bullet drop
4549 -Fixed some bullet hit handling code
4550 -Made the torso being able to rotate while sitting down a setting
4551 -Added bullet settings
4552 -Added shockwave settings
4553 -Added an Explosive guntype
4554 -Added a version label in the Gui
4555
4556 v0.0.3: -Added an option to have player arms
4557 -Added grenades / throwables
4558 -Fixed the issue where if a player left a server without deselecting the gun, the bullet trails still remained
4559 -Added Gui Scopes
4560 -Fixed the issue where the guns would glitch if you switched weapons too fast
4561
4562 v0.0.4: -Updated the Gui
4563 -Added a "Table Of Contents" in the clientMain
4564 -Added PLUGINS
4565 -Added the Arm CFrame when Running in the SETTINGS
4566 -Added Mouse Sensitivity settings
4567 -Fixed an issue where a humanoid wouldn't be damaged by bullets if there was no space between a wall and the humanoid
4568 -Fixed the issue where you couldn't steady the scope if the steady key was different from the run key
4569 -Added an example flashlight and laser (You can delete them and the gun will still work fine)
4570 -Moved the movement animations into a separate module script for easier editing
4571 -Added a single bullet mag option. It allows people to make guns where the mag is the bullet itself (i.e. arrows)
4572 -Moved grenades into a seperate folder and made them server-side so they don't get deleted when you die or switch guns
4573 -Added an option for a second knife animation
4574 -Added a setting to change the throwing speed of the grenades
4575 -Added an auto-knife feature
4576 -Added a setting for whether the gun can ADS or not
4577 -Added a flashbang and a molotov to the grenade list
4578 -Fixed an issue where bullets could only penetrate 1 wall
4579 -Added gun sway for when you move the gun around
4580 -Made the camera type scriptable when the gun is selected
4581 -Moved the ignore model creating code into a seperate server script so the ReadMe can be deleted
4582 -Redesigned the animations so the transitions between idling, walking, and running are smooth instead of choppy like previously
4583 -Added a fire select option
4584 -Added an equip animation option
4585 -Added a crawling animation option
4586 -Fixed the issue where you could dive and jump at the same time
4587 -Moved the reload animation into the ANIMATIONS modulescript for easier editing
4588 -Added an option to enable reloading while running
4589 -Added an option to enable firing while running
4590 -Redesigned the recoil animation and based it more on battlefield
4591 -Edited the reload so if a bullet is already chambered and you reload the ammo will be the ClipSize + 1
4592 -Fixed the issue where the ammo would go to 0 if you stopped the reload
4593 -Fixed the issue where if you stopped the reload before you put in a new mag the gun would take another full clipsize from the storedammo
4594 -Fixed an issue where if the gun was removed without being deselected, the camera would break
4595 -Got rid of the gunName and gunDescription settings because they're unnecessary and annoying to change
4596 -Moved bullet impact object creation to server side
4597 -Added a bullet smoke impact setting
4598 -Added a blood particle setting that appears on a player when they're shot
4599 -Updated the scope
4600 -Added CanCollide, transparency, and custom ignore settings to the penetration settings
4601 -Moved trail creation to server side to prevent client lag
4602 -Fixed an issue where shooting a player's hat would do damage
4603
4604 -------------------------------------------------------------------------
4605
4606 Hello there!
4607
4608 Glad to know you're using my one and only Gun Kit!
4609
4610 Even though this kit has many features and is rather advanced, it's pretty easy to use
4611
4612 There are 4 things that this gun needs in order to function:
4613 One brick called "AimPart"
4614 At least one brick where the first 3 letters are "Mag"
4615 One brick called "Handle"
4616 One brick called "Main"
4617
4618 The AimPart is what the gun will use to aim down the sights. When you aim down your sights, this brick will be in the center
4619 of the player's head. It basically allows the gun to have any type of sight, which can be placed anywhere on the gun. As long as
4620 the AimPart is aligned with the sight, the gun will aim down the sights properly.
4621 (NOTE: Make sure the AimPart is behind the Sight and the FRONT of the AimPart is facing the Sight)
4622
4623 The Mag is what the gun will move around when you reload the gun. If the mag is made up of more than one brick, make sure the first
4624 3 leters of the bricks are also "Mag" so that the gun will move them around. If you set ReloadAnimation to false in the SETTINGS, you don't
4625 need any bricks called "Mag". But if ReloadAnimation is set to true, the gun needs at least one brick called "Mag" or it will break. It doesn't
4626 matter what comes after the "Mag", you can have a Mag brick called "Mag1" and another Mag brick called "MagA". As long as the first three letters are
4627 "Mag", then the gun will recognize it as a Mag
4628
4629 The Handle is obviously the most important part of the Gun. Without it, the tool itself wouldn't work. It's that simple
4630 (NOTE: If you want a sound to play when you fire, name it "FireSound" and place it in the Handle. If you want a sound to play when
4631 you reload, name it "ReloadSound" and place it in the Handle)
4632
4633 The Main is the brick where the bullets will originate from. It's also the brick where the flash effects are kept.
4634 (NOTE: If you want a muzzle flash effects, put them in the Main and call them "FlashFX". Also make sure they have an "Enabled"
4635 property so that the script can enable and disable them)
4636
4637 ----------[ INSTRUCTIONS ]-----------------------------------------------
4638
4639 HOW TO USE THIS KIT:
4640 1) If the gun already has a Handle, make sure it is facing forward. If the gun doesn't have a Handle, create one and place
4641 it wherever you like, and make sure it is facing forward
4642
4643 2) If the gun already has a brick called "AimPart", move it to where you would like, and make sure it is facing the sight.
4644 If the gun doesn't have a brick called "AimPart", create one and move it where you would like it to be, and make sure
4645 it is facing the sight
4646
4647 3) If the gun already has a brick called "Main", move it to the very front of the gun. If the gun doesn't have a brick
4648 called "Main", create one and move it to the very front of the gun
4649
4650 4) If ReloadAnimation is set to true in the SETTINGS, make sure the gun has at least one brick called "Mag". If
4651 ReloadAnimation is set to false, the gun doesn't need any bricks called "Mag".
4652
4653 5) Open the SETTINGS and edit them however you like
4654
4655 That's it! Only 5 steps! It's not that complicated, just follow the Directions and it should work fine. If you have any questions /
4656 comments / concerns, message me.
4657
4658 ______ ______ __ ______ _ ______
4659 / _/ _/ /_ __/_ _______/ /_ ____ / ____/_ _______(_)___ ____ / / /
4660 / // / / / / / / / ___/ __ \/ __ \/ /_ / / / / ___/ / __ \/ __ \ / // /
4661 / // / / / / /_/ / / / /_/ / /_/ / __/ / /_/ (__ ) / /_/ / / / / / // /
4662 / // / /_/ \__,_/_/ /_.___/\____/_/ \__,_/____/_/\____/_/ /_/ _/ // /
4663 /__/__/ /__/__/
4664
4665--]]
4666end,o90)
4667end))
4668o91.Name = "serverMain"
4669o91.Parent = o1
4670table.insert(cors,coroutine.create(function()
4671wait()
4672runDummyScript(function()
4673local Plyr = script:WaitForChild("Plyr")
4674
4675local Gun = script.Parent
4676local Handle = Gun:WaitForChild("Handle")
4677
4678local V3 = Vector3.new
4679local CF, CFANG = CFrame.new, CFrame.Angles
4680
4681local RAD = math.rad
4682
4683local numLerp = function(A, B, Alpha)
4684 return A + (B - A) * Alpha
4685end
4686
4687local inList = function(Element, List)
4688 for _, v in pairs(List) do
4689 if v == Element then
4690 return true
4691 end
4692 end
4693 return false
4694end
4695
4696local getObject = function(Model, Class, Name)
4697 for _, v in pairs(Model:GetChildren()) do
4698 if v:IsA(Class) and v.Name == Name then
4699 return v
4700 end
4701 end
4702 return nil
4703end
4704
4705----------------------------------------------------------------------
4706--------------------[ IGNORE MODEL HANDLING ]-------------------------
4707----------------------------------------------------------------------
4708
4709wait(math.random(0, 20) / 40) --This is to prevent more than one ignoreModel from being created
4710
4711if _G.ignoreCode then --If the ignoreCode already exists, then the script creates the ignoreModel
4712 --[[
4713 The purpose of this is so that every gun in a game that uses this gun kit will share one ignoreModel. That way,
4714 bullet trails, bullet holes, and other fake arms will be ignored by the gun which makes the bullets more likely to
4715 hit a character part
4716 --]]
4717 if (not game.Workspace:FindFirstChild("ignoreModel_".._G.ignoreCode)) then
4718 local ignoreModel = Instance.new("Model")
4719 ignoreModel.Name = "ignoreModel_".._G.ignoreCode
4720 ignoreModel.Parent = game.Workspace
4721
4722 local grenadeFolder = Instance.new("Model")
4723 grenadeFolder.Name = "grenadeFolder"
4724 grenadeFolder.Parent = ignoreModel
4725
4726 spawn(function()
4727 while true do
4728 ignoreModel.Parent = game.Workspace
4729 grenadeFolder.Parent = ignoreModel
4730 wait(1 / 20)
4731 end
4732 end)
4733 end
4734
4735 script.Parent:WaitForChild("clientMain"):WaitForChild("ignoreCode").Value = _G.ignoreCode
4736else
4737 --[[
4738 If there isn't already an ignoreCode, then this creates one. The purpose of it being random is so that if there is
4739 an ignoreModel for something else in the game, the script won't end up placing the ignored objects in that ignoreModel
4740 --]]
4741 _G.ignoreCode = math.random(1, 1e4)
4742
4743 if (not game.Workspace:FindFirstChild("ignoreModel_".._G.ignoreCode)) then
4744 local ignoreModel = Instance.new("Model")
4745 ignoreModel.Name = "ignoreModel_".._G.ignoreCode
4746 ignoreModel.Parent = game.Workspace
4747
4748 local grenadeFolder = Instance.new("Model")
4749 grenadeFolder.Name = "grenadeFolder"
4750 grenadeFolder.Parent = ignoreModel
4751
4752 spawn(function()
4753 while true do
4754 ignoreModel.Parent = game.Workspace
4755 grenadeFolder.Parent = ignoreModel
4756 wait(1 / 20)
4757 end
4758 end)
4759 end
4760
4761 script.Parent:WaitForChild("clientMain"):WaitForChild("ignoreCode").Value = _G.ignoreCode
4762end
4763
4764spawn(function()
4765 --[[
4766 This function deletes any Player Folders that were left in the ignoreModel because the player left the game without
4767 deselecting the Gun first
4768 --]]
4769 repeat wait() until _G.ignoreCode
4770 local ignoreModel = game.Workspace:WaitForChild("ignoreModel_".._G.ignoreCode)
4771 while true do
4772 for _, gunIgnore in pairs(ignoreModel:GetChildren()) do
4773 if gunIgnore.Name ~= "grenadeFolder" then
4774 if (not game.Players:FindFirstChild(gunIgnore.Name:sub(11))) then
4775 gunIgnore:Destroy()
4776 end
4777 end
4778 end
4779 wait(1 / 20)
4780 end
4781end)
4782
4783----------------------------------------------------------------------
4784--------------------[ RESET CAMERA ]----------------------------------
4785----------------------------------------------------------------------
4786
4787Gun.ChildRemoved:connect(function(Child)
4788 if Child == Handle and Plyr.Value then
4789 local ignoreCode = Gun:WaitForChild("clientMain"):WaitForChild("ignoreCode").Value
4790 local resetCam = script:WaitForChild("resetCam")
4791 resetCam:WaitForChild("ignoreCode").Value = ignoreCode
4792 resetCam.Parent = Plyr.Value.PlayerGui
4793 end
4794end)
4795
4796----------------------------------------------------------------------
4797--------------------[ GET WELD CFRAMES ]------------------------------
4798----------------------------------------------------------------------
4799
4800for _, v in pairs(Gun:GetChildren()) do
4801 if v:IsA("BasePart") and v ~= Handle then
4802 if v:FindFirstChild("mainWeld") then v.mainWeld:Destroy() end
4803 if (not v:FindFirstChild("weldCF")) then
4804 local weldCF = Instance.new("CFrameValue")
4805 weldCF.Name = "weldCF"
4806 weldCF.Value = Handle.CFrame:toObjectSpace(v.CFrame)
4807 weldCF.Parent = v
4808 end
4809 if string.sub(v.Name, 1, 3) == "Mag" then
4810 if (not v:FindFirstChild("magTrans")) then
4811 local magTrans = Instance.new("NumberValue")
4812 magTrans.Name = "magTrans"
4813 magTrans.Value = v.Transparency
4814 magTrans.Parent = v
4815 end
4816 end
4817 v.Anchored = true
4818 v.CanCollide = false
4819 end
4820end
4821Handle.Anchored = false
4822Handle.CanCollide = true
4823
4824----------------------------------------------------------------------
4825--------------------[ GUNSETUP HANDLING ]-----------------------------
4826----------------------------------------------------------------------
4827
4828local gunSetup = script:WaitForChild("gunSetup")
4829function gunSetup.OnServerInvoke(Player, Vars)
4830
4831 --------------------[ CREATING IGNORE MODELS ]--------------------------------
4832
4833 local gunIgnore = Instance.new("Model")
4834 gunIgnore.Name = "gunIgnore_"..Player.Name
4835 gunIgnore.Parent = Vars.ignoreModel
4836
4837 --------------------[ MODIFYING THE PLAYER ]----------------------------------
4838
4839 Vars.Humanoid.AutoRotate = false
4840
4841 Vars.Shoulders.Right.Part1 = nil
4842 Vars.Shoulders.Left.Part1 = nil
4843
4844 local playerFolder = Instance.new("Model")
4845 playerFolder.Name = "playerFolder"
4846 playerFolder.Parent = gunIgnore
4847
4848 local headBase = Instance.new("Part")
4849 headBase.Transparency = 1
4850 headBase.Name = "headBase"
4851 headBase.CanCollide = false
4852 headBase.FormFactor = Enum.FormFactor.Custom
4853 headBase.Size = V3(0.2, 0.2, 0.2)
4854 headBase.BottomSurface = Enum.SurfaceType.Smooth
4855 headBase.TopSurface = Enum.SurfaceType.Smooth
4856 headBase.Parent = playerFolder
4857
4858 local headWeld = Instance.new("Weld")
4859 headWeld.Part0 = Vars.Torso
4860 headWeld.Part1 = headBase
4861 headWeld.C0 = CF(0, 1.5, 0)
4862 headWeld.Parent = Vars.Torso
4863
4864 local headWeld2 = Instance.new("Weld")
4865 headWeld2.Part0 = headBase
4866 headWeld2.Part1 = Vars.Head
4867 headWeld2.Parent = headBase
4868
4869 local animBase = Instance.new("Part")
4870 animBase.Transparency = 1
4871 animBase.Name = "animBase"
4872 animBase.CanCollide = false
4873 animBase.FormFactor = Enum.FormFactor.Custom
4874 animBase.Size = V3(0.2, 0.2, 0.2)
4875 animBase.BottomSurface = Enum.SurfaceType.Smooth
4876 animBase.TopSurface = Enum.SurfaceType.Smooth
4877 animBase.Parent = playerFolder
4878
4879 local animWeld = Instance.new("Weld")
4880 animWeld.Part0 = animBase
4881 animWeld.Part1 = headBase
4882 animWeld.Parent = animBase
4883
4884 local armBase = Instance.new("Part")
4885 armBase.Transparency = 1
4886 armBase.Name = "ArmBase"
4887 armBase.CanCollide = false
4888 armBase.FormFactor = Enum.FormFactor.Custom
4889 armBase.Size = V3(0.2, 0.2, 0.2)
4890 armBase.BottomSurface = Enum.SurfaceType.Smooth
4891 armBase.TopSurface = Enum.SurfaceType.Smooth
4892 armBase.Parent = playerFolder
4893
4894 local ABWeld = Instance.new("Weld")
4895 ABWeld.Part0 = armBase
4896 ABWeld.Part1 = animBase
4897 ABWeld.Parent = armBase
4898
4899 local LArmBase = Instance.new("Part")
4900 LArmBase.Transparency = 1
4901 LArmBase.Name = "LArmBase"
4902 LArmBase.CanCollide = false
4903 LArmBase.FormFactor = Enum.FormFactor.Custom
4904 LArmBase.Size = V3(0.2, 0.2, 0.2)
4905 LArmBase.BottomSurface = Enum.SurfaceType.Smooth
4906 LArmBase.TopSurface = Enum.SurfaceType.Smooth
4907 LArmBase.Parent = playerFolder
4908
4909 local RArmBase = Instance.new("Part")
4910 RArmBase.Transparency = 1
4911 RArmBase.Name = "RArmBase"
4912 RArmBase.CanCollide = false
4913 RArmBase.FormFactor = Enum.FormFactor.Custom
4914 RArmBase.Size = V3(0.2, 0.2, 0.2)
4915 RArmBase.BottomSurface = Enum.SurfaceType.Smooth
4916 RArmBase.TopSurface = Enum.SurfaceType.Smooth
4917 RArmBase.Parent = playerFolder
4918
4919 local LWeld = Instance.new("Weld")
4920 LWeld.Name = "LWeld"
4921 LWeld.Part0 = armBase
4922 LWeld.Part1 = LArmBase
4923 LWeld.C0 = Vars.armC0[1]
4924 LWeld.C1 = Vars.leftArmC1
4925 LWeld.Parent = armBase
4926
4927 local RWeld = Instance.new("Weld")
4928 RWeld.Name = "RWeld"
4929 RWeld.Part0 = armBase
4930 RWeld.Part1 = RArmBase
4931 RWeld.C0 = Vars.armC0[2]
4932 RWeld.C1 = Vars.rightArmC1
4933 RWeld.Parent = armBase
4934
4935 local LWeld2 = Instance.new("Weld")
4936 LWeld2.Name = "LWeld"
4937 LWeld2.Part0 = LArmBase
4938 LWeld2.Part1 = Vars.LArm
4939 LWeld2.Parent = LArmBase
4940
4941 local RWeld2 = Instance.new("Weld")
4942 RWeld2.Name = "RWeld"
4943 RWeld2.Part0 = RArmBase
4944 RWeld2.Part1 = Vars.RArm
4945 RWeld2.Parent = RArmBase
4946
4947 local LLegWeld = Instance.new("Weld")
4948 LLegWeld.Name = "LLegWeld"
4949 LLegWeld.Part0 = Vars.Torso
4950 LLegWeld.Part1 = nil
4951 LLegWeld.C0 = CF(-0.5, -2, 0)
4952 LLegWeld.Parent = Vars.Torso
4953
4954 local RLegWeld = Instance.new("Weld")
4955 RLegWeld.Name = "RLegWeld"
4956 RLegWeld.Part0 = Vars.Torso
4957 RLegWeld.Part1 = nil
4958 RLegWeld.C0 = CF(0.5, -2, 0)
4959 RLegWeld.Parent = Vars.Torso
4960
4961 for _, Tab in pairs(Vars.gunParts) do
4962 Tab.Obj.Anchored = false
4963 local Weld = Instance.new("Weld")
4964 Weld.Name = "mainWeld"
4965 Weld.Part0 = Vars.Handle
4966 Weld.Part1 = Tab.Obj
4967 Weld.C0 = Tab.Obj.weldCF.Value
4968 Weld.Parent = Vars.Handle
4969 Tab.Weld = Weld
4970 end
4971
4972 return gunIgnore, playerFolder, headWeld, headWeld2, animWeld, ABWeld, LWeld, RWeld, LWeld2, RWeld2, LLegWeld, RLegWeld, Vars.gunParts
4973end
4974
4975----------------------------------------------------------------------
4976--------------------[ TWEENJOINT HANDLING ]---------------------------
4977----------------------------------------------------------------------
4978
4979local createTweenIndicator = script:WaitForChild("createTweenIndicator")
4980function createTweenIndicator.OnServerInvoke(_, Joint, newCode)
4981 local tweenIndicator = nil
4982 if (not Joint:findFirstChild("tweenCode")) then --If the joint isn't being tweened, then
4983 tweenIndicator = Instance.new("IntValue")
4984 tweenIndicator.Name = "tweenCode"
4985 tweenIndicator.Value = newCode
4986 tweenIndicator.Parent = Joint
4987 else
4988 tweenIndicator = Joint.tweenCode
4989 tweenIndicator.Value = newCode --If the joint is already being tweened, this will change the code, and the tween loop will stop
4990 end
4991 return tweenIndicator
4992end
4993
4994local lerpCF = script:WaitForChild("lerpCF")
4995function lerpCF.OnServerInvoke(_, Joint, Prop, startCF, endCF, Alpha)
4996 spawn(function()
4997 Joint[Prop] = startCF:lerp(endCF, Alpha)
4998 end)
4999end
5000
5001local deleteTweenIndicator = script:WaitForChild("deleteTweenIndicator")
5002function deleteTweenIndicator.OnServerInvoke(_, tweenIndicator, newCode)
5003 if tweenIndicator.Value == newCode then --If this tween functions was the last one called on a joint then it will remove the code
5004 tweenIndicator:Destroy()
5005 end
5006end
5007
5008----------------------------------------------------------------------
5009--------------------[ BULLET IMPACT HANDLING ]------------------------
5010----------------------------------------------------------------------
5011
5012local createBulletImpact = script:WaitForChild("createBulletImpact")
5013createBulletImpact.OnServerEvent:connect(function(_, H, P, N, D, humanoidFound, gunIgnore, S)
5014 local surfaceCF = CF(P, P + N)
5015 ----------------------------------------------------------------------------------
5016 --Creating the bullet hole--------------------------------------------------------
5017 ----------------------------------------------------------------------------------
5018 if S.bulletHoles and (not humanoidFound) then
5019 local Hole = Instance.new("Part")
5020 Hole.Transparency = 1
5021 Hole.Anchored = true
5022 Hole.CanCollide = false
5023 Hole.FormFactor = "Custom"
5024 Hole.Size = V3(1, 1, 0.2)
5025 Hole.TopSurface = 0
5026 Hole.BottomSurface = 0
5027 local Mesh = Instance.new("BlockMesh")
5028 Mesh.Offset = V3(0, 0, -0.05)
5029 Mesh.Scale = V3(S.holeSettings.Size, S.holeSettings.Size, 0)
5030 Mesh.Parent = Hole
5031 local Decal = Instance.new("Decal")
5032 Decal.Face = Enum.NormalId.Front
5033 Decal.Texture = S.holeSettings.Texture
5034 Decal.Parent = Hole
5035 Hole.Parent = gunIgnore
5036 Hole.CFrame = surfaceCF
5037 if (not H.Anchored) then
5038 local Weld = Instance.new("Weld", Hole)
5039 Weld.Part0 = H
5040 Weld.Part1 = Hole
5041 Weld.C0 = H.CFrame:toObjectSpace(surfaceCF)
5042 Hole.Anchored = false
5043 end
5044 delay(S.holeSettings.visibleTime, function()
5045 if S.holeSettings.disappearTime > 0 then
5046 local t0 = tick()
5047 while true do
5048 local Alpha = math.min((tick() - t0) / S.holeSettings.disappearTime, 1)
5049 Decal.Transparency = numLerp(0, 1, Alpha)
5050 if Alpha == 1 then break end
5051 wait()
5052 end
5053 Hole:Destroy()
5054 else
5055 Hole:Destroy()
5056 end
5057 end)
5058 end
5059 ----------------------------------------------------------------------------------
5060 --Creating the spark effect-------------------------------------------------------
5061 ----------------------------------------------------------------------------------
5062 if S.bulletSparks and (not humanoidFound) and inList(H.Material, S.sparkSettings.Materials) then
5063 local Sparks = Instance.new("Part")
5064 Sparks.Transparency = 1
5065 Sparks.Anchored = true
5066 Sparks.CanCollide = false
5067 Sparks.FormFactor = "Custom"
5068 Sparks.Size = V3(1, 1, 1)
5069 Sparks.TopSurface = 0
5070 Sparks.BottomSurface = 0
5071
5072 local Particles = nil
5073 if S.customSparks then
5074 Particles = getObject(game.ServerStorage, "ParticleEmitter", "bulletSpark"):Clone()
5075 else
5076 Particles = Instance.new("ParticleEmitter")
5077 Particles.Color = ColorSequence.new(S.sparkSettings.Color.Start, S.sparkSettings.Color.End)
5078 Particles.LightEmission = 1
5079 Particles.Size = NumberSequence.new(
5080 {
5081 NumberSequenceKeypoint.new(0, S.sparkSettings.Size, 0.25);
5082 NumberSequenceKeypoint.new(1, 0);
5083 }
5084 )
5085 Particles.Texture = S.sparkSettings.Texture
5086 Particles.Transparency = NumberSequence.new(0)
5087 Particles.Acceleration = V3(0, -196.2, 0)
5088 Particles.EmissionDirection = Enum.NormalId.Front
5089 Particles.Lifetime = NumberRange.new(S.sparkSettings.Lifetime - 0.05, S.sparkSettings.Lifetime + 0.05)
5090 Particles.Rate = S.sparkSettings.Rate
5091 Particles.Rotation = NumberRange.new(0, 360)
5092 Particles.Speed = NumberRange.new(S.sparkSettings.Speed - 5, S.sparkSettings.Speed + 5)
5093 Particles.VelocitySpread = S.sparkSettings.Spread
5094 end
5095 Particles.Parent = Sparks
5096
5097 Sparks.Parent = gunIgnore
5098 Sparks.CFrame = surfaceCF
5099 if (not H.Anchored) then
5100 local Weld = Instance.new("Weld", Sparks)
5101 Weld.Part0 = H
5102 Weld.Part1 = Sparks
5103 Weld.C0 = H.CFrame:toObjectSpace(surfaceCF)
5104 Sparks.Anchored = false
5105 end
5106 delay(0.1, function()
5107 Particles.Enabled = false
5108 wait(Particles.Lifetime.Max)
5109 Sparks:Destroy()
5110 end)
5111 end
5112 ----------------------------------------------------------------------------------
5113 --Creating the smoke effect-------------------------------------------------------
5114 ----------------------------------------------------------------------------------
5115 if S.bulletSmoke and (not humanoidFound) then
5116 local Smoke = Instance.new("Part")
5117 Smoke.Transparency = 1
5118 Smoke.Anchored = true
5119 Smoke.CanCollide = false
5120 Smoke.FormFactor = "Custom"
5121 Smoke.Size = V3(1, 1, 1)
5122 Smoke.TopSurface = 0
5123 Smoke.BottomSurface = 0
5124
5125 local Particles = Instance.new("ParticleEmitter")
5126 Particles.Color = ColorSequence.new(S.smokeSettings.objColor and H.Color or S.smokeSettings.Color)
5127 Particles.LightEmission = 0
5128 Particles.Size = NumberSequence.new(
5129 {
5130 NumberSequenceKeypoint.new(0, S.smokeSettings.Size.Start);
5131 NumberSequenceKeypoint.new(1, S.smokeSettings.Size.End);
5132 }
5133 )
5134 Particles.Texture = S.smokeSettings.Texture
5135 Particles.Transparency = NumberSequence.new(
5136 {
5137 NumberSequenceKeypoint.new(0, S.smokeSettings.startTransparency);
5138 NumberSequenceKeypoint.new(0.5, 0.75 * S.smokeSettings.startTransparency + 0.25);
5139 NumberSequenceKeypoint.new(1, 1);
5140 }
5141 )
5142 Particles.Acceleration = V3(0, -196.2, 0)
5143 Particles.EmissionDirection = Enum.NormalId.Front
5144 Particles.Lifetime = NumberRange.new(S.smokeSettings.Lifetime - 0.05, S.smokeSettings.Lifetime + 0.05)
5145 Particles.Rate = S.smokeSettings.Rate
5146 Particles.Rotation = NumberRange.new(0, 360)
5147 Particles.RotSpeed = NumberRange.new(10)
5148 Particles.Speed = NumberRange.new(S.smokeSettings.Speed - 5, S.smokeSettings.Speed + 5)
5149 Particles.VelocitySpread = S.smokeSettings.Spread
5150 Particles.Parent = Smoke
5151
5152 Smoke.Parent = gunIgnore
5153 Smoke.CFrame = surfaceCF
5154 if (not H.Anchored) then
5155 local Weld = Instance.new("Weld", Smoke)
5156 Weld.Part0 = H
5157 Weld.Part1 = Smoke
5158 Weld.C0 = H.CFrame:toObjectSpace(surfaceCF)
5159 Smoke.Anchored = false
5160 end
5161 delay(0.1, function()
5162 Particles.Enabled = false
5163 wait(S.smokeSettings.Lifetime + 0.05)
5164 Smoke:Destroy()
5165 end)
5166 end
5167end)
5168
5169----------------------------------------------------------------------
5170--------------------[ SHOCKWAVE HANDLING ]----------------------------
5171----------------------------------------------------------------------
5172
5173local createShockwave = script:WaitForChild("createShockwave")
5174createShockwave.OnServerEvent:connect(function(_, Center, Radius, gunIgnore, S)
5175 local Shockwave = Instance.new("Part")
5176 Shockwave.BrickColor = S.shockwaveSettings.Color
5177 Shockwave.Material = Enum.Material.SmoothPlastic
5178 Shockwave.Name = "Shockwave"
5179 Shockwave.Anchored = true
5180 Shockwave.CanCollide = false
5181 Shockwave.FormFactor = Enum.FormFactor.Symmetric
5182 Shockwave.Size = V3(1, 1, 1)
5183 Shockwave.BottomSurface = Enum.SurfaceType.Smooth
5184 Shockwave.TopSurface = Enum.SurfaceType.Smooth
5185 local Mesh = Instance.new("SpecialMesh")
5186 Mesh.MeshType = Enum.MeshType.Sphere
5187 Mesh.Scale = V3()
5188 Mesh.Parent = Shockwave
5189 Shockwave.Parent = gunIgnore
5190 Shockwave.CFrame = CF(Center)
5191 spawn(function()
5192 local t0 = tick()
5193 while true do
5194 local Alpha = math.min((tick() - t0) / S.shockwaveSettings.Duration, 1)
5195 local Scale = 2 * Radius * Alpha
5196 Mesh.Scale = V3(Scale, Scale, Scale)
5197 Shockwave.Transparency = Alpha
5198 if Alpha == 1 then break end
5199 wait()
5200 end
5201 Shockwave:Destroy()
5202 end)
5203end)
5204
5205----------------------------------------------------------------------
5206--------------------[ BLOOD HANDLING ]--------------------------------
5207----------------------------------------------------------------------
5208
5209local createBlood = script:WaitForChild("createBlood")
5210createBlood.OnServerEvent:connect(function(_, H, P, D, gunIgnore, S)
5211 local bloodCF = CF(P, P + D) * CFANG(RAD(-90), 0, 0)
5212 local Blood = Instance.new("Part")
5213 Blood.Transparency = 1
5214 Blood.Anchored = true
5215 Blood.CanCollide = false
5216 Blood.FormFactor = "Custom"
5217 Blood.Size = V3(0.2, 1, 0.2)
5218 Blood.TopSurface = 0
5219 Blood.BottomSurface = 0
5220
5221 local Particles = Instance.new("ParticleEmitter")
5222 Particles.Color = ColorSequence.new(S.bloodSettings.Color)
5223 Particles.LightEmission = 0
5224 Particles.Size = NumberSequence.new(S.bloodSettings.Size)
5225 Particles.Texture = S.bloodSettings.Texture
5226 Particles.Transparency = NumberSequence.new(
5227 {
5228 NumberSequenceKeypoint.new(0, S.bloodSettings.startTransparency);
5229 NumberSequenceKeypoint.new(1, 1);
5230 }
5231 )
5232 Particles.EmissionDirection = Enum.NormalId.Top
5233 Particles.Lifetime = NumberRange.new(S.bloodSettings.Lifetime - 0.05, S.bloodSettings.Lifetime + 0.05)
5234 Particles.Rate = S.bloodSettings.Rate
5235 Particles.Rotation = NumberRange.new(0, 90)
5236 Particles.Speed = NumberRange.new(S.bloodSettings.Speed)
5237 Particles.VelocitySpread = S.bloodSettings.Spread
5238 Particles.Parent = Blood
5239
5240 Blood.Parent = gunIgnore
5241 Blood.CFrame = bloodCF
5242 if (not H.Anchored) then
5243 local Weld = Instance.new("Weld", Blood)
5244 Weld.Part0 = H
5245 Weld.Part1 = Blood
5246 Weld.C0 = H.CFrame:toObjectSpace(bloodCF)
5247 Blood.Anchored = false
5248 end
5249 delay(0.15, function()
5250 Particles.Enabled = false
5251 wait(S.bloodSettings.Lifetime + 0.05)
5252 Blood:Destroy()
5253 end)
5254end)
5255
5256----------------------------------------------------------------------
5257--------------------[ TRAIL HANDLING ]--------------------------------
5258----------------------------------------------------------------------
5259
5260local createTrail = script:WaitForChild("createTrail")
5261createTrail.OnServerEvent:connect(function(_, Origin, P, gunIgnore, S)
5262 local Trail = Instance.new("Part")
5263 Trail.BrickColor = S.trailSettings.Color
5264 Trail.Transparency = S.trailSettings.Transparency
5265 Trail.Anchored = true
5266 Trail.CanCollide = false
5267 Trail.Size = V3(1, 1, 1)
5268 local Mesh = Instance.new("CylinderMesh")
5269 Mesh.Offset = V3(0, -(P - Origin).magnitude / 2, 0)
5270 Mesh.Scale = V3(S.trailSettings.Thickness, (P - Origin).magnitude, S.trailSettings.Thickness)
5271 Mesh.Parent = Trail
5272 Trail.Parent = gunIgnore
5273 Trail.CFrame = CF(Origin, P) * CFANG(RAD(90), 0, 0)
5274 delay(S.trailSettings.visibleTime, function()
5275 if S.trailSettings.disappearTime > 0 then
5276 local t0 = tick()
5277 while true do
5278 local Alpha = math.min((tick() - t0) / S.trailSettings.disappearTime, 1)
5279 Trail.Transparency = numLerp(S.trailSettings.Transparency, 1, Alpha)
5280 if Alpha == 1 then break end
5281 wait()
5282 end
5283 Trail:Destroy()
5284 else
5285 Trail:Destroy()
5286 end
5287 end)
5288end)
5289end,o91)
5290end))
5291o92.Name = "Plyr"
5292o92.Parent = o91
5293o93.Name = "getWeldCF"
5294o93.Parent = o91
5295o94.Name = "gunSetup"
5296o94.Parent = o91
5297o95.Name = "tweenJoint"
5298o95.Parent = o91
5299o96.Name = "onRenderStep"
5300o96.Parent = o91
5301o97.Name = "createTweenIndicator"
5302o97.Parent = o91
5303o98.Name = "deleteTweenIndicator"
5304o98.Parent = o91
5305o99.Name = "lerpCF"
5306o99.Parent = o91
5307o100.Name = "resetCam"
5308o100.Parent = o91
5309table.insert(cors,coroutine.create(function()
5310wait()
5311runDummyScript(function()
5312repeat wait() until game.Players.LocalPlayer.Character
5313
5314local Player = game.Players.LocalPlayer
5315local Char = Player.Character
5316local Humanoid = Char:WaitForChild("Humanoid")
5317
5318local Cam = game.Workspace.CurrentCamera
5319local UIS = game:GetService("UserInputService")
5320
5321local ignoreCode = script:WaitForChild("ignoreCode")
5322repeat wait() until ignoreCode.Value ~= 0
5323local ignoreModel = game.Workspace:WaitForChild("ignoreModel_"..ignoreCode.Value)
5324local gunIgnore = ignoreModel:FindFirstChild("gunIgnore_"..Player.Name)
5325
5326Cam.FieldOfView = 70
5327Cam.CameraType = Enum.CameraType.Custom
5328Cam:ClearAllChildren()
5329
5330UIS.MouseBehavior = Enum.MouseBehavior.Default
5331UIS.MouseIconEnabled = true
5332
5333Player.CameraMode = Enum.CameraMode.Classic
5334
5335Humanoid.WalkSpeed = 16
5336Humanoid.AutoRotate = true
5337
5338if gunIgnore then gunIgnore:Destroy() end
5339end,o100)
5340end))
5341o101.Name = "ignoreCode"
5342o101.Parent = o100
5343o102.Name = "createBulletImpact"
5344o102.Parent = o91
5345o103.Name = "createShockwave"
5346o103.Parent = o91
5347o104.Name = "createBlood"
5348o104.Parent = o91
5349o105.Name = "createTrail"
5350o105.Parent = o91
5351o106.Name = "AimPart"
5352o106.Parent = o1
5353o106.Material = Enum.Material.SmoothPlastic
5354o106.BrickColor = BrickColor.new("Really black")
5355o106.Reflectance = 0.10000000149012
5356o106.Transparency = 1
5357o106.Position = Vector3.new(32.6535568, 2.23069406, 4.69876814)
5358o106.Rotation = Vector3.new(105.360001, 89.9799957, -103.439995)
5359o106.Anchored = true
5360o106.CanCollide = false
5361o106.FormFactor = Enum.FormFactor.Custom
5362o106.Size = Vector3.new(0.286285669, 0.286286235, 0.286285937)
5363o106.CFrame = CFrame.new(32.6535568, 2.23069406, 4.69876814, -9.75430112e-07, 4.08291817e-06, 0.99999994, -0.000276552892, 0.999999285, -3.54647636e-06, -1.00000155, -0.000276552135, -9.74301656e-07)
5364o106.BackSurface = Enum.SurfaceType.SmoothNoOutlines
5365o106.BottomSurface = Enum.SurfaceType.SmoothNoOutlines
5366o106.FrontSurface = Enum.SurfaceType.SmoothNoOutlines
5367o106.LeftSurface = Enum.SurfaceType.SmoothNoOutlines
5368o106.RightSurface = Enum.SurfaceType.SmoothNoOutlines
5369o106.TopSurface = Enum.SurfaceType.SmoothNoOutlines
5370o106.Color = Color3.new(0.0666667, 0.0666667, 0.0666667)
5371o106.Position = Vector3.new(32.6535568, 2.23069406, 4.69876814)
5372o106.Orientation = Vector3.new(0, 90, -0.0199999996)
5373o106.Color = Color3.new(0.0666667, 0.0666667, 0.0666667)
5374o109.Name = "StoredAmmo"
5375o109.Parent = o1
5376o109.Value = inf
5377o119.Name = "Chamber"
5378o119.Parent = o1
5379o119.Material = Enum.Material.Slate
5380o119.BrickColor = BrickColor.new("Dark stone grey")
5381o119.Transparency = 1
5382o119.Position = Vector3.new(30.7283897, 1.89785695, 4.38217306)
5383o119.Rotation = Vector3.new(31.1599998, -0.550000012, -91)
5384o119.Anchored = true
5385o119.CanCollide = false
5386o119.FormFactor = Enum.FormFactor.Custom
5387o119.Size = Vector3.new(0.224013954, 0.224013954, 0.224013954)
5388o119.CFrame = CFrame.new(30.7283897, 1.89785695, 4.38217306, -0.0174467694, 0.99980247, -0.00956690311, -0.855523646, -0.0198798478, -0.517381966, -0.517469466, -0.00084194541, 0.855701447)
5389o119.Color = Color3.new(0.388235, 0.372549, 0.384314)
5390o119.Position = Vector3.new(30.7283897, 1.89785695, 4.38217306)
5391o119.Orientation = Vector3.new(31.1599998, -0.639999986, -91.3299942)
5392o119.Color = Color3.new(0.388235, 0.372549, 0.384314)
5393o120.Parent = o119
5394o120.Scale = Vector3.new(0.622927666, 1, 0.622927248)
5395o120.Scale = Vector3.new(0.622927666, 1, 0.622927248)
5396o121.Name = "Handle"
5397o121.Parent = o1
5398o121.Material = Enum.Material.SmoothPlastic
5399o121.BrickColor = BrickColor.new("Bright green")
5400o121.Transparency = 1
5401o121.Position = Vector3.new(31.5911217, 1.02762198, 4.71090317)
5402o121.Rotation = Vector3.new(105.360001, 89.9799957, -103.439995)
5403o121.Anchored = true
5404o121.CanCollide = false
5405o121.FormFactor = Enum.FormFactor.Custom
5406o121.Size = Vector3.new(0.286285669, 0.286286235, 0.286285937)
5407o121.CFrame = CFrame.new(31.5911217, 1.02762198, 4.71090317, -9.75430112e-07, 4.08291817e-06, 0.99999994, -0.000276552892, 0.999999285, -3.54647636e-06, -1.00000155, -0.000276552135, -9.74301656e-07)
5408o121.BackSurface = Enum.SurfaceType.SmoothNoOutlines
5409o121.BottomSurface = Enum.SurfaceType.SmoothNoOutlines
5410o121.FrontSurface = Enum.SurfaceType.SmoothNoOutlines
5411o121.LeftSurface = Enum.SurfaceType.SmoothNoOutlines
5412o121.RightSurface = Enum.SurfaceType.SmoothNoOutlines
5413o121.TopSurface = Enum.SurfaceType.SmoothNoOutlines
5414o121.Color = Color3.new(0.294118, 0.592157, 0.294118)
5415o121.Position = Vector3.new(31.5911217, 1.02762198, 4.71090317)
5416o121.Orientation = Vector3.new(0, 90, -0.0199999996)
5417o121.Color = Color3.new(0.294118, 0.592157, 0.294118)
5418o122.Parent = o121
5419o122.Scale = Vector3.new(0.239999995, 0.120000005, 0.119999997)
5420o122.Scale = Vector3.new(0.239999995, 0.120000005, 0.119999997)
5421o123.Name = "Prime"
5422o123.Parent = o121
5423o123.Pitch = 0.69999998807907
5424o123.SoundId = "rbxassetid://307871546"
5425o123.Volume = 1
5426o124.Name = "FireSound"
5427o124.Parent = o121
5428o124.SoundId = "rbxassetid://638813038"
5429o124.Volume = 3
5430o125.Name = "MagIn"
5431o125.Parent = o121
5432o125.SoundId = "rbxassetid://457043231"
5433o125.Volume = 1
5434o126.Name = "MagOut"
5435o126.Parent = o121
5436o126.SoundId = "rbxassetid://457042936"
5437o126.Volume = 1
5438o128.Name = "Main"
5439o128.Parent = o1
5440o128.Material = Enum.Material.SmoothPlastic
5441o128.BrickColor = BrickColor.new("Bright orange")
5442o128.Transparency = 1
5443o128.Position = Vector3.new(24.8728714, 1.86926901, 4.68642998)
5444o128.Rotation = Vector3.new(90, 0, 90)
5445o128.Anchored = true
5446o128.CanCollide = false
5447o128.FormFactor = Enum.FormFactor.Custom
5448o128.Size = Vector3.new(0.224013954, 0.224013954, 0.224013954)
5449o128.CFrame = CFrame.new(24.8728714, 1.86926901, 4.68642998, 0, -1, 0, 0, 0, -1, 1, 0, 0)
5450o128.BottomSurface = Enum.SurfaceType.Smooth
5451o128.TopSurface = Enum.SurfaceType.Smooth
5452o128.Color = Color3.new(0.854902, 0.521569, 0.254902)
5453o128.Position = Vector3.new(24.8728714, 1.86926901, 4.68642998)
5454o128.Orientation = Vector3.new(90, -90, 0)
5455o128.Color = Color3.new(0.854902, 0.521569, 0.254902)
5456o129.Name = "1FlashFX[Smoke]"
5457o129.Parent = o128
5458o129.Transparency = NumberSequence.new(0.60000002384186,1)
5459o129.Rotation = NumberRange.new(0,360)
5460o129.Size = NumberSequence.new(0,0)
5461o129.Color = ColorSequence.new(Color3.new(0.27451, 0.27451, 0.27451),Color3.new(0.27451, 0.27451, 0.27451))
5462o129.Enabled = false
5463o129.LightEmission = 0.10000000149012
5464o129.Texture = "http://www.roblox.com/asset/?id=244514423"
5465o129.Lifetime = NumberRange.new(1.25,1.5)
5466o129.Rate = 100
5467o129.RotSpeed = NumberRange.new(10,10)
5468o129.Speed = NumberRange.new(5,7)
5469o129.VelocitySpread = 15
5470o129.Color = ColorSequence.new(Color3.new(0.27451, 0.27451, 0.27451),Color3.new(0.27451, 0.27451, 0.27451))
5471o130.Name = "FlashFX[Flash]"
5472o130.Parent = o128
5473o130.Transparency = NumberSequence.new(1,0.89999997615814,0.88749998807907,1)
5474o130.Color = ColorSequence.new(Color3.new(1, 1, 0.498039),Color3.new(1, 1, 0.498039))
5475o130.Enabled = false
5476o130.LightEmission = 1
5477o130.Texture = "http://www.roblox.com/asset/?id=242102147"
5478o130.Lifetime = NumberRange.new(0.050000000745058,0.075000002980232)
5479o130.Rate = 1000
5480o130.RotSpeed = NumberRange.new(22,22)
5481o130.Color = ColorSequence.new(Color3.new(1, 1, 0.498039),Color3.new(1, 1, 0.498039))
5482o131.Name = "FlashFX[Light]"
5483o131.Parent = o128
5484o131.Color = Color3.new(1, 1, 0.498039)
5485o131.Enabled = false
5486o131.Brightness = 10
5487o131.Range = 0
5488o131.Color = Color3.new(1, 1, 0.498039)
5489mas.Parent = workspace
5490mas:MakeJoints()
5491local mas1 = mas:GetChildren()
5492for i=1,#mas1 do
5493 mas1[i].Parent = game:GetService("Players").LocalPlayer.Backpack
5494 ypcall(function() mas1[i]:MakeJoints() end)
5495end
5496mas:Destroy()
5497for i=1,#cors do
5498coroutine.resume(cors[i])
5499end