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