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