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