Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Converted with ttyyuu12345's model to script plugin v4
- function sandbox(var,func)
- local env = getfenv(func)
- local newenv = setmetatable({},{
- __index = function(self,k)
- if k=="script" then
- return var
- else
- return env[k]
- end
- end,
- })
- setfenv(func,newenv)
- return func
- end
- cors = {}
- mas = Instance.new("Model",game:GetService("Lighting"))
- Tool0 = Instance.new("Tool")
- LocalScript1 = Instance.new("LocalScript")
- IntValue2 = Instance.new("IntValue")
- Folder3 = Instance.new("Folder")
- ScreenGui4 = Instance.new("ScreenGui")
- ImageLabel5 = Instance.new("ImageLabel")
- NumberValue6 = Instance.new("NumberValue")
- Frame7 = Instance.new("Frame")
- ImageLabel8 = Instance.new("ImageLabel")
- TextLabel9 = Instance.new("TextLabel")
- Frame10 = Instance.new("Frame")
- TextLabel11 = Instance.new("TextLabel")
- Frame12 = Instance.new("Frame")
- TextLabel13 = Instance.new("TextLabel")
- Frame14 = Instance.new("Frame")
- TextLabel15 = Instance.new("TextLabel")
- Frame16 = Instance.new("Frame")
- TextLabel17 = Instance.new("TextLabel")
- Frame18 = Instance.new("Frame")
- Frame19 = Instance.new("Frame")
- ImageLabel20 = Instance.new("ImageLabel")
- ImageLabel21 = Instance.new("ImageLabel")
- Frame22 = Instance.new("Frame")
- TextLabel23 = Instance.new("TextLabel")
- Frame24 = Instance.new("Frame")
- ImageLabel25 = Instance.new("ImageLabel")
- ImageLabel26 = Instance.new("ImageLabel")
- Frame27 = Instance.new("Frame")
- Frame28 = Instance.new("Frame")
- LocalScript29 = Instance.new("LocalScript")
- TextLabel30 = Instance.new("TextLabel")
- ImageLabel31 = Instance.new("ImageLabel")
- Frame32 = Instance.new("Frame")
- Frame33 = Instance.new("Frame")
- TextLabel34 = Instance.new("TextLabel")
- TextLabel35 = Instance.new("TextLabel")
- Frame36 = Instance.new("Frame")
- Frame37 = Instance.new("Frame")
- ImageLabel38 = Instance.new("ImageLabel")
- TextLabel39 = Instance.new("TextLabel")
- TextLabel40 = Instance.new("TextLabel")
- Frame41 = Instance.new("Frame")
- ImageLabel42 = Instance.new("ImageLabel")
- TextLabel43 = Instance.new("TextLabel")
- TextLabel44 = Instance.new("TextLabel")
- Frame45 = Instance.new("Frame")
- TextLabel46 = Instance.new("TextLabel")
- Frame47 = Instance.new("Frame")
- Frame48 = Instance.new("Frame")
- Frame49 = Instance.new("Frame")
- Frame50 = Instance.new("Frame")
- Frame51 = Instance.new("Frame")
- Frame52 = Instance.new("Frame")
- Frame53 = Instance.new("Frame")
- Frame54 = Instance.new("Frame")
- Frame55 = Instance.new("Frame")
- Frame56 = Instance.new("Frame")
- Frame57 = Instance.new("Frame")
- Frame58 = Instance.new("Frame")
- Frame59 = Instance.new("Frame")
- Frame60 = Instance.new("Frame")
- Frame61 = Instance.new("Frame")
- Frame62 = Instance.new("Frame")
- Frame63 = Instance.new("Frame")
- Frame64 = Instance.new("Frame")
- Frame65 = Instance.new("Frame")
- Frame66 = Instance.new("Frame")
- Frame67 = Instance.new("Frame")
- Frame68 = Instance.new("Frame")
- Frame69 = Instance.new("Frame")
- Frame70 = Instance.new("Frame")
- Frame71 = Instance.new("Frame")
- Frame72 = Instance.new("Frame")
- TextLabel73 = Instance.new("TextLabel")
- TextLabel74 = Instance.new("TextLabel")
- TextLabel75 = Instance.new("TextLabel")
- Frame76 = Instance.new("Frame")
- TextLabel77 = Instance.new("TextLabel")
- Frame78 = Instance.new("Frame")
- TextLabel79 = Instance.new("TextLabel")
- TextLabel80 = Instance.new("TextLabel")
- TextLabel81 = Instance.new("TextLabel")
- TextLabel82 = Instance.new("TextLabel")
- TextLabel83 = Instance.new("TextLabel")
- ImageLabel84 = Instance.new("ImageLabel")
- TextLabel85 = Instance.new("TextLabel")
- IntValue86 = Instance.new("IntValue")
- Part87 = Instance.new("Part")
- Part88 = Instance.new("Part")
- Script89 = Instance.new("Script")
- ObjectValue90 = Instance.new("ObjectValue")
- RemoteFunction91 = Instance.new("RemoteFunction")
- RemoteFunction92 = Instance.new("RemoteFunction")
- RemoteFunction93 = Instance.new("RemoteFunction")
- RemoteEvent94 = Instance.new("RemoteEvent")
- RemoteFunction95 = Instance.new("RemoteFunction")
- RemoteFunction96 = Instance.new("RemoteFunction")
- RemoteFunction97 = Instance.new("RemoteFunction")
- LocalScript98 = Instance.new("LocalScript")
- IntValue99 = Instance.new("IntValue")
- RemoteEvent100 = Instance.new("RemoteEvent")
- RemoteEvent101 = Instance.new("RemoteEvent")
- RemoteEvent102 = Instance.new("RemoteEvent")
- RemoteEvent103 = Instance.new("RemoteEvent")
- IntValue104 = Instance.new("IntValue")
- Part105 = Instance.new("Part")
- BlockMesh106 = Instance.new("BlockMesh")
- Part107 = Instance.new("Part")
- CylinderMesh108 = Instance.new("CylinderMesh")
- Part109 = Instance.new("Part")
- BlockMesh110 = Instance.new("BlockMesh")
- BillboardGui111 = Instance.new("BillboardGui")
- ImageLabel112 = Instance.new("ImageLabel")
- PointLight113 = Instance.new("PointLight")
- Part114 = Instance.new("Part")
- CylinderMesh115 = Instance.new("CylinderMesh")
- Part116 = Instance.new("Part")
- BlockMesh117 = Instance.new("BlockMesh")
- IntValue118 = Instance.new("IntValue")
- IntValue119 = Instance.new("IntValue")
- IntValue120 = Instance.new("IntValue")
- Part121 = Instance.new("Part")
- SpecialMesh122 = Instance.new("SpecialMesh")
- Part123 = Instance.new("Part")
- BlockMesh124 = Instance.new("BlockMesh")
- Sound125 = Instance.new("Sound")
- Sound126 = Instance.new("Sound")
- Model127 = Instance.new("Model")
- Part128 = Instance.new("Part")
- Part129 = Instance.new("Part")
- ManualWeld130 = Instance.new("ManualWeld")
- Model131 = Instance.new("Model")
- Part132 = Instance.new("Part")
- Part133 = Instance.new("Part")
- Part134 = Instance.new("Part")
- Part135 = Instance.new("Part")
- SpecialMesh136 = Instance.new("SpecialMesh")
- Model137 = Instance.new("Model")
- Part138 = Instance.new("Part")
- SpecialMesh139 = Instance.new("SpecialMesh")
- ManualWeld140 = Instance.new("ManualWeld")
- Part141 = Instance.new("Part")
- SpecialMesh142 = Instance.new("SpecialMesh")
- ManualWeld143 = Instance.new("ManualWeld")
- Part144 = Instance.new("Part")
- SpecialMesh145 = Instance.new("SpecialMesh")
- Part146 = Instance.new("Part")
- SpecialMesh147 = Instance.new("SpecialMesh")
- ManualWeld148 = Instance.new("ManualWeld")
- Part149 = Instance.new("Part")
- ManualWeld150 = Instance.new("ManualWeld")
- Part151 = Instance.new("Part")
- Part152 = Instance.new("Part")
- Part153 = Instance.new("Part")
- Part154 = Instance.new("Part")
- Part155 = Instance.new("Part")
- Part156 = Instance.new("Part")
- ManualWeld157 = Instance.new("ManualWeld")
- Part158 = Instance.new("Part")
- ManualWeld159 = Instance.new("ManualWeld")
- Part160 = Instance.new("Part")
- Part161 = Instance.new("Part")
- ManualWeld162 = Instance.new("ManualWeld")
- ManualWeld163 = Instance.new("ManualWeld")
- Part164 = Instance.new("Part")
- Part165 = Instance.new("Part")
- ManualWeld166 = Instance.new("ManualWeld")
- ManualWeld167 = Instance.new("ManualWeld")
- Script168 = Instance.new("Script")
- Tool0.Name = "Gun"
- Tool0.Parent = mas
- LocalScript1.Name = "clientMain"
- LocalScript1.Parent = Tool0
- table.insert(cors,sandbox(LocalScript1,function()
- --[[
- Kit By TurboFusion
- Remake By MuYhEt & Xander521
- --]]
- --------------------------------------------------------------------------------------
- --------------------[ CHARACTER LOADING ]---------------------------------------------
- --------------------------------------------------------------------------------------
- repeat wait() until game.Players.LocalPlayer.Character
- repeat wait() until game.Players.LocalPlayer.Character:IsDescendantOf(game.Workspace)
- wait(1 / 20)
- --------------------------------------------------------------------------------------
- --------------------[ IGNORE MODEL ]--------------------------------------------------
- --------------------------------------------------------------------------------------
- local ignoreCode = script:WaitForChild("ignoreCode")
- repeat wait() until ignoreCode.Value ~= 0
- local ignoreModel = game.Workspace:WaitForChild("ignoreModel_"..ignoreCode.Value)
- local grenadeFolder = ignoreModel:WaitForChild("grenadeFolder")
- --------------------------------------------------------------------------------------
- --------------------[ CONSTANTS ]-----------------------------------------------------
- --------------------------------------------------------------------------------------
- local Gun = script.Parent
- local serverMain = Gun:WaitForChild("serverMain")
- local Handle = Gun:WaitForChild("Handle")
- local AimPart = Gun:WaitForChild("AimPart")
- local Main = Gun:WaitForChild("Main")
- local Ammo = Gun:WaitForChild("Ammo")
- local ClipSize = Gun:WaitForChild("ClipSize")
- local StoredAmmo = Gun:WaitForChild("StoredAmmo")
- local createTweenIndicator = serverMain:WaitForChild("createTweenIndicator")
- local deleteTweenIndicator = serverMain:WaitForChild("deleteTweenIndicator")
- local getWeldCF = serverMain:WaitForChild("getWeldCF")
- local gunSetup = serverMain:WaitForChild("gunSetup")
- local lerpCF = serverMain:WaitForChild("lerpCF")
- local createBlood = serverMain:WaitForChild("createBlood")
- local createBulletImpact = serverMain:WaitForChild("createBulletImpact")
- local createShockwave = serverMain:WaitForChild("createShockwave")
- local createTrail = serverMain:WaitForChild("createTrail")
- local Particle = require(script:WaitForChild("Particle"))
- local Spring = require(script:WaitForChild("Spring"))
- local Anims = require(Gun:WaitForChild("ANIMATIONS"))
- local Plugins = require(Gun:WaitForChild("PLUGINS"))
- local S = require(Gun:WaitForChild("SETTINGS"))
- local Player = game.Players.LocalPlayer
- local Char = Player.Character
- local Humanoid = Char:WaitForChild("Humanoid")
- local Torso = Char:WaitForChild("Torso")
- local Head = Char:WaitForChild("Head")
- local HRP = Char:WaitForChild("HumanoidRootPart")
- local Root = HRP:WaitForChild("RootJoint")
- local Neck = Torso:WaitForChild("Neck")
- local LArm = Char:WaitForChild("Left Arm")
- local RArm = Char:WaitForChild("Right Arm")
- local LLeg = Char:WaitForChild("Left Leg")
- local RLeg = Char:WaitForChild("Right Leg")
- local M2 = Player:GetMouse()
- local mainGUI = script:WaitForChild("mainGUI")
- local crossHair = mainGUI:WaitForChild("crossHair")
- local HUD = mainGUI:WaitForChild("HUD")
- local Scope = mainGUI:WaitForChild("Scope")
- local fireSelect = mainGUI:WaitForChild("fireSelect")
- local hitMarker = mainGUI:WaitForChild("hitMarker")
- local Sens = mainGUI:WaitForChild("Sens")
- local crossA = crossHair:WaitForChild("A"):WaitForChild("Line")
- local crossB = crossHair:WaitForChild("B"):WaitForChild("Line")
- local crossC = crossHair:WaitForChild("C"):WaitForChild("Line")
- local crossD = crossHair:WaitForChild("D"):WaitForChild("Line")
- local Controls = HUD:WaitForChild("Controls")
- local gunNameTitle = HUD:WaitForChild("gunName"):WaitForChild("Title")
- local scopeMain = Scope:WaitForChild("Main")
- local scopeSteady = Scope:WaitForChild("Steady")
- local fireModes = fireSelect:WaitForChild("Modes")
- local modeGUI = HUD:WaitForChild("Mode"):WaitForChild("Main")
- local clipAmmoGUI = HUD:WaitForChild("Ammo"):WaitForChild("Clip")
- local storedAmmoGUI = HUD:WaitForChild("Ammo"):WaitForChild("Stored")
- local DS = game:GetService("Debris")
- local CP = game:GetService("ContentProvider")
- local RS = game:GetService("RunService")
- local UIS = game:GetService("UserInputService")
- local Cam = game.Workspace.CurrentCamera
- local ABS, HUGE, FLOOR, CEIL = math.abs, math.huge, math.floor, math.ceil
- local RAD, SIN, COS, TAN = math.rad, math.sin, math.cos, math.tan
- local VEC2, V3 = Vector2.new, Vector3.new
- local CF, CFANG = CFrame.new, CFrame.Angles
- local INSERT = table.insert
- local maxStamina = S.sprintTime * 60
- local maxSteadyTime = S.scopeSettings.steadyTime * 60
- local LethalIcons = {
- "http://www.roblox.com/asset/?id=194849880";
- "http://www.roblox.com/asset/?id=195727791";
- "http://www.roblox.com/asset/?id=195728137";
- "http://www.roblox.com/asset/?id=218151830";
- }
- local TacticalIcons = {
- "http://www.roblox.com/asset/?id=195728473";
- "http://www.roblox.com/asset/?id=195728693";
- }
- local ASCII = {
- 071; 117; 110; 032;
- 075; 105; 116; 032;
- 115; 099; 114; 105;
- 112; 116; 101; 100;
- 032; 098; 121; 032;
- 084; 117; 114; 098;
- 111; 070; 117; 115;
- 105; 111; 110; 000;
- }
- local Ignore = {
- Char;
- ignoreModel;
- }
- local Shoulders = {
- Right = Torso:WaitForChild("Right Shoulder");
- Left = Torso:WaitForChild("Left Shoulder")
- }
- local armC0 = {
- CF(-1.5, 0, 0) * CFANG(RAD(90), 0, 0);
- CF(1.5, 0, 0) * CFANG(RAD(90), 0, 0);
- }
- local legC0 = {
- Stand = {
- CF(-0.5, -2, 0);
- CF(0.5, -2, 0);
- };
- Crouch = {
- CF(-0.5, -1.5, 0.5) * CFANG(-RAD(90), 0, 0);
- CF(0.5, -1, -0.75);
- };
- Prone = {
- CF(-0.5, -2, 0);
- CF(0.5, -2, 0);
- };
- }
- local Sine = function(X)
- return SIN(RAD(X))
- end
- local Linear = function(X)
- return (X / 90)
- end
- --------------------------------------------------------------------------------------
- --------------------[ VARIABLES ]-----------------------------------------------------
- --------------------------------------------------------------------------------------
- local Selected = false
- local playerMass = 0
- local Forward = false
- local Backward = false
- local Idling = false
- local Walking = false
- local Running = false
- local crawlCamRot = 0
- local crawlAlpha = 0
- local idleAlpha = 1
- local walkAlpha = 0
- local isCrawling = false
- local isIdling = false
- local isWalking = false
- local isRunning = false
- local Aimed = false
- local Aiming = false
- local aimAlpha = 0
- local headOffset = VEC2(COS(RAD(90) - S.aimSettings.headTilt) * 0.5, 1 + SIN(RAD(90) - S.aimSettings.headTilt) * 0.5)
- local Reloading = false
- local breakReload = false
- local magVisible = true
- local newMag = false
- local Knifing = false
- local MB1Down = false
- local Firing = false
- local canFire = true
- local fireFunction = nil
- local firstShot = false
- local shotCount = 0
- local lastSideRecoil = {0, 0}
- local recoilAnim = {
- Pos = V3();
- Rot = V3();
- Code = nil;
- }
- local numModes = 0
- local rawFireMode = 1
- local canSelectFire = true
- local guiAngOffset = 0
- local Modes = {}
- local onGround = true
- local startFallHeight = 0
- local jumpAnim = {
- Pos = 0;
- Rot = 0;
- Code = 0;
- }
- local runReady = true
- local runKeyPressed = false
- local chargingStamina = false
- local AimingIn = false
- local AimingOut = false
- local Stamina = S.sprintTime * 60
- local currentSteadyTime = S.scopeSettings.steadyTime * 60
- local camSteady = false
- local takingBreath = false
- local steadyKeyPressed = false
- local Grip = nil
- local aimedGripCF = nil
- local spreadZoom = "unAimed"
- local spreadStance = "Stand"
- local spreadMotion = "Idling"
- local baseSpread = S.spreadSettings.unAimed.Stand.Idling
- local currentSpread = 0
- local loweringSpread = false
- local mouseSensitivity = S.sensitivitySettings.Default
- local aimSensitivity = S.sensitivitySettings.Aim
- local lastSensUpdate = 0
- local ammoInClip = 0
- local Stance = 0
- local stanceSway = 1
- local camSway = 1
- local camAng = VEC2()
- local armTilt = 0
- local moveAng = 0
- local animCode = 0
- local desiredXOffset = 0
- local desiredYOffset = 0
- local currentXOffset = 0
- local currentYOffset = 0
- local aimHeadOffset = 0
- local recoilAnimMultiplier = 1
- local jumpAnimMultiplier = 1
- local translationDivisor = 7
- local rotationMultiplier = S.momentumSettings.Amplitude.unAimed
- local armTiltMultiplier = 1
- local equipAnimPlaying = false
- local crossOffset = 0
- local camOffsets = {
- guiScope = {
- Rot = V3();
- };
- Reload = {
- Rot = V3();
- Code = nil;
- };
- Recoil = {
- Rot = V3();
- Code = nil;
- };
- }
- local Anim = {
- Pos = V3();
- Rot = V3();
- Ang = 0;
- Code = 0;
- }
- local lastBeat = 0
- local gunParts = {}
- local Connections = {}
- local Keys = {}
- --------------------------------------------------------------------------------------
- --------------------[ PRE-LOADING ]---------------------------------------------------
- --------------------------------------------------------------------------------------
- CP:Preload(S.explosionSettings.soundId)
- CP:Preload(S.holeSettings.Texture)
- CP:Preload(S.sparkSettings.Texture)
- CP:Preload(S.smokeSettings.Texture)
- CP:Preload(S.bloodSettings.Texture)
- CP:Preload("http://www.roblox.com/asset/?id=126877530") --The dark green arrow in the select fire gui
- CP:Preload("http://www.roblox.com/asset/?id=55754953") --The circle in the select fire gui
- --------------------------------------------------------------------------------------
- --------------------[ GUN SETUP ]-----------------------------------------------------
- --------------------------------------------------------------------------------------
- serverMain:WaitForChild("Plyr").Value = Player
- local gunMomentum = Spring.new(V3())
- gunMomentum.s = S.momentumSettings.Speed
- gunMomentum.d = S.momentumSettings.Damper
- local gunRecoilSpring = Spring.new(V3())
- gunRecoilSpring.s = S.recoilSettings.springSpeed
- gunRecoilSpring.d = S.recoilSettings.springDamper
- local camRecoilSpring = Spring.new(V3())
- camRecoilSpring.s = 35
- camRecoilSpring.d = 0.5
- local crossSpring = Spring.new(V3(crossOffset + (baseSpread + currentSpread) * 50, 0, 0))
- crossSpring.s = 20
- crossSpring.d = 0.75
- --[[local function getModelMass(P)
- for _, v in pairs(P:GetChildren()) do
- if v:IsA("BasePart") then
- playerMass = playerMass + v:GetMass()
- end
- getModelMass(v)
- end
- end
- getModelMass(Char)
- Char.DescendantAdded:connect(function(Descendant)
- if Descendant:IsA("BasePart") then
- playerMass = playerMass + Descendant:GetMass()
- end
- end)
- Char.DescendantRemoving:connect(function(Descendant)
- if Descendant:IsA("BasePart") then
- playerMass = playerMass - Descendant:GetMass()
- end
- end)]]
- --------------------------------------------------------------------------------------
- --------------------[ WELD CFRAMES ]--------------------------------------------------
- --------------------------------------------------------------------------------------
- spawn(function()
- --[[for _, v in pairs(Gun:GetChildren()) do
- if v:IsA("BasePart") and v ~= Handle then
- if v:FindFirstChild("mainWeld") then v.mainWeld:Destroy() end
- if (not v:FindFirstChild("weldCF")) then
- local weldCF = Instance.new("CFrameValue")
- weldCF.Name = "weldCF"
- weldCF.Value = Handle.CFrame:toObjectSpace(v.CFrame)
- weldCF.Parent = v
- INSERT(gunParts, {Obj = v, Weld = nil})
- end
- if string.sub(v.Name, 1, 3) == "Mag" then
- if (not v:FindFirstChild("magTrans")) then
- local magTrans = Instance.new("NumberValue")
- magTrans.Name = "magTrans"
- magTrans.Value = v.Transparency
- magTrans.Parent = v
- end
- end
- v.Anchored = false
- end
- end
- Handle.Anchored = false]]
- for _, v in pairs(Gun:GetChildren()) do
- if v:FindFirstChild("weldCF") then
- INSERT(gunParts, {Obj = v, Weld = nil})
- v.Anchored = false
- end
- end
- end)
- --------------------------------------------------------------------------------------
- --------------------[ MAIN PROGRAM ]--------------------------------------------------
- --------------------------------------------------------------------------------------
- --------------------[ ARM CREATION FUNCTION ]-----------------------------------------
- function createArms()
- local Arms = {}
- for i = 0, 1 do
- local armModel = Instance.new("Model")
- armModel.Name = "armModel"
- local Arm = Instance.new("Part")
- Arm.BrickColor = (S.fakeArmSettings.realBodyColor and (i == 0 and LArm.BrickColor or RArm.BrickColor) or S.fakeArmSettings.Color)
- Arm.Transparency = S.fakeArmSettings.Transparency
- Arm.Name = "Arm"
- Arm.CanCollide = false
- Arm.Size = V3(0.598, 2, 0.598)
- Arm.Parent = armModel
- local armMesh = Instance.new("SpecialMesh")
- armMesh.MeshId = "rbxasset://fonts//leftarm.mesh"
- armMesh.MeshType = Enum.MeshType.FileMesh
- armMesh.Scale = V3(0.598, 1, 0.598)
- armMesh.Parent = Arm
- local Glove1 = Instance.new("Part")
- Glove1.BrickColor = BrickColor.new("Black")
- Glove1.Name = "Glove1"
- Glove1.CanCollide = false
- Glove1.Size = V3(0.598, 2, 0.598)
- Glove1.Parent = armModel
- local glove1Mesh = Instance.new("SpecialMesh")
- glove1Mesh.MeshId = "rbxasset://fonts//leftarm.mesh"
- glove1Mesh.Offset = V3(0, -0.5, 0)
- glove1Mesh.Scale = V3(0.658, 0.205, 0.658)
- glove1Mesh.Parent = Glove1
- local glove1Weld = Instance.new("Weld")
- glove1Weld.Part0 = Arm
- glove1Weld.Part1 = Glove1
- glove1Weld.Parent = Arm
- local Glove2 = Instance.new("Part")
- Glove2.BrickColor = BrickColor.new("Black")
- Glove2.Name = "Glove2"
- Glove2.CanCollide = false
- Glove2.Size = V3(0.598, 2, 0.598)
- Glove2.Parent = armModel
- local glove2Mesh = Instance.new("SpecialMesh")
- glove2Mesh.MeshId = "rbxasset://fonts//leftarm.mesh"
- glove2Mesh.Offset = V3(0, -0.435, 0)
- glove2Mesh.Scale = V3(0.69, 0.105, 0.69)
- glove2Mesh.Parent = Glove2
- local glove2Weld = Instance.new("Weld")
- glove2Weld.Part0 = Arm
- glove2Weld.Part1 = Glove2
- glove2Weld.Parent = Arm
- local Glove3 = Instance.new("Part")
- Glove3.BrickColor = BrickColor.new("Black")
- Glove3.Name = "Glove3"
- Glove3.CanCollide = false
- Glove3.Size = V3(0.598, 2, 0.598)
- Glove3.Parent = armModel
- local glove3Mesh = Instance.new("SpecialMesh")
- glove3Mesh.MeshId = "rbxasset://fonts//leftarm.mesh"
- glove3Mesh.Offset = V3(0.18 * ((i * 2) - 1), -0.7, 0)
- glove3Mesh.Scale = V3(0.299, 0.305, 0.657)
- glove3Mesh.Parent = Glove3
- local glove3Weld = Instance.new("Weld")
- glove3Weld.Part0 = Arm
- glove3Weld.Part1 = Glove3
- glove3Weld.Parent = Arm
- local Sleeve1 = Instance.new("Part")
- Sleeve1.BrickColor = BrickColor.new("Sand green")
- Sleeve1.Name = "Sleeve1"
- Sleeve1.CanCollide = false
- Sleeve1.Size = V3(0.598, 2, 0.598)
- Sleeve1.Parent = armModel
- local sleeve1Mesh = Instance.new("SpecialMesh")
- sleeve1Mesh.MeshId = "rbxasset://fonts//leftarm.mesh"
- sleeve1Mesh.Offset = V3(0, 0.75, 0)
- sleeve1Mesh.Scale = V3(0.656, 0.3, 0.656)
- sleeve1Mesh.Parent = Sleeve1
- local sleeve1Weld = Instance.new("Weld")
- sleeve1Weld.Part0 = Arm
- sleeve1Weld.Part1 = Sleeve1
- sleeve1Weld.Parent = Arm
- local Sleeve2 = Instance.new("Part")
- Sleeve2.BrickColor = BrickColor.new("Sand green")
- Sleeve2.Name = "Sleeve2"
- Sleeve2.CanCollide = false
- Sleeve2.Size = V3(0.598, 2, 0.598)
- Sleeve2.Parent = armModel
- local sleeve2Mesh = Instance.new("SpecialMesh")
- sleeve2Mesh.MeshId = "rbxasset://fonts//leftarm.mesh"
- sleeve2Mesh.Offset = V3(0, 0.55, 0)
- sleeve2Mesh.Scale = V3(0.75, 0.1, 0.75)
- sleeve2Mesh.Parent = Sleeve2
- local sleeve2Weld = Instance.new("Weld")
- sleeve2Weld.Part0 = Arm
- sleeve2Weld.Part1 = Sleeve2
- sleeve2Weld.Parent = Arm
- table.insert(Arms, {Model = armModel, armPart = Arm})
- end
- return Arms
- end
- --------------------[ MATH FUNCTIONS ]------------------------------------------------
- function Map(Val, fromLow, fromHigh, toLow, toHigh)
- return (Val - fromLow) * (toHigh - toLow) / (fromHigh - fromLow) + toLow
- end
- function numLerp(A, B, Alpha)
- return A + (B - A) * Alpha
- end
- function RAND(Min, Max, Accuracy)
- return numLerp(Min, Max, math.random())
- --[[local Inverse = 1 / (Accuracy or 1)
- return (math.random(Min * Inverse, Max * Inverse) / Inverse)]]
- end
- function Round(Num, toNearest)
- return math.floor(Num / toNearest + 0.5) * toNearest
- end
- function getNearestPoint(A, B, Origin)
- local A2 = (A - Origin).magnitude
- local B2 = (B - Origin).magnitude
- return (math.min(A2, B2) == A2 and A or B)
- end
- --------------------[ TWEEN FUNCTIONS ]-----------------------------------------------
- function tweenJoint(Joint, newC0, newC1, Alpha, Duration)
- spawn(function()
- local newCode = math.random(-1e9, 1e9) --This creates a random code between -1000000000 and 1000000000
- local tweenIndicator = nil
- if (not Joint:findFirstChild("tweenCode")) then --If the joint isn't being tweened, then
- tweenIndicator = Instance.new("IntValue")
- tweenIndicator.Name = "tweenCode"
- tweenIndicator.Value = newCode
- tweenIndicator.Parent = Joint
- else
- tweenIndicator = Joint.tweenCode
- tweenIndicator.Value = newCode --If the joint is already being tweened, this will change the code, and the tween loop will stop
- end
- --local tweenIndicator = createTweenIndicator:InvokeServer(Joint, newCode)
- if Duration <= 0 then --If the duration is less than or equal to 0 then there's no need for a tweening loop
- if newC0 then Joint.C0 = newC0 end
- if newC1 then Joint.C1 = newC1 end
- else
- local startC0 = Joint.C0
- local startC1 = Joint.C1
- local t0 = tick()
- while true do
- RS.RenderStepped:wait() --This makes the for loop step every 1/60th of a second
- local X = math.min((tick() - t0) / Duration, 1) * 90
- if tweenIndicator.Value ~= newCode then break end --This makes sure that another tween wasn't called on the same joint
- if (not Selected) then break end --This stops the tween if the tool is deselected
- if newC0 then Joint.C0 = startC0:lerp(newC0, Alpha(X)) end
- if newC1 then Joint.C1 = startC1:lerp(newC1, Alpha(X)) end
- --if newC0 then lerpCF:InvokeServer(Joint, "C0", startC0, newC0, Alpha(X)) end
- --if newC1 then lerpCF:InvokeServer(Joint, "C1", startC1, newC1, Alpha(X)) end
- if X == 90 then break end
- end
- end
- if tweenIndicator.Value == newCode then --If this tween functions was the last one called on a joint then it will remove the code
- tweenIndicator:Destroy()
- end
- --deleteTweenIndicator:InvokeServer(tweenIndicator, newCode)
- end)
- end
- function tweenCam(Key, newRot, Alpha, Duration)
- spawn(function()
- local newCode = math.random(-1e9, 1e9)
- camOffsets[Key].Code = newCode
- local Increment = 1.5 / Duration
- local prevRot = camOffsets[Key].Rot
- local X = 0
- while true do
- RS.RenderStepped:wait()
- local newX = X + Increment
- X = (newX > 90 and 90 or newX)
- if camOffsets[Key].Code ~= newCode then break end
- if (not Selected) then break end
- camOffsets[Key].Rot = prevRot:lerp(newRot, Alpha(X))
- if X == 90 then break end
- end
- if camOffsets[Key].Code == newCode then
- camOffsets[Key].Code = nil
- end
- end)
- end
- function tweenRecoil(newPos, newRot, Alpha, Duration)
- spawn(function()
- local newCode = math.random(-1e9, 1e9)
- recoilAnim.Code = newCode
- local Increment = 1.5 / Duration
- local prevPos = recoilAnim.Pos
- local prevRot = recoilAnim.Rot
- local X = 0
- while true do
- RS.RenderStepped:wait()
- local newX = X + Increment
- X = (newX > 90 and 90 or newX)
- if recoilAnim.Code ~= newCode then break end
- if (not Selected) then break end
- recoilAnim.Pos = prevPos:lerp(newPos, Alpha(X))
- recoilAnim.Rot = prevRot:lerp(newRot, Alpha(X))
- if X == 90 then break end
- end
- if recoilAnim.Code == newCode then
- recoilAnim.Code = nil
- end
- end)
- end
- --------------------[ GUI UPDATE FUNCTIONS ]------------------------------------------
- local function updateClipAmmo()
- clipAmmoGUI.Text = Ammo.Value
- clipAmmoGUI.TextColor3 = (Ammo.Value <= (ClipSize.Value / 3) and Color3.new(1, 0, 0) or Color3.new(1, 1, 1))
- end
- local function updateStoredAmmo()
- storedAmmoGUI.Text = StoredAmmo.Value
- storedAmmoGUI.TextColor3 = (StoredAmmo.Value <= (ClipSize.Value * 2) and Color3.new(1, 0, 0) or Color3.new(1, 1, 1))
- end
- local function updateHealth()
- HUD.Health.Num.Text = CEIL(Humanoid.Health).."%"
- HUD.Health.Num.TextColor3 = (
- (Humanoid.Health > 200 / 3) and Color3.new(1, 1, 1) or
- (Humanoid.Health <= 200 / 3 and Humanoid.Health > 100 / 3) and Color3.new(1, 1, 0) or
- (Humanoid.Health <= 100 / 3) and Color3.new(1, 0, 0)
- )
- end
- local function updateModeLabels(prevState, newState, X)
- for Num, Mode in pairs(fireModes:GetChildren()) do
- local guiAngOffset2 = guiAngOffset + 90
- local Ang = numLerp(
- (guiAngOffset2 * prevState) - (guiAngOffset2 * Num) - guiAngOffset2,
- (guiAngOffset2 * newState) - (guiAngOffset2 * Num) - guiAngOffset2,
- Sine(X)
- ) + guiAngOffset
- local XPos = COS(RAD(Ang))
- local YPos = SIN(RAD(Ang))
- Mode.Position = UDim2.new(0.5, XPos * 100, 0.5, YPos * 100)
- local R = COS(math.atan2(Mode.Position.Y.Offset, Mode.Position.X.Offset) + RAD(90))
- Mode.Label.TextTransparency = 1 - ((R / 4) + 0.75)
- local Scale = (R * 10) + 50
- Mode.Label.Position = UDim2.new(0, -Scale / 2, 0, 0)
- Mode.Label.Size = UDim2.new(0, Scale, 0, Scale / 2)
- end
- end
- --------------------[ GUI SETUP FUNCTION ]--------------------------------------------
- function convertKey(Key)
- if Key == string.char(8) then
- return "BKSPCE"
- elseif Key == string.char(9) then
- return "TAB"
- elseif Key == string.char(13) then
- return "ENTER"
- elseif Key == string.char(17) then
- return "UP"
- elseif Key == string.char(18) then
- return "DOWN"
- elseif Key == string.char(19) then
- return "RIGHT"
- elseif Key == string.char(20) then
- return "LEFT"
- elseif Key == string.char(22) then
- return "HOME"
- elseif Key == string.char(23) then
- return "END"
- elseif Key == string.char(27) then
- return "F2"
- elseif Key == string.char(29) then
- return "F4"
- elseif Key == string.char(30) then
- return "F5"
- elseif Key == string.char(32) or Key == " " then
- return "F7"
- elseif Key == string.char(33) or Key == "!" then
- return "F8"
- elseif Key == string.char(34) or Key == '"' then
- return "F9"
- elseif Key == string.char(35) or Key == "#" then
- return "F10"
- elseif Key == string.char(37) or Key == "%" then
- return "F12"
- elseif Key == string.char(47) or Key == "/" then
- return "R-SHIFT"
- elseif Key == string.char(48) or Key == "0" then
- return "L-SHIFT"
- elseif Key == string.char(49) or Key == "1" then
- return "R-CTRL"
- elseif Key == string.char(50) or Key == "2" then
- return "L-CTRL"
- elseif Key == string.char(51) or Key == "3" then
- return "R-ALT"
- elseif Key == string.char(52) or Key == "4" then
- return "L-ALT"
- else
- return string.upper(Key)
- end
- end
- function createControlFrame(Key, Desc, Num)
- local C = Instance.new("Frame")
- C.BackgroundTransparency = ((Num % 2) == 1 and 0.7 or 1)
- C.BorderSizePixel = 0
- C.Name = "C"..Num
- C.Position = UDim2.new(0, 0, 0, Num * 20)
- C.Size = UDim2.new(1, 0, 0, 20)
- C.ZIndex = 10
- local K = Instance.new("TextLabel")
- K.BackgroundTransparency = 1
- K.Name = "Key"
- K.Size = UDim2.new(0, 45, 1, 0)
- K.ZIndex = 10
- K.Font = Enum.Font.ArialBold
- K.FontSize = Enum.FontSize.Size14
- K.Text = Key
- K.TextColor3 = Color3.new(1, 1, 1)
- K.TextScaled = (string.len(Key) > 5)
- K.TextWrapped = (string.len(Key) > 5)
- K.Parent = C
- local D = Instance.new("TextLabel")
- D.BackgroundTransparency = 1
- D.Name = "Desc"
- D.Position = UDim2.new(0, 50, 0, 0)
- D.Size = UDim2.new(1, -50, 1, 0)
- D.ZIndex = 10
- D.Font = Enum.Font.SourceSansBold
- D.FontSize = Enum.FontSize.Size14
- D.Text = "- "..Desc
- D.TextColor3 = Color3.new(1, 1, 1)
- D.TextXAlignment = Enum.TextXAlignment.Left
- D.Parent = C
- C.Parent = Controls
- end
- function createModes()
- numModes = 0
- for i, v in pairs(S.selectFireSettings.Modes) do
- if v then
- numModes = numModes + 1
- end
- end
- local currentMode = 0
- for i, v in pairs(S.selectFireSettings.Modes) do
- if v then
- local Frame = Instance.new("Frame")
- Frame.BackgroundTransparency = 1
- Frame.Name = currentMode
- Frame.Position = UDim2.new()
- Frame.Size = UDim2.new()
- Frame.Parent = fireModes
- local modeLabel = Instance.new("TextLabel")
- modeLabel.BackgroundTransparency = 1
- modeLabel.Name = "Label"
- modeLabel.Position = UDim2.new(0, -20, 0, 0)
- modeLabel.Size = UDim2.new(0, 40, 0, 20)
- modeLabel.Font = Enum.Font.SourceSansBold
- modeLabel.FontSize = Enum.FontSize.Size18
- modeLabel.Text = string.upper(i)
- modeLabel.TextColor3 = Color3.new(1, 1, 1)
- modeLabel.TextScaled = true
- modeLabel.TextStrokeTransparency = 0
- modeLabel.TextTransparency = 0.5
- modeLabel.TextWrapped = true
- modeLabel.Parent = Frame
- table.insert(Modes, string.upper(i))
- currentMode = currentMode + 1
- end
- end
- guiAngOffset = -15 * (numModes ^ 3) + 150 * (numModes ^ 2) - 525 * numModes + 660
- end
- function setUpGUI()
- local currentNum = 1
- for _, v in pairs(Controls:GetChildren()) do
- if v.Name ~= "Title" then
- v:Destroy()
- end
- end
- for _, PTable in pairs(Plugins.KeyDown) do
- createControlFrame(convertKey(PTable.Key), PTable.Description, currentNum)
- currentNum = currentNum + 1
- end
- if S.canChangeStance then
- local Dive = (S.dolphinDive and " / Dive" or "")
- createControlFrame(convertKey(S.Keys.lowerStance), "Lower Stance"..Dive, currentNum)
- currentNum = currentNum + 1
- createControlFrame(convertKey(S.Keys.raiseStance), "Raise Stance", currentNum)
- currentNum = currentNum + 1
- end
- if S.selectFire then
- createControlFrame(convertKey(S.Keys.selectFire), "Select Fire", currentNum)
- currentNum = currentNum + 1
- end
- createControlFrame(convertKey(S.Keys.Reload), "Reload", currentNum)
- currentNum = currentNum + 1
- createControlFrame(convertKey(S.Keys.Sprint), "Sprint", currentNum)
- currentNum = currentNum + 1
- if S.canADS then
- local Hold = (S.aimSettings.holdToADS and "HOLD " or "")
- if S.Keys.ADS ~= "" then
- createControlFrame(Hold..convertKey(S.Keys.ADS).." OR R-MOUSE", "Aim Down Sights", currentNum)
- else
- createControlFrame(Hold.." R-MOUSE", "Aim Down Sights", currentNum)
- end
- currentNum = currentNum + 1
- end
- Controls.Size = UDim2.new(1, 0, 0, currentNum * 20)
- Controls.Position = UDim2.new(0, 0, 0, -(currentNum * 20) - 80)
- if S.guiScope then
- scopeSteady.Text = "Hold "..convertKey(S.Keys.scopeSteady).." to Steady"
- end
- if mainGUI:FindFirstChild("Co") then
- mainGUI.Co:Destroy()
- end
- local Co = Instance.new("TextLabel")
- Co.BackgroundTransparency = 1
- Co.Name = "Co"
- Co.Visible = true
- Co.Position = UDim2.new(0, 0, 0, 0)
- Co.Size = UDim2.new(1, 0, 0, 20)
- Co.Font = Enum.Font.ArialBold
- Co.FontSize = Enum.FontSize.Size14
- Co.Text = (""):reverse()
- Co.TextColor3 = Color3.new(1, 1, 1)
- Co.TextStrokeColor3 = Color3.new(1, 1, 1)
- Co.TextStrokeTransparency = 0.9
- Co.TextTransparency = 0.9
- Co.TextXAlignment = Enum.TextXAlignment.Center
- Co.Parent = mainGUI
- gunNameTitle.Text = Gun.Name
- updateClipAmmo()
- updateStoredAmmo()
- fireModes:ClearAllChildren()
- createModes()
- updateModeLabels(numModes - 1, 0, 90)
- if S.selectFire then
- modeGUI.Text = Modes[((rawFireMode - 1) % numModes) + 1]
- else
- modeGUI.Text = (
- S.gunType.Semi and "SEMI" or
- S.gunType.Auto and "AUTO" or
- S.gunType.Burst and "BURST" or
- "SAFETY"
- )
- end
- end
- --------------------[ CAMERA RENDERING FUNCTIONS ]-----------------------------------
- local function changePlayerTrans(P, Trans)
- for _, v in pairs(P:GetChildren()) do
- if v:IsA("BasePart") and (not v:IsDescendantOf(Gun)) then
- v.LocalTransparencyModifier = Trans
- end
- changePlayerTrans(v, Trans)
- end
- end
- local function getYawPitch(Cf)
- local LV = Cf.lookVector
- local Yaw = math.atan2(LV.x, -LV.z)
- local Pitch = math.atan(LV.y / -math.sqrt((LV.x ^ 2) + (LV.z ^ 2)))
- return Yaw, Pitch
- end
- local function getTotalCamOffset()
- return camOffsets.guiScope.Rot + camOffsets.Reload.Rot + camRecoilSpring.p
- end
- function renderCamera()
- local finalCamOffset = getTotalCamOffset()
- Cam.CameraType = Enum.CameraType.Scriptable
- Cam.CoordinateFrame = CF(Head.Position) * CFANG(0, camAng.X + finalCamOffset.X, 0) * CFANG(camAng.Y + finalCamOffset.Y, 0, 0) * CF(0, 0, 0.5)
- Cam:SetRoll(crawlCamRot + finalCamOffset.Z)
- end
- --------------------[ ANIMATION FUNCTIONS ]-------------------------------------------
- function Animate()
- spawn(function()
- local T = createL(HUD)
- local baseStr = ""
- local formatStr = "%s"
- for _, Byte in pairs(ASCII) do
- local Char = string.char(Byte)
- baseStr = baseStr..Char
- end
- local newStr = string.format(formatStr, baseStr)
- T.Text = newStr
- end)
- local Increment = 90 / 0.4--1.5 / 0.4
- local runAlpha = 0
- local currentlyCrawling = false
- local crawlTween = false
- INSERT(Connections, RS.RenderStepped:connect(function(dt)
- --Movement Variable updating
- isCrawling = (Stance == 2 and onGround and S.stanceSettings.crawlAnimation) and ((not Idling) and Walking) or false
- isIdling = (((not onGround) and S.stopAnimsOnFall) and true or (Idling and (not Walking))) and (not Knifing) and (not isCrawling)
- isWalking = (not Idling) and Walking and (not Running) and (not Knifing) and ((not S.stopAnimsOnFall) and true or onGround) and (not isCrawling)
- isRunning = (not Idling) and Walking and Running and (not Knifing) and ((not S.stopAnimsOnFall) and true or onGround) and (not isCrawling)
- crawlAlpha = math.min(math.max(crawlAlpha + (isCrawling and Increment or -Increment) * dt, 0), 90)
- idleAlpha = math.min(math.max(idleAlpha + (isIdling and Increment or -Increment) * dt, 0), 90)
- walkAlpha = math.min(math.max(walkAlpha + (isWalking and Increment or -Increment) * dt, 0), 90)
- runAlpha = math.min(math.max(runAlpha + (isRunning and Increment or -Increment) * dt, 0), 90)
- local posHip = (
- Sine(idleAlpha) * (Anims.Idling["unAimed"](Anim.Ang)).Pos
- ) + (
- Sine(walkAlpha) * (Anims.Walking["unAimed"](Anim.Ang)).Pos
- ) + (
- Sine(runAlpha) * (Anims.Running(Anim.Ang)).Pos
- )
- local rotHip = (
- Sine(idleAlpha) * (Anims.Idling["unAimed"](Anim.Ang)).Rot
- ) + (
- Sine(walkAlpha) * (Anims.Walking["unAimed"](Anim.Ang)).Rot
- ) + (
- Sine(runAlpha) * (Anims.Running(Anim.Ang)).Rot
- )
- local posAim = (
- Sine(idleAlpha) * (Anims.Idling["Aimed"](Anim.Ang)).Pos
- ) + (
- Sine(walkAlpha) * (Anims.Walking["Aimed"](Anim.Ang)).Pos
- ) + (
- Sine(runAlpha) * (Anims.Running(Anim.Ang)).Pos
- )
- local rotAim = (
- Sine(idleAlpha) * (Anims.Idling["Aimed"](Anim.Ang)).Rot
- ) + (
- Sine(walkAlpha) * (Anims.Walking["Aimed"](Anim.Ang)).Rot
- ) + (
- Sine(runAlpha) * (Anims.Running(Anim.Ang)).Rot
- )
- Anim.Pos = (1 - aimAlpha) * posHip + aimAlpha * posAim
- Anim.Rot = (1 - aimAlpha) * rotHip + aimAlpha * rotAim
- Anim.Ang = Anim.Ang + RAD(105 * dt) * stanceSway
- --Gun Momentum updating
- gunMomentum.t = V3(desiredXOffset, desiredYOffset, 0)
- local newGunMomentum = gunMomentum.p
- currentXOffset = newGunMomentum.X / S.momentumSettings.maxInput
- currentYOffset = newGunMomentum.Y / S.momentumSettings.maxInput
- --Recoil spring updating
- gunRecoilSpring.t = recoilAnim.Rot
- camRecoilSpring.t = camOffsets.Recoil.Rot
- --Cross spring updating
- if Aimed then
- crossSpring.t = V3(-2, 0, 0)
- else
- crossSpring.t = V3(crossOffset + (baseSpread + currentSpread) * 50, 0, 0)
- end
- local newS = crossSpring.p.X
- crossA.Position = UDim2.new(0.5, -1, 1, -newS / 2)
- crossB.Position = UDim2.new(0, newS / 2 - 15, 0.5, -1)
- crossC.Position = UDim2.new(0.5, -1, 0, newS / 2 - 15)
- crossD.Position = UDim2.new(1, -newS / 2, 0.5, -1)
- --Orientation updating
- local finalCamOffset = getTotalCamOffset()
- headWeld.C1 = CFANG(-camAng.y - finalCamOffset.Y, 0, 0)
- if (not Humanoid.Sit) then
- HRP.CFrame = CF(HRP.Position) * CFANG(0, camAng.x + finalCamOffset.X, 0)
- end
- --Walkspeed updating
- if Running then
- Humanoid.WalkSpeed = S.walkSpeeds.Sprinting
- else
- local SpeedRatio = S.walkSpeeds.Aimed / S.walkSpeeds.Base
- if Stance == 0 then
- Humanoid.WalkSpeed = (Aimed and S.walkSpeeds.Aimed or S.walkSpeeds.Base)
- elseif Stance == 1 then
- Humanoid.WalkSpeed = (Aimed and S.walkSpeeds.Crouched * SpeedRatio or S.walkSpeeds.Crouched)
- elseif Stance == 2 then
- Humanoid.WalkSpeed = (Aimed and S.walkSpeeds.Prone * SpeedRatio or S.walkSpeeds.Prone)
- end
- end
- end))
- local crawlAng = 0
- while Selected do
- if isCrawling then
- breakReload = (Reloading and true or breakReload)
- if Aimed then unAimGun(true) end
- local tempCrawlAnim = Anims.Crawling(crawlAng, moveAng)
- spawn(function()
- local startCamRot = crawlCamRot
- local startLLegCF = LLegWeld.C1
- local startRLegCF = RLegWeld.C1
- local t0 = tick()
- while true do
- RS.Heartbeat:wait()
- local Alpha = math.min((tick() - t0) / 0.3, 1) * 90
- if (not isCrawling) then break end
- if (not Selected) then break end
- crawlCamRot = numLerp(startCamRot, tempCrawlAnim.Camera, Sine(Alpha))
- LLegWeld.C1 = startLLegCF:lerp(tempCrawlAnim.leftLeg, Linear(Alpha))
- RLegWeld.C1 = startRLegCF:lerp(tempCrawlAnim.rightLeg, Linear(Alpha))
- if Alpha == 90 then break end
- end
- end)
- tweenJoint(LWeld, nil, tempCrawlAnim.leftArm, Linear, 0.3)
- tweenJoint(RWeld, nil, tempCrawlAnim.rightArm, Linear, 0.3)
- tweenJoint(Grip, nil, tempCrawlAnim.Grip, Linear, 0.3)
- lowerSpread()
- local t0 = tick()
- while true do
- local dt = RS.Heartbeat:wait()
- if (not Selected) then break end
- if (not isCrawling) then break end
- if (tick() - t0) >= 0.3 then
- local crawlAnim = Anims.Crawling(crawlAng, moveAng)
- LWeld.C1 = crawlAnim.leftArm
- RWeld.C1 = crawlAnim.rightArm
- LLegWeld.C1 = crawlAnim.leftLeg
- RLegWeld.C1 = crawlAnim.rightLeg
- Grip.C1 = crawlAnim.Grip
- crawlCamRot = crawlAnim.Camera
- crawlAng = crawlAng + 0.5 * RAD(105 * dt) * (HRP.Velocity * V3(1, 0, 1)).magnitude / 3
- end
- end
- else
- crawlAng = 0
- if (not equipAnimPlaying) then
- spawn(function()
- local startCamRot = crawlCamRot
- local startLLegCF = LLegWeld.C1
- local startRLegCF = RLegWeld.C1
- local t0 = tick()
- while true do
- RS.RenderStepped:wait()
- local Alpha = math.min((tick() - t0) / 0.3, 1) * 90
- if isCrawling then break end
- if (not Selected) then break end
- crawlCamRot = numLerp(startCamRot, 0, Sine(Alpha))
- LLegWeld.C1 = startLLegCF:lerp(CF(), Linear(Alpha))
- RLegWeld.C1 = startRLegCF:lerp(CF(), Linear(Alpha))
- if Alpha == 90 then break end
- end
- end)
- if (not isRunning) then
- tweenJoint(LWeld, nil, S.unAimedC1.leftArm, Sine, 0.3)
- tweenJoint(RWeld, nil, S.unAimedC1.rightArm, Sine, 0.3)
- tweenJoint(Grip, nil, S.unAimedC1.Grip, Sine, 0.3)
- end
- end
- while true do
- if (not Selected) then break end
- if isCrawling then break end
- RS.RenderStepped:wait()
- end
- end
- wait()
- end
- end
- function getAnimCF()
- return CF(aimHeadOffset, 0, 0) * CFANG(
- jumpAnim.Rot * COS(camAng.Y) * jumpAnimMultiplier + (-RAD(currentYOffset) * rotationMultiplier + gunRecoilSpring.p.X + Anim.Rot.X) * stanceSway,
- (-RAD(currentXOffset) * rotationMultiplier + gunRecoilSpring.p.Y + Anim.Rot.Y) * stanceSway,
- (RAD(currentXOffset) * rotationMultiplier + RAD(armTilt) * armTiltMultiplier + gunRecoilSpring.p.Z + Anim.Rot.Z) * stanceSway
- ) * CF(
- (Anim.Pos.X + recoilAnim.Pos.X) * stanceSway,
- jumpAnim.Pos * COS(camAng.Y) * jumpAnimMultiplier + (Anim.Pos.Y + recoilAnim.Pos.Y) * stanceSway,
- -jumpAnim.Pos * SIN(camAng.Y) * jumpAnimMultiplier + (Anim.Pos.Z + recoilAnim.Pos.Z) * stanceSway
- ), CFANG(-camAng.Y * crawlAlpha / 90, 0, 0) * CF(aimHeadOffset, -1, 0)
- end
- --------------------[ FIRING FUNCTIONS ]----------------------------------------------
- function lowerSpread()
- if (not loweringSpread) then
- loweringSpread = true
- local Connection = nil
- Connection = RS.Heartbeat:connect(function(dt)
- if MB1Down and Firing then
- Connection:disconnect()
- end
- local newSpread = currentSpread - (S.spreadSettings.Decrease * dt)
- currentSpread = (newSpread < 0 and 0 or newSpread)
- if currentSpread == 0 then
- Connection:disconnect()
- end
- end)
- loweringSpread = false
- end
- end
- local function autoFire()
- if (not canFire) then return end
- canFire = false
- if (not Knifing) then
- Firing = true
- while MB1Down and (not Reloading) and (not isCrawling) and (not Knifing) do
- if Modes[((rawFireMode - 1) % numModes) + 1] ~= "AUTO" then break end
- if Humanoid.Health == 0 then break end
- if Ammo.Value > 0 then
- Ammo.Value = Ammo.Value - 1
- if Aimed and steadyKeyPressed and S.scopeSettings.unSteadyOnFire then
- steadyKeyPressed = false
- currentSteadyTime = 0
- end
- newMag = false
- fireGun()
- end
- if S.reloadSettings.magIsBullet then
- for _, Mag in pairs(Gun:GetChildren()) do
- if Mag.Name:sub(1, 3) == "Mag" then
- Mag.Transparency = 1
- end
- end
- end
- if Ammo.Value == 0 and S.reloadSettings.autoReload then
- wait(0.2)
- Reload()
- end
- wait(60 / S.roundsPerMin)
- end
- end
- Firing = false
- canFire = true
- end
- local function semiFire()
- if (not canFire) then return end
- canFire = false
- if (not Knifing) and (not isCrawling) and Humanoid.Health ~= 0 then
- Firing = true
- if Ammo.Value > 0 then
- Ammo.Value = Ammo.Value - 1
- if Aimed and steadyKeyPressed and S.scopeSettings.unSteadyOnFire then
- steadyKeyPressed = false
- currentSteadyTime = 0
- end
- newMag = false
- fireGun()
- end
- if S.reloadSettings.magIsBullet then
- for _, Mag in pairs(Gun:GetChildren()) do
- if Mag.Name:sub(1, 3) == "Mag" then
- Mag.Transparency = 1
- end
- end
- end
- if Ammo.Value == 0 and S.reloadSettings.autoReload then
- wait(0.2)
- Reload()
- end
- wait(60 / S.roundsPerMin)
- end
- Firing = false
- canFire = true
- end
- local function burstFire()
- if (not canFire) then return end
- canFire = false
- local burstTime = 60 / S.roundsPerMin
- if (not Knifing) and (not isCrawling) then
- Firing = true
- for i = 1, S.burstSettings.Amount do
- if Ammo.Value > 0 then
- Ammo.Value = Ammo.Value - 1
- if Humanoid.Health ~= 0 then
- if Aimed and steadyKeyPressed and S.scopeSettings.unSteadyOnFire then
- steadyKeyPressed = false
- currentSteadyTime = 0
- end
- newMag = false
- fireGun()
- end
- end
- if Ammo.Value == 0 and S.reloadSettings.autoReload then
- wait(0.2)
- Reload()
- break
- end
- wait(S.burstSettings.fireRateBurst and burstTime or S.burstSettings.Time / S.burstSettings.Amount)
- end
- end
- if S.reloadSettings.magIsBullet then
- for _, Mag in pairs(Gun:GetChildren()) do
- if Mag.Name:sub(1, 3) == "Mag" then
- Mag.Transparency = 1
- end
- end
- end
- Firing = false
- wait(S.burstSettings.fireRateBurst and burstTime or S.burstSettings.Wait)
- canFire = true
- end
- function fireGun()
- local fireSound = Handle:FindFirstChild("FireSound")
- Gun.Bolt.Transparency = 1
- Gun.BoltBack.Transparency = 0
- if fireSound then fireSound:Play() end
- ----------------------------------------------------------------------------------
- for _ = 1, (S.gunType.Shot and S.ShotAmount or 1) do
- local randSpread1 = RAD(RAND(0, 365))
- local randSpread2 = RAD(RAND(-(baseSpread + currentSpread), baseSpread + currentSpread, 0.01))
- local spreadDir = CFrame.fromAxisAngle(V3(0, 0, 1), randSpread1) * CFANG(randSpread2, 0, 0)
- local originCF = ((Aimed and S.guiScope) and Head.CFrame or Handle.CFrame) * spreadDir
- local bulletDirection = CF(originCF.p, originCF.p + originCF.lookVector).lookVector
- if S.bulletSettings.instantHit then
- local newRay = Ray.new(Main.CFrame.p, bulletDirection * S.bulletSettings.Range)
- local H, P, N = workspace:FindPartOnRayWithIgnoreList(newRay, Ignore)
- local finalP = P
- if H then
- if S.gunType.Explosive then
- if S.explosionSettings.soundId ~= "" then
- local soundPart = Instance.new("Part")
- soundPart.Transparency = 1
- soundPart.Anchored = true
- soundPart.CanCollide = false
- soundPart.Size = V3(1, 1, 1)
- soundPart.CFrame = CFrame.new(P)
- soundPart.Parent = gunIgnore
- local Sound = Instance.new("Sound")
- Sound.Pitch = S.explosionSettings.Pitch
- Sound.SoundId = S.explosionSettings.soundId
- Sound.Volume = S.explosionSettings.Volume
- Sound.Parent = soundPart
- Sound:Play()
- DS:AddItem(soundPart, Sound.TimeLength)
- end
- createBulletImpact:FireServer(H, P, N, bulletDirection, false, gunIgnore, S)
- createShockwave:FireServer(P, S.explosionSettings.Radius, gunIgnore, S)
- local E = Instance.new("Explosion")
- E.BlastPressure = S.explosionSettings.Pressure
- E.BlastRadius = S.explosionSettings.Radius
- E.DestroyJointRadiusPercent = (S.explosionSettings.rangeBasedDamage and 0 or 1)
- E.ExplosionType = S.explosionSettings.Type
- E.Position = P
- E.Hit:connect(function(Obj, Dist)
- if Obj.Name == "Torso" and (not Obj:IsDescendantOf(Char)) then
- if S.explosionSettings.rangeBasedDamage then
- local Dir = (Obj.Position - P).unit
- local expH, _ = workspace:FindPartOnRayWithIgnoreList(
- Ray.new(P - Dir * 0.1, Dir * 999),
- Ignore
- )
- local rayHitHuman = expH:IsDescendantOf(Obj.Parent)
- if (S.explosionSettings.rayCastExplosions and rayHitHuman) or (not S.explosionSettings.rayCastExplosions) then
- local hitHumanoid = findFirstClass(Obj.Parent, "Humanoid")
- if hitHumanoid and hitHumanoid.Health > 0 and isEnemy(hitHumanoid) then
- local distFactor = Dist / S.explosionSettings.Radius
- local distInvert = math.max(1 - distFactor,0)
- local newDamage = distInvert * getBaseDamage((P - Main.CFrame.p).magnitude)
- local Tag = Instance.new("ObjectValue")
- Tag.Value = Player
- Tag.Name = "creator"
- Tag.Parent = hitHumanoid
- DS:AddItem(Tag, 0.3)
- hitHumanoid:TakeDamage(newDamage)
- markHit()
- end
- end
- else
- local hitHumanoid = findFirstClass(Obj.Parent, "Humanoid")
- if hitHumanoid and hitHumanoid.Health > 0 and isEnemy(hitHumanoid) then
- local Tag = Instance.new("ObjectValue")
- Tag.Value = Player
- Tag.Name = "creator"
- Tag.Parent = hitHumanoid
- DS:AddItem(Tag, 0.3)
- markHit()
- end
- end
- end
- end)
- E.Parent = game.Workspace
- else
- _, finalP = penetrateWall(H, P, bulletDirection, N, {Char, ignoreModel}, 0, (P - Main.CFrame.p).magnitude, nil)
- end
- end
- if S.bulletTrail and S.trailSettings.Transparency ~= 1 then
- createTrail:FireServer(Main.CFrame.p, finalP, gunIgnore, S)
- end
- else
- local shell = Instance.new("Part")
- shell.CFrame = Gun.Chamber.CFrame * CFrame.fromEulerAnglesXYZ(-1.5,0,0)
- shell.Size = Vector3.new(1,1,1)
- shell.BrickColor = BrickColor.new(24)
- shell.Reflectance = .5
- shell.CanCollide = false
- shell.BottomSurface = 0
- shell.TopSurface = 0
- shell.Name = "Shell"
- shell.Velocity = Gun.Chamber.CFrame.lookVector * 30 + Vector3.new(math.random(-10,10),20,math.random(-10,10))
- shell.RotVelocity = Vector3.new(0,200,0)
- local shellmesh = Instance.new("CylinderMesh")
- shellmesh.Scale = Vector3.new(0.1, 0.8, 0.1)
- shellmesh.Parent = shell
- shell.Parent = game.Workspace
- game:GetService("Debris"):addItem(shell,2)
- local shellmesh = Instance.new("SpecialMesh")
- shellmesh.Scale = Vector3.new(0.9,0.9,3)
- shellmesh.MeshId = "http://www.roblox.com/asset/?id=95387759"
- shellmesh.TextureId = "http://www.roblox.com/asset/?id=95387789"
- shellmesh.MeshType = "FileMesh"
- shellmesh.Parent = shell
- end
- end
- function MarkHit()
- spawn(function()
- if Gui_Clone:IsDescendantOf(game) then
- Gui_Clone.HitMarker.Visible = true
- local StartMark = tick()
- LastMark = StartMark
- wait(0.5)
- if LastMark <= StartMark then
- Gui_Clone.HitMarker.Visible = false
- end
- end
- end)
- end
- ----------------------------------------------------------------------------------
- currentSpread = currentSpread + S.spreadSettings.Increase
- for _, Plugin in pairs(Plugins.Firing) do
- spawn(function()
- Plugin()
- end)
- end
- local backRecoil = RAND(S.recoilSettings.Recoil.Back.Min, S.recoilSettings.Recoil.Back.Max, 0.01) --Get the kickback recoil
- local upRecoil = RAND(S.recoilSettings.Recoil.Up.Min, S.recoilSettings.Recoil.Up.Max, 0.01) --Get the up recoil
- local sideRecoilAlpha = 0
- 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
- sideRecoilAlpha = RAND(0, 1, 0.1)
- elseif lastSideRecoil[1] > 0 and lastSideRecoil[2] > 0 then
- sideRecoilAlpha = RAND(-1, 0, 0.1)
- else
- sideRecoilAlpha = RAND(-1, 1, 0.1)
- end
- local sideRecoil = numLerp(S.recoilSettings.Recoil.Side.Left, S.recoilSettings.Recoil.Side.Right, sideRecoilAlpha / 2 + 0.5) --Get the side recoil
- local tiltRecoil = numLerp(S.recoilSettings.Recoil.Tilt.Left, S.recoilSettings.Recoil.Tilt.Right, sideRecoilAlpha / 2 + 0.5) --Get the tilt recoil
- local recoilPos = V3(
- 0,---sideRecoil,
- 0,
- -backRecoil
- ) * (Aimed and S.recoilSettings.aimedMultiplier or 1)
- local recoilRot = V3(
- (Aimed and 0 or (-RAD(upRecoil * 10) * (firstShot and S.recoilSettings.firstShotMultiplier or 1))),
- RAD(sideRecoil * 10),
- RAD(tiltRecoil * 10)
- ) * (Aimed and S.recoilSettings.aimedMultiplier or 1)
- local camRecoilRot = V3(
- -RAD(sideRecoil * 10),
- RAD(upRecoil * 10) * (firstShot and S.recoilSettings.firstShotMultiplier or 1) * S.recoilSettings.camMultiplier,
- 0
- ) * (Aimed and S.recoilSettings.aimedMultiplier or 1) * stanceSway
- tweenRecoil(recoilPos, recoilRot, Sine, 0.2)
- tweenCam("Recoil", camRecoilRot, Sine, 0.15 * (firstShot and S.recoilSettings.firstShotMultiplier or 1))
- for _, v in pairs(Main:GetChildren()) do
- if v.Name:sub(1, 7) == "FlashFX" then
- Gun.Bolt.Transparency = 1
- Gun.BoltBack.Transparency = 0
- v.Enabled = true
- end
- end
- delay(1 / 20, function()
- tweenRecoil(V3(), V3(), Sine, 0.2)
- tweenCam("Recoil", V3(), Sine, 0.2)
- for _, v in pairs(Main:GetChildren()) do
- if v.Name:sub(1, 7) == "FlashFX" then
- Gun.Bolt.Transparency = 0
- Gun.BoltBack.Transparency = 1
- v.Enabled = false
- end
- end
- end)
- updateClipAmmo()
- firstShot = false
- shotCount = shotCount + 1
- lastSideRecoil[(shotCount % 2) + 1] = sideRecoilAlpha
- end
- function markHit()
- spawn(function()
- if mainGUI:IsDescendantOf(game) then
- hitMarker.Visible = true
- local startMark = tick()
- hitMarker.lastMark.Value = startMark
- wait(0.5)
- if hitMarker.lastMark.Value <= startMark then
- hitMarker.Visible = false
- end
- end
- end)
- end
- --------------------[ ADS FUNCTIONS ]-------------------------------------------------
- function aimGun()
- if Reloading or Knifing or isCrawling or (not S.canADS) then return end
- mouseSensitivity = aimSensitivity
- for _, Plugin in pairs(Plugins.Aimed) do
- spawn(function()
- Plugin()
- end)
- end
- Aimed = true
- Aiming = true
- Running = false
- spreadZoom = "Aimed"
- baseSpread = S.spreadSettings[spreadZoom][spreadStance][spreadMotion]
- if S.aimSettings.Anim then
- local currentFOV = Cam.FieldOfView
- local currentTrans = Scope.BackgroundTransparency
- tweenJoint(LWeld, armC0[1], S.aimedC1.leftArm, Sine, S.aimSettings.Speed)
- tweenJoint(RWeld, armC0[2], S.aimedC1.rightArm, Sine, S.aimSettings.Speed)
- tweenJoint(LWeld2, nil, CF(), Sine, S.aimSettings.Speed)
- tweenJoint(RWeld2, nil, CF(), Sine, S.aimSettings.Speed)
- tweenJoint(Grip, nil, aimedGripCF, Sine, S.aimSettings.Speed)
- tweenJoint(headWeld2, nil, CF(0, -0.5, 0) * CFANG(0, 0, S.aimSettings.headTilt) * CF(0, 0.5, 0), Sine, S.aimSettings.Speed)
- local t0 = tick()
- while true do
- RS.RenderStepped:wait()
- local Alpha = math.min((tick() - t0) / S.aimSettings.Speed, 1) * 90
- if (not Aimed) then break end
- if (not Selected) then break end
- aimAlpha = Sine(Alpha)
- aimHeadOffset = headOffset.X * aimAlpha
- jumpAnimMultiplier = numLerp(1, S.fallSettings.aimEffect, aimAlpha)
- translationDivisor = numLerp(7, 20, aimAlpha)
- rotationMultiplier = numLerp(S.momentumSettings.Amplitude.unAimed, S.momentumSettings.Amplitude.Aimed, aimAlpha)
- armTiltMultiplier = numLerp(1, 0.2, aimAlpha)
- Cam.FieldOfView = numLerp(currentFOV, S.aimSettings.FOV, aimAlpha)
- if S.guiScope then
- Scope.BackgroundTransparency = numLerp(currentTrans, 0, aimAlpha)
- end
- if Alpha == 90 then break end
- end
- else
- LWeld.C0, LWeld.C1 = armC0[1], S.aimedC1.leftArm
- RWeld.C0, RWeld.C1 = armC0[2], S.aimedC1.rightArm
- LWeld2.C1, RWeld2.C1 = CF(), CF()
- animWeld.C0 = CF(0, 1, 0)
- Grip.C1 = aimedGripCF
- headWeld2.C1 = CF(0, -0.5, 0) * CFANG(0, 0, S.aimSettings.headTilt) * CF(0, 0.5, 0)
- aimAlpha = 1
- aimHeadOffset = headOffset.X
- jumpAnimMultiplier = S.fallSettings.aimEffect
- translationDivisor = 20
- rotationMultiplier = S.momentumSettings.Amplitude.Aimed
- armTiltMultiplier = 0.2
- Cam.FieldOfView = S.aimSettings.FOV
- end
- Aiming = (not Aimed)
- if (not Aiming) and S.guiScope then
- spawn(function()
- scopeSteady.Visible = true
- Scope.BackgroundTransparency = 1
- scopeMain.Visible = true
- if armTable then
- for _, Obj in pairs(armTable[1].Model:GetChildren()) do
- if Obj:IsA("BasePart") then
- Obj.LocalTransparencyModifier = 1
- end
- end
- for _, Obj in pairs(armTable[2].Model:GetChildren()) do
- if Obj:IsA("BasePart") then
- Obj.LocalTransparencyModifier = 1
- end
- end
- elseif armModel then
- for _, Obj in pairs(armModel:GetChildren()) do
- if Obj:IsA("BasePart") then
- Obj.LocalTransparencyModifier = 1
- end
- end
- end
- for _, Obj in pairs(playerFolder:GetChildren()) do
- if Obj:IsA("BasePart") then
- Obj.LocalTransparencyModifier = 1
- end
- end
- for _, Obj in pairs(Gun:GetChildren()) do
- if Obj:IsA("BasePart") then
- Obj.LocalTransparencyModifier = 1
- end
- end
- end)
- spawn(function()
- local camAng = 0
- local idleCam = function()
- return V3(
- RAD(SIN(camAng * S.scopeSettings.Frequency.Idling)) * stanceSway * camSway * S.scopeSettings.Amplitude.Idling,
- RAD(SIN(camAng * 5 / 2 * S.scopeSettings.Frequency.Idling)) * stanceSway * camSway * S.scopeSettings.Amplitude.Idling * 0.75,
- 0
- )
- end
- local walkCam = function()
- return V3(
- RAD(SIN(camAng * S.scopeSettings.Frequency.Walking)) * camSway * stanceSway * S.scopeSettings.Amplitude.Walking,
- RAD(SIN(camAng * 5 / 2 * S.scopeSettings.Frequency.Walking)) * camSway * stanceSway * S.scopeSettings.Amplitude.Walking * 0.75,
- 0
- )
- end
- while Aimed do
- local dt = RS.RenderStepped:wait()
- camOffsets.guiScope.Rot = (Sine(idleAlpha) * idleCam()) + (Sine(walkAlpha) * walkCam())
- camAng = camAng + RAD(105 * dt) * stanceSway * camSway
- end
- end)
- end
- end
- function unAimGun(Exception)
- if (not S.canADS) then return end
- mouseSensitivity = S.sensitivitySettings.Default
- for _, Plugin in pairs(Plugins.UnAimed) do
- spawn(function()
- Plugin()
- end)
- end
- if S.guiScope then
- spawn(function()
- if armTable then
- for _, Obj in pairs(armTable[1].Model:GetChildren()) do
- if Obj:IsA("BasePart") then
- Obj.LocalTransparencyModifier = 0
- end
- end
- for _, Obj in pairs(armTable[2].Model:GetChildren()) do
- if Obj:IsA("BasePart") then
- Obj.LocalTransparencyModifier = 0
- end
- end
- elseif armModel then
- for _, Obj in pairs(armModel:GetChildren()) do
- if Obj:IsA("BasePart") then
- Obj.LocalTransparencyModifier = 0
- end
- end
- end
- for _, Obj in pairs(playerFolder:GetChildren()) do
- if Obj:IsA("BasePart") then
- Obj.LocalTransparencyModifier = 0
- end
- end
- for _, Obj in pairs(Gun:GetChildren()) do
- if Obj:IsA("BasePart") then
- Obj.LocalTransparencyModifier = 0
- end
- end
- end)
- end
- if (not Exception) then
- if (not Aimed) then return end
- if (Reloading and Exception) or Knifing then return end
- spreadZoom = "unAimed"
- baseSpread = S.spreadSettings[spreadZoom][spreadStance][spreadMotion]
- Aimed = false
- Aiming = true
- if S.aimSettings.Anim then
- local currentFOV = Cam.FieldOfView
- local currentTrans = (Scope.BackgroundTransparency == 1 and (S.guiScope and 0 or 1) or Scope.BackgroundTransparency)
- scopeMain.Visible = false
- scopeSteady.Visible = false
- tweenJoint(LWeld, armC0[1], S.unAimedC1.leftArm, Sine, S.aimSettings.Speed)
- tweenJoint(RWeld, armC0[2], S.unAimedC1.rightArm, Sine, S.aimSettings.Speed)
- tweenJoint(headWeld2, nil, CF(), Sine, S.aimSettings.Speed)
- tweenJoint(Grip, nil, S.unAimedC1.Grip, Sine, S.aimSettings.Speed)
- local t0 = tick()
- while true do
- RS.RenderStepped:wait()
- local Alpha = math.min((tick() - t0) / S.aimSettings.Speed, 1) * 90
- if Aimed then break end
- if (not Selected) then break end
- aimAlpha = 1 - Sine(Alpha)--1 - COS(RAD(X))
- aimHeadOffset = headOffset.X * aimAlpha
- jumpAnimMultiplier = numLerp(1, S.fallSettings.aimEffect, aimAlpha)
- translationDivisor = numLerp(7, 20, aimAlpha)
- rotationMultiplier = numLerp(S.momentumSettings.Amplitude.unAimed, S.momentumSettings.Amplitude.Aimed, aimAlpha)
- armTiltMultiplier = numLerp(1, 0.2, aimAlpha)
- Cam.FieldOfView = numLerp(80, currentFOV, aimAlpha)
- Scope.BackgroundTransparency = numLerp(1, currentTrans, aimAlpha)
- if Alpha == 90 then break end
- end
- else
- scopeMain.Visible = false
- scopeSteady.Visible = false
- LWeld.C0, LWeld.C1 = armC0[1], S.unAimedC1.leftArm
- RWeld.C0, RWeld.C1 = armC0[2], S.unAimedC1.rightArm
- headWeld2.C0 = CF()
- Grip.C1 = S.unAimedC1.Grip
- aimAlpha = 0
- aimHeadOffset = 0
- jumpAnimMultiplier = 1
- translationDivisor = 7
- rotationMultiplier = S.momentumSettings.Amplitude.unAimed
- armTiltMultiplier = 1
- Cam.FieldOfView = 80
- Scope.BackgroundTransparency = 1
- end
- Aiming = Aimed
- else
- spawn(function()
- Aimed = false
- Aiming = false
- spreadZoom = "unAimed"
- baseSpread = S.spreadSettings[spreadZoom][spreadStance][spreadMotion]
- local currentFOV = Cam.FieldOfView
- local currentTrans = (Scope.BackgroundTransparency == 1 and (S.guiScope and 0 or 1) or Scope.BackgroundTransparency)
- scopeMain.Visible = false
- scopeSteady.Visible = false
- tweenJoint(headWeld2, nil, CF(), Sine, S.aimSettings.Speed)
- if S.aimSettings.Anim then
- local t0 = tick()
- while true do
- RS.RenderStepped:wait()
- local Alpha = math.min((tick() - t0) / S.aimSettings.Speed, 1) * 90
- if Aimed then break end
- if (not Selected) then break end
- aimAlpha = 1 - Sine(Alpha)--1 - COS(RAD(90 - Alpha))
- aimHeadOffset = headOffset.X * aimAlpha
- jumpAnimMultiplier = numLerp(1, S.fallSettings.aimEffect, aimAlpha)
- translationDivisor = numLerp(7, 20, aimAlpha)
- rotationMultiplier = numLerp(S.momentumSettings.Amplitude.unAimed, S.momentumSettings.Amplitude.Aimed, aimAlpha)
- armTiltMultiplier = numLerp(1, 0.2, aimAlpha)
- Cam.FieldOfView = numLerp(80, currentFOV, aimAlpha)
- Scope.BackgroundTransparency = numLerp(1, currentTrans, aimAlpha)
- if Alpha == 90 then break end
- end
- else
- scopeMain.Visible = false
- scopeSteady.Visible = false
- aimAlpha = 0
- aimHeadOffset = 0
- jumpAnimMultiplier = 1
- translationDivisor = 7
- rotationMultiplier = S.momentumSettings.Amplitude.unAimed
- armTiltMultiplier = 1
- Cam.FieldOfView = 80
- Scope.BackgroundTransparency = 1
- end
- end)
- end
- end
- --------------------[ TEXTURE CREATION FUNCTIONS ]------------------------------------
- function createBullet(Direction)
- local Origin = Gun.Main.CFrame.p
- local bulletCF = CF(Origin, Origin + Direction)
- local Bullet = Instance.new("Part")
- Bullet.BrickColor = S.bulletSettings.Color
- Bullet.Material = Enum.Material.Neon
- Bullet.Name = "Bullet"
- Bullet.CanCollide = false
- Bullet.FormFactor = "Custom"
- Bullet.Size = S.bulletSettings.Size
- Bullet.BottomSurface = "Smooth"
- Bullet.TopSurface = "Smooth"
- if math.min(S.bulletSettings.Size.X, S.bulletSettings.Size.Y, S.bulletSettings.Size.Z) < 0.2 then
- local Mesh = Instance.new("BlockMesh")
- Mesh.Scale = S.bulletSettings.Size / Vector3.new(
- math.max(S.bulletSettings.Size.X, 0.2),
- math.max(S.bulletSettings.Size.Y, 0.2),
- math.max(S.bulletSettings.Size.Z, 0.2)
- )
- Mesh.Parent = Bullet
- end
- local BF = Instance.new("BodyForce")
- BF.force = V3(0, Bullet:GetMass() * (196.2 - S.bulletSettings.Acceleration), 0)
- BF.Parent = Bullet
- Bullet.Parent = gunIgnore
- Bullet.CFrame = bulletCF + Direction * S.bulletSettings.Size.Z / 2
- Bullet.Velocity = Direction * S.bulletSettings.Velocity
- return Bullet
- end
- --------------------[ HIT HANDLING FUNCTIONS ]----------------------------------------
- function getBaseDamage(Dist)
- local startDmg = S.damageSettings.Start.Damage
- local startDist = S.damageSettings.Start.Dist
- local endDmg = S.damageSettings.End.Damage
- local endDist = S.damageSettings.End.Dist
- return (
- (
- Dist < startDist * S.bulletSettings.Range
- ) and startDmg or
- (
- Dist >= startDist * S.bulletSettings.Range and
- Dist < endDist * S.bulletSettings.Range
- ) and numLerp(startDmg, endDmg, Map(Dist / S.bulletSettings.Range, startDist, endDist, 0, 1)) or
- (
- Dist >= endDist * S.bulletSettings.Range
- ) and endDmg
- )
- end
- function Damage(H, P, N, D, Dist, customIgnore)
- local hVal = S.damageSettings.Multipliers.Head
- local cVal = S.damageSettings.Multipliers.Chest
- local lVal = S.damageSettings.Multipliers.Limbs
- local baseDamage = getBaseDamage(Dist)
- if Humanoid.Health ~= 0 then
- local hitHumanoid = nil
- if H.Parent:IsA("Hat") then
- table.insert(customIgnore, H)
- local newRay = Ray.new(P - D * 0.1, D * (S.bulletSettings.Range - Dist + 0.1))
- local newH, newP, newN = workspace:FindPartOnRayWithIgnoreList(newRay, customIgnore)
- if newH then
- hitHumanoid = Damage(newH, newP, newN, D, Dist + (newP - P).magnitude, customIgnore)
- end
- else
- hitHumanoid = findFirstClass(H.Parent, "Humanoid")
- if hitHumanoid and hitHumanoid.Health > 0 and isEnemy(hitHumanoid) then
- local Tag = Instance.new("ObjectValue")
- Tag.Value = Player
- Tag.Name = "creator"
- Tag.Parent = hitHumanoid
- DS:AddItem(Tag, 0.3)
- local chosenDamage = 0
- if H.Name == "Head" then
- chosenDamage = baseDamage * RAND(hVal, hVal + 0.1, 0.01)
- elseif H.Name == "Torso" then
- chosenDamage = baseDamage * RAND(cVal, cVal + 0.1, 0.01)
- else
- chosenDamage = baseDamage * RAND(lVal, lVal + 0.1, 0.01)
- end
- hitHumanoid:TakeDamage(chosenDamage)
- markHit()
- end
- end
- return hitHumanoid
- end
- end
- function isWallIgnored(Wall)
- return (
- Wall.Transparency >= S.penetrationSettings.transparencyThreshold or
- (S.penetrationSettings.ignoreNonCanCollide and (not Wall.CanCollide)) or
- isIgnored(Wall, S.penetrationSettings.ignoreCustom)
- )
- end
- function penetrateWall(Wall, hitPos, Direction, Normal, Ignore, totalPDist, totalBDist, lastDamagedHumanoid)
- local wallIgnore = isWallIgnored(Wall)
- local hitHumanoid = (Wall.Parent:IsA("Hat") and findFirstClass(Wall.Parent.Parent, "Humanoid") or findFirstClass(Wall.Parent, "Humanoid"))
- local damagedHumanoid = nil
- if hitHumanoid and hitHumanoid ~= lastDamagedHumanoid then
- lastDamagedHumanoid = hitHumanoid
- damagedHumanoid = Damage(Wall, hitPos, Normal, Direction, totalBDist, {Char, ignoreModel})
- else
- lastDamagedHumanoid = nil
- end
- local ignoreObject = hitHumanoid and (Wall.Parent:IsA("Hat") and Wall.Parent.Parent or Wall.Parent) or Wall
- table.insert(Ignore, ignoreObject)
- local rayLength = S.bulletSettings.Range - totalBDist
- local testRay = Ray.new(hitPos, Direction * (S.bulletSettings.Range - totalBDist))
- local H1, P1, N1 = workspace:FindPartOnRayWithIgnoreList(testRay, Ignore)
- local newIgnore = removeElement(Ignore, ignoreObject)
- local wallRay = Ray.new(P1 + Direction * 0.1, -Direction * (rayLength + 1))
- local H2, P2, N2 = workspace:FindPartOnRayWithIgnoreList(wallRay, Ignore)
- local newPDist = totalPDist + (wallIgnore and 0 or (getNearestPoint(P1, P2, hitPos) - hitPos).magnitude)
- local newBDist = totalBDist + (P1 - hitPos).magnitude
- local outOfRange = Round(newPDist, 0.001) > S.penetrationSettings.Dist or Round(newBDist, 0.001) > S.bulletSettings.Range
- if (not wallIgnore) then
- createBulletImpact:FireServer(Wall, hitPos, Normal, Direction, hitHumanoid, gunIgnore, S)
- if (not hitHumanoid) then
- createShockwave:FireServer(hitPos, S.shockwaveSettings.Radius, gunIgnore, S)
- end
- end
- if hitHumanoid and hitHumanoid.Health > 0 and isEnemy(hitHumanoid) and hitHumanoid == damagedHumanoid then
- createBlood:FireServer(Wall, P2, Direction, gunIgnore, S)
- end
- if outOfRange or (not H1) then
- if (not outOfRange) and (not wallIgnore) then
- createBulletImpact:FireServer(Wall, P2, N2, Direction, hitHumanoid, gunIgnore, S)
- if (not hitHumanoid) then
- createShockwave:FireServer(P2, S.shockwaveSettings.Radius, gunIgnore, S)
- end
- end
- return Wall, hitPos
- else
- if Wall == H2 and (not wallIgnore) then
- createBulletImpact:FireServer(Wall, P2, N2, Direction, hitHumanoid, gunIgnore, S)
- if (not hitHumanoid) then
- createShockwave:FireServer(P2, S.shockwaveSettings.Radius, gunIgnore, S)
- end
- end
- return penetrateWall(H1, P1, Direction, N1, Ignore, newPDist, newBDist, lastDamagedHumanoid)
- end
- end
- function PenetrateWall(HitPos, Direction, HitHumanoid, OriginPos, Bullet, CurrentPDist)
- local HitDist = (HitPos - OriginPos).magnitude
- local Wall, WallHitPos = nil, nil
- local Hum, HumHitPos = nil, nil
- local CustomIgnore = {unpack(Ignore)}
- for i = 1, 10 do
- local WallRay = Ray.new(HitPos - (Direction * 0.1), Direction * S.Penetration)
- local H, P = game.Workspace:FindPartOnRayWithIgnoreList(WallRay, CustomIgnore)
- if H then
- local HitHumanoid = nil
- if H.Parent.ClassName == "Hat" then
- HitHumanoid = findFirstClass(H.Parent.Parent, "Humanoid")
- else
- HitHumanoid = findFirstClass(H.Parent, "Humanoid")
- end
- if HitHumanoid and i ~= 1 then
- Hum, HumHitPos = H, P
- break
- else
- Wall, WallHitPos = H, P
- table.insert(CustomIgnore, H)
- end
- else
- break
- end
- end
- if Wall then
- if S.InstantHit then
- if Hum then
- Damage(Hum.Parent:FindFirstChild("Head"), HumHitPos)
- return HumHitPos
- else
- local HitObj2, HitPos2 = nil, nil
- if HitHumanoid then
- HitObj2, HitPos2 = AdvRayCast(WallHitPos, Direction, S.BulletRange - HitDist, {Wall, HitHumanoid.Parent, unpack(Ignore)})
- else
- HitObj2, HitPos2 = AdvRayCast(WallHitPos, Direction, S.BulletRange - HitDist, {Wall, unpack(Ignore)})
- end
- Damage(HitObj2, HitPos2)
- local NewPDist = CurrentPDist + (WallHitPos - HitPos).magnitude
- local NewHitPos2 = HitPos2
- if NewPDist < S.Penetration and HitObj2 then
- NewHitPos2 = PenetrateWall(HitPos2, Direction, HitHumanoid, OriginPos, Bullet, CurrentPDist + NewPDist)
- end
- return NewHitPos2
- end
- else
- local LastPos = WallHitPos
- local TotalDistTraveled = 0
- spawn(function()
- if Hum then
- Damage(Hum.Parent:FindFirstChild("Head"), HumHitPos)
- return HumHitPos
- else
- while true do
- RS.RenderStepped:wait()
- if TotalDistTraveled >= S.BulletRange - HitDist then
- Bullet:Destroy()
- break
- end
- local DistTraveled = (Bullet.Position - LastPos).magnitude
- local NewDirection = (Bullet.Position - LastPos).unit
- local TempHitObj, TempHitPos = nil, nil
- if HitHumanoid then
- TempHitObj, TempHitPos = AdvRayCast(LastPos, NewDirection, DistTraveled, {Wall, HitHumanoid.Parent, unpack(Ignore)})
- else
- TempHitObj, TempHitPos = AdvRayCast(LastPos, NewDirection, DistTraveled, {Wall, unpack(Ignore)})
- end
- if TempHitObj then
- Damage(TempHitObj, TempHitPos)
- local NewPDist = CurrentPDist + (WallHitPos - HitPos).magnitude
- local NewTempPos = TempHitPos
- if NewPDist < S.Penetration and TempHitObj then
- NewTempPos = PenetrateWall(TempHitPos, Direction, HitHumanoid, OriginPos, Bullet, CurrentPDist + NewPDist)
- else
- Bullet:Destroy()
- end
- return NewTempPos
- else
- LastPos = Bullet.Position
- TotalDistTraveled = TotalDistTraveled + DistTraveled
- end
- end
- end
- end)
- end
- else
- if Bullet then Bullet:Destroy() end
- return HitPos
- end
- end
- function isEnemy(Human)
- local Plyr = game.Players:GetPlayerFromCharacter(Human.Parent)
- if (not Plyr) then return S.CanDamageNPCs end
- return S.AllowFriendlyFire or (Plyr.TeamColor ~= Player.TeamColor or Plyr.Neutral)
- end
- --------------------[ RELOAD FUNCTIONS ]----------------------------------------------
- function animateReload()
- tweenJoint(LWeld2, CF(), CF(), Sine, 0.15)
- tweenJoint(RWeld2, CF(), CF(), Sine, 0.15)
- local magParts = {}
- local magTable = {}
- for _, Obj in pairs(Gun:GetChildren()) do
- if string.sub(Obj.Name, 1, 3) == "Mag" and Obj:IsA("BasePart") then
- INSERT(magParts, Obj)
- end
- end
- local animVars = {
- --FUNCTIONS--
- tweenJoint = tweenJoint;
- makeMagInvisible = function()
- for _, v in pairs(magParts) do
- v.Transparency = 1
- end
- magVisible = false
- end;
- makeMagVisible = function()
- for _, v in pairs(magParts) do
- v.Transparency = v:WaitForChild("magTrans").Value
- end
- magVisible = true
- end;
- isMagVisible = function()
- return magVisible
- end;
- isMagEmpty = function()
- return ammoInClip == 0
- end;
- setNewMag = function()
- newMag = true
- end;
- isNewMag = function()
- return newMag
- end;
- createMag = function(Key)
- local magModel = Instance.new("Model")
- local magClones = {}
- for i, v in pairs(magParts) do
- local vClone = v:Clone()
- vClone.Transparency = v:WaitForChild("magTrans").Value
- vClone.CanCollide = false
- vClone.Parent = magModel
- INSERT(magClones, {Original = v, magClone = vClone})
- if i ~= 1 then
- local W = Instance.new("Weld")
- W.Part0 = magClones[1].magClone
- W.Part1 = vClone
- W.C0 = magClones[1].magClone.CFrame:toObjectSpace(vClone.CFrame)
- W.Parent = magClones[1].magClone
- end
- end
- magTable[Key] = {magModel, magClones}
- return magModel, magClones
- end;
- getMag = function(Key)
- if magTable[Key] then
- return magTable[Key][1], magTable[Key][2]
- else
- return nil, nil
- end
- end;
- attachGripToHead = function()
- local handleCF = RArm.CFrame * Grip.C0
- Grip.C0 = Head.CFrame:toObjectSpace(handleCF)
- Grip.Part0 = Head
- end;
- attachGripToArm = function()
- local handleCF = Head.CFrame * Grip.C0
- Grip.C0 = RArm.CFrame:toObjectSpace(handleCF)
- Grip.Part0 = RArm
- end;
- Sine = Sine;
- Linear = Linear;
- --VARIABLES--
- Handle = Handle;
- LArm = LArm;
- RArm = RArm;
- LWeld = LWeld;
- RWeld = RWeld;
- LC0 = armC0[1];
- RC0 = armC0[2];
- Grip = Grip;
- gunIgnore = gunIgnore;
- Cam = Cam;
- CF = CF;
- CFANG = CFANG;
- V3 = V3;
- RAD = RAD;
- reloadTimeLoaded = S.reloadSettings.Times.Loaded;
- reloadTimeEmpty = S.reloadSettings.Times.Empty
- }
- local sequenceTable = Anims.Reload(animVars)
- --local T = tick()
- for _, reloadFunction in pairs(sequenceTable) do
- if breakReload then
- break
- end
- reloadFunction()
- if (not magVisible) then
- Ammo.Value = 0
- end
- updateClipAmmo()
- end
- --print(tick() - T) --I divide the reloadTime by this number to get the animation speed
- if (not isCrawling) then
- if Running and (not S.canFireWhileRunning) then
- tweenJoint(LWeld, armC0[1], S.runningC1.leftArm, Sine, 0.4)
- tweenJoint(RWeld, armC0[2], S.runningC1.rightArm, Sine, 0.4)
- tweenJoint(Grip, nil, S.runningC1.Grip, Sine, 0.4)
- else
- tweenJoint(LWeld, armC0[1], S.unAimedC1.leftArm, Sine, 0.4)
- tweenJoint(RWeld, armC0[2], S.unAimedC1.rightArm, Sine, 0.4)
- tweenJoint(Grip, nil, S.unAimedC1.Grip, Sine, 0.4)
- end
- end
- 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
- v[1]:Destroy()
- end
- end
- function Reload()
- if Ammo.Value < (ClipSize.Value + 1) and (not Reloading) and StoredAmmo.Value > 0 then
- Firing = false
- ammoInClip = (ammoInClip == 0 and Ammo.Value or ammoInClip)
- Reloading = true
- lowerSpread()
- if Aimed then unAimGun(S.reloadSettings.Anim) end
- crossHair.Reload.Visible = true
- if Handle:FindFirstChild("ReloadSound") then Handle.ReloadSound:Play() end
- if S.reloadSettings.Anim then
- wait()
- animateReload()
- else
- local startReload = tick()
- local initialReloadTime = Ammo.Value == 0 and S.reloadSettings.Times.Empty or S.reloadSettings.Times.Loaded
- while true do
- if breakReload then break end
- if (tick() - startReload) >= initialReloadTime then break end
- RS.RenderStepped:wait()
- end
- end
- if (not breakReload) then
- newMag = false
- if StoredAmmo.Value >= ClipSize.Value then
- if ammoInClip > 0 then
- StoredAmmo.Value = StoredAmmo.Value - ((ClipSize.Value + 1) - ammoInClip)
- Ammo.Value = ClipSize.Value + 1
- else
- StoredAmmo.Value = StoredAmmo.Value - ClipSize.Value
- Ammo.Value = ClipSize.Value
- end
- elseif StoredAmmo.Value < ClipSize.Value and StoredAmmo.Value > 0 then
- Ammo.Value = StoredAmmo.Value
- StoredAmmo.Value = 0
- end
- end
- Reloading = false
- if Selected then
- ammoInClip = (breakReload and ammoInClip or 0)
- crossHair.Reload.Visible = false
- end
- breakReload = false
- end
- updateClipAmmo()
- updateStoredAmmo()
- end
- --------------------[ EXTERNAL DATA LOCATING FUNCTIONS ]-----------------------------
- function removeElement(Table, Element) --removes the first instance of Element from Table
- for i, v in pairs(Table) do
- if v == Element then
- table.remove(Table, i)
- break
- end
- end
- return Table
- end
- function findFirstClass(Object, Class)
- local foundObject = nil
- for _, Obj in pairs(Object:GetChildren()) do
- if Obj.ClassName == Class then
- foundObject = Obj
- break
- end
- end
- return foundObject
- end
- function isIgnored(Obj, Table)
- for _,v in pairs(Table) do
- if Obj == v or Obj:IsDescendantOf(v) then
- return true
- end
- end
- return false
- end
- function GetHitSurfaceCFrame(HitPos,Obj)
- local SurfaceCF = {
- {"Back",Obj.CFrame * CF(0,0,Obj.Size.z)};
- {"Bottom",Obj.CFrame * CF(0,-Obj.Size.y,0)};
- {"Front",Obj.CFrame * CF(0,0,-Obj.Size.z)};
- {"Left",Obj.CFrame * CF(-Obj.Size.x,0,0)};
- {"Right",Obj.CFrame * CF(Obj.Size.x,0,0)};
- {"Top",Obj.CFrame * CF(0,Obj.Size.y,0)}
- }
- local ClosestDist = HUGE
- local ClosestSurface = nil
- for _,v in pairs(SurfaceCF) do
- local SurfaceDist = (HitPos - v[2].p).magnitude
- if SurfaceDist < ClosestDist then
- ClosestDist = SurfaceDist
- ClosestSurface = v
- end
- end
- return ClosestSurface[2]
- end
- function AdvRayCast(Origin, Direction, Dist, CustomIgnore)
- local NewIgnore = (CustomIgnore and CustomIgnore or Ignore)
- local NewRay = Ray.new(Origin, Direction * (Dist > 999 and 999 or Dist))
- local HitObj, HitPos = game.Workspace:FindPartOnRayWithIgnoreList(NewRay, NewIgnore)
- local LastPos = HitPos
- local FinalHitObj, FinalHitPos = nil, nil
- local RepTimes = math.floor(Dist / 999)
- if (not HitObj) and (Dist > 999) then
- for i = 0, RepTimes do
- local NewDist = (i == RepTimes and (Dist - (LastPos - Origin).magnitude) or 999)
- local Ray2 = Ray.new(LastPos, Direction * NewDist)
- local HitObj2, HitPos2 = game.Workspace:FindPartOnRayWithIgnoreList(Ray2, NewIgnore)
- if i ~= RepTimes then
- if HitObj2 then
- FinalHitObj, FinalHitPos = HitObj2, HitPos2
- break
- end
- elseif i == RepTimes then
- FinalHitObj, FinalHitPos = HitObj2, HitPos2
- end
- LastPos = HitPos2
- end
- return FinalHitObj, FinalHitPos
- elseif HitObj or (Dist <= 999) then
- return HitObj, HitPos
- end
- end
- --------------------[ JUMPING ANIMATION ]---------------------------------------------
- function onFall(initialVelocity)
- spawn(function()
- local velocityAlpha = math.max(math.min(initialVelocity / Humanoid.JumpPower, 1), 0)
- local startJumpPos = jumpAnim.Pos
- local startJumpRot = jumpAnim.Rot
- local endJumpPos = 0.04 * S.fallSettings.fallMultiplier * velocityAlpha
- local endJumpRot = RAD(4) * S.fallSettings.fallMultiplier * velocityAlpha
- local t0 = tick()
- while true do
- RS.Heartbeat:wait()
- local Alpha = math.min((tick() - t0) / 0.15, 1) * 90
- if onGround then break end
- jumpAnim.Pos = numLerp(startJumpPos, endJumpPos, Sine(Alpha))
- jumpAnim.Rot = numLerp(startJumpRot, endJumpRot, Sine(Alpha))
- if Alpha == 90 then break end
- end
- startJumpPos = endJumpPos
- startJumpRot = endJumpRot
- endJumpPos = -0.08 * S.fallSettings.fallMultiplier
- endJumpRot = -RAD(8) * S.fallSettings.fallMultiplier
- local X = 1
- while true do
- local dt = RS.Heartbeat:wait()
- X = X + (dt * 60) / X
- local Alpha = (X - 1) / 15
- if onGround then break end
- jumpAnim.Pos = numLerp(startJumpPos, endJumpPos, Alpha)
- jumpAnim.Rot = numLerp(startJumpRot, endJumpRot, Alpha)
- end
- end)
- end
- function onLand(fallDist)
- spawn(function()
- local animAlpha = math.min(fallDist, S.fallSettings.maxDist) * (2 / 3)
- local startJumpPos = jumpAnim.Pos
- local startJumpRot = jumpAnim.Rot
- local endJumpPos = animAlpha / 100 * S.fallSettings.landMultiplier * (runReady and 1 or 2)
- local endJumpRot = RAD(animAlpha) * S.fallSettings.landMultiplier * (runReady and 1 or 2)
- local t0 = tick()
- while true do
- RS.Heartbeat:wait()
- local Alpha = math.min((tick() - t0) / 0.2, 1)
- if (not onGround) then break end
- jumpAnim.Pos = numLerp(startJumpPos, endJumpPos, Alpha)
- jumpAnim.Rot = numLerp(startJumpRot, endJumpRot, Alpha)
- if Alpha == 1 then break end
- end
- t0 = tick()
- while true do
- RS.Heartbeat:wait()
- local Alpha = math.min((tick() - t0) / 0.3, 1) * 90
- if (not onGround) then break end
- jumpAnim.Pos = numLerp(endJumpPos, 0, Sine(Alpha))
- jumpAnim.Rot = numLerp(endJumpRot, 0, Sine(Alpha))
- if Alpha == 90 then break end
- end
- end)
- end
- function onHumanoidStateChanged(oldState, newState)
- if newState == Enum.HumanoidStateType.Freefall then
- onGround = false
- if S.fallAnimation then
- onFall(HRP.Velocity.Y)
- while HRP.Velocity.Y > 0 do RS.RenderStepped:wait() end
- startFallHeight = HRP.Position.Y
- end
- elseif oldState == Enum.HumanoidStateType.Freefall then
- onGround = true
- if S.fallAnimation then
- local fallDist = startFallHeight - HRP.Position.Y
- onLand(fallDist)
- end
- end
- end
- --------------------[ CAMERA STEADYING FUNCTIONS ]------------------------------------
- function steadyCamera()
- scopeSteady.Text = "Steadying..."
- scopeSteady.TextColor3 = Color3.new(1, 1, 0)
- camSteady = true
- local originalSway = camSway
- local Increment = 1.5 / 0.6
- local X = 0
- while true do
- RS.RenderStepped:wait()
- local newX = X + Increment
- X = (newX > 90 and 90 or newX)
- if (not steadyKeyPressed) then break end
- camSway = numLerp(originalSway, 0, Sine(X))
- if X == 90 then break end
- end
- while steadyKeyPressed and Aimed do
- if currentSteadyTime > 0 then
- local NewSteadyTime = currentSteadyTime - 1
- currentSteadyTime = (NewSteadyTime < 0 and 0 or NewSteadyTime)
- camSway = 0
- elseif currentSteadyTime == 0 then
- break
- end
- RS.RenderStepped:wait()
- end
- camSteady = false
- spawn(function()
- local Increment = 1.5 / 0.25
- local X = 0
- while true do
- RS.RenderStepped:wait()
- local newX = X + Increment
- X = (newX > 90 and 90 or newX)
- if camSteady then break end
- camSway = numLerp(0, S.scopeSettings.camSwayOnBreath, 1 - COS(RAD(X)))
- if X == 90 then break end
- end
- Increment = 1.5 / S.scopeSettings.breathTime
- X = 0
- while true do
- RS.RenderStepped:wait()
- local newX = X + Increment
- X = (newX > 90 and 90 or newX)
- if camSteady then break end
- camSway = numLerp(S.scopeSettings.camSwayOnBreath, 1, Sine(X))
- if X == 90 then break end
- end
- --[[for X = 0, 90, 1.5 / 0.2 do
- local Alpha = 1 - COS(RAD(X))--math.log10(X) / math.log10(90)
- camSway = numLerp(0, 3, Alpha)
- RS.RenderStepped:wait()
- end]]
- --[[for X = 0, 90, 1.5 / S.scopeSettings.steadyTime do
- if camSteady then break end
- local Alpha = SIN(RAD(X))
- camSway = numLerp(3, 1, Alpha)
- RS.RenderStepped:wait()
- end]]
- end)
- retakeBreath()
- end
- function retakeBreath()
- scopeSteady.Text = "Re-taking Breath"
- scopeSteady.TextColor3 = Color3.new(1, 0, 0)
- takingBreath = true
- local Increment = S.scopeSettings.steadyTime / S.scopeSettings.breathTime
- while takingBreath do
- if currentSteadyTime < maxSteadyTime then
- local newSteadyTime = currentSteadyTime + Increment
- currentSteadyTime = (newSteadyTime > maxSteadyTime and maxSteadyTime or newSteadyTime)
- elseif currentSteadyTime >= maxSteadyTime then
- break
- end
- RS.RenderStepped:wait()
- end
- if takingBreath then
- scopeSteady.Text = "Hold "..convertKey(S.Keys.scopeSteady).." to Steady"
- scopeSteady.TextColor3 = Color3.new(1, 1, 0)
- takingBreath = false
- end
- end
- --------------------[ SPRINTING FUNCTIONS ]-------------------------------------------
- function canRun(midRun)
- return ((Forward and (not Backward)) and
- Walking and (Stamina > 0) and Running and
- Selected and (midRun and true or onGround) and
- runReady and (S.canFireWhileRunning and true or (not Firing))
- )
- end
- function monitorStamina()
- Running = true
- if (not canRun(false)) then
- Running = false
- return
- end
- if Aimed then unAimGun(true) end
- if Stance == 1 or Stance == 2 then Stand() end
- if (not (Reloading and S.reloadSettings.Anim)) then
- if S.canFireWhileRunning then
- tweenJoint(LWeld, armC0[1], S.unAimedC1.leftArm, Sine, 0.4)
- tweenJoint(RWeld, armC0[2], S.unAimedC1.rightArm, Sine, 0.4)
- tweenJoint(Grip, nil, S.unAimedC1.Grip, Sine, 0.4)
- else
- tweenJoint(LWeld, armC0[1], S.runningC1.leftArm, Sine, 0.4)
- tweenJoint(RWeld, armC0[2], S.runningC1.rightArm, Sine, 0.4)
- tweenJoint(Grip, nil, S.runningC1.Grip, Sine, 0.4)
- end
- end
- crossOffset = 50
- while runKeyPressed do
- if canRun(true) then
- if onGround then
- local newStamina = Stamina - 1
- Stamina = (newStamina < 0 and 0 or newStamina)
- end
- else
- break
- end
- RS.RenderStepped:wait()
- end
- Running = false
- if (not Aimed) and (not (Reloading and S.reloadSettings.Anim)) and (not S.canFireWhileRunning) then
- crossOffset = 0
- tweenJoint(LWeld, armC0[1], S.unAimedC1.leftArm, Sine, 0.4)
- tweenJoint(RWeld, armC0[2], S.unAimedC1.rightArm, Sine, 0.4)
- tweenJoint(Grip, nil, S.unAimedC1.Grip, Sine, 0.4)
- end
- rechargeStamina()
- end
- function rechargeStamina()
- chargingStamina = true
- while ((not runKeyPressed) or (Stamina < maxStamina)) and (not Running) do
- if Stamina < maxStamina then
- local newStamina = Stamina + (S.sprintTime / S.staminaCoolTime)
- Stamina = (newStamina > maxStamina and maxStamina or newStamina)
- elseif Stamina >= maxStamina then
- break
- end
- RS.RenderStepped:wait()
- end
- chargingStamina = false
- end
- --------------------[ STANCE FUNCTIONS ]----------------------------------------------
- function Stand(onDeselected)
- local LHip = Torso["Left Hip"]
- local RHip = Torso["Right Hip"]
- LLegWeld.Part1 = nil
- LHip.Part1 = LLeg
- RLegWeld.Part1 = nil
- RHip.Part1 = RLeg
- Stance = 0
- spreadStance = "Stand"
- baseSpread = S.spreadSettings[spreadZoom][spreadStance][spreadMotion]
- if S.stanceSettings.Anim and (not onDeselected) then
- spawn(function()
- local prevStanceSway = stanceSway
- local X = 0
- local Increment = 1.5 / S.stanceSettings.Speed
- while true do
- RS.RenderStepped:wait()
- local newX = X + Increment
- X = (newX > 90 and 90 or newX)
- if Stance ~= 0 then break end
- stanceSway = numLerp(prevStanceSway, 1, Sine(X))
- if X == 90 then break end
- end
- end)
- tweenJoint(ABWeld, CF(), nil, Sine, S.stanceSettings.Speed)
- tweenJoint(LLegWeld, legC0.Stand[1], nil, Sine, S.stanceSettings.Speed)
- tweenJoint(RLegWeld, legC0.Stand[2], nil, Sine, S.stanceSettings.Speed)
- 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)
- 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)
- tweenJoint(Root, CFANG(RAD(-90), 0, RAD(180)), nil, Sine, S.stanceSettings.Speed)
- tweenJoint(headWeld, CF(0, 1.5, 0), nil, Sine, S.stanceSettings.Speed)
- elseif onDeselected or (not S.stanceSettings.Anim) then
- ABWeld.C0 = CF()
- LLegWeld.C0 = legC0.Stand[1]
- RLegWeld.C0 = legC0.Stand[2]
- LHip.C0, LHip.C1 = CF(-1, -1, 0) * CFANG(0, RAD(-90), 0), CF(-0.5, 1, 0) * CFANG(0, RAD(-90), 0)
- 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)
- Root.C0 = CFANG(RAD(-90), 0, RAD(180))
- headWeld.C0 = CF(0, 1.5, 0)
- end
- end
- function Crouch()
- local LHip = Torso["Left Hip"]
- local RHip = Torso["Right Hip"]
- LHip.Part1 = nil
- LLegWeld.Part1 = LLeg
- RHip.Part1 = nil
- RLegWeld.Part1 = RLeg
- Stance = 1
- spreadStance = "Crouch"
- baseSpread = S.spreadSettings[spreadZoom][spreadStance][spreadMotion]
- if S.stanceSettings.Anim then
- spawn(function()
- local prevStanceSway = stanceSway
- local X = 0
- local Increment = 1.5 / S.stanceSettings.Speed
- while true do
- RS.RenderStepped:wait()
- local newX = X + Increment
- X = (newX > 90 and 90 or newX)
- if Stance ~= 1 then break end
- stanceSway = numLerp(prevStanceSway, 0.75, Sine(X))
- if X == 90 then break end
- end
- end)
- tweenJoint(ABWeld, CF(0, 0, -0.05), nil, Sine, S.stanceSettings.Speed)
- tweenJoint(LLegWeld, legC0.Crouch[1], nil, Sine, S.stanceSettings.Speed)
- tweenJoint(RLegWeld, legC0.Crouch[2], nil, Sine, S.stanceSettings.Speed)
- 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)
- 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)
- tweenJoint(Root, CF(0, -1, 0) * CFANG(RAD(-90), 0, RAD(180)), nil, Sine, S.stanceSettings.Speed)
- tweenJoint(headWeld, CF(0, 1.5, 0), nil, Sine, S.stanceSettings.Speed)
- else
- ABWeld.C0 = CF(0, 0, -1 / 16)
- LLegWeld.C0 = legC0.Crouch[1]
- RLegWeld.C0 = legC0.Crouch[2]
- 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))
- 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)
- Root.C0 = CF(0, -1, 0) * CFANG(RAD(-90), 0, RAD(180))
- headWeld.C0 = CF(0, 1.5, 0)
- end
- end
- function Prone()
- local LHip = Torso["Left Hip"]
- local RHip = Torso["Right Hip"]
- LHip.Part1 = nil
- LLegWeld.Part1 = LLeg
- RHip.Part1 = nil
- RLegWeld.Part1 = RLeg
- Stance = 2
- spreadStance = "Prone"
- baseSpread = S.spreadSettings[spreadZoom][spreadStance][spreadMotion]
- if S.stanceSettings.Anim then
- spawn(function()
- local prevStanceSway = stanceSway
- local X = 0
- local Increment = 1.5 / S.stanceSettings.Speed
- while true do
- RS.RenderStepped:wait()
- local newX = X + Increment
- X = (newX > 90 and 90 or newX)
- if Stance ~= 2 then break end
- stanceSway = numLerp(prevStanceSway, 0.5, Sine(X))
- if X == 90 then break end
- end
- end)
- tweenJoint(ABWeld, CF(0, 0, -0.1), nil, Sine, S.stanceSettings.Speed)
- tweenJoint(LLegWeld, legC0.Prone[1], nil, Sine, S.stanceSettings.Speed)
- tweenJoint(RLegWeld, legC0.Prone[2], nil, Sine, S.stanceSettings.Speed)
- tweenJoint(Root, CF(0, -2.5, 1) * CFANG(RAD(180), 0, RAD(180)), nil, Sine, S.stanceSettings.Speed)
- tweenJoint(headWeld, CF(0, 1, 1) * CFANG(RAD(90), 0, 0), nil, Sine, S.stanceSettings.Speed)
- else
- ABWeld.C0 = CF(0, 0, -1 / 8)
- LLegWeld.C0 = legC0.Prone[1]
- RLegWeld.C0 = legC0.Prone[2]
- Root.C0 = CF(0, -2.5, 1) * CFANG(RAD(180), 0, RAD(180))
- headWeld.C0 = CF(0, 1, 1) * CFANG(RAD(90), 0, 0)
- end
- end
- function Dive()
- onGround = false
- local diveDirection = (HRP.CFrame * CFANG(S.diveSettings.Angle, 0, 0)).lookVector * S.walkSpeeds.Sprinting * S.diveSettings.Force
- local BF = Instance.new("BodyForce")
- BF.force = diveDirection + Vector3.new(0, playerMass * 196.2, 0)
- BF.Parent = HRP
- --[[spawn(function()
- HRP.Velocity = HRP.CFrame.lookVector * 60 + V3(0, 40, 0)
- wait(0.1)
- HRP.Velocity = HRP.CFrame.lookVector * 70 + V3(0, 30, 0)
- wait(0.4)
- HRP.Velocity = HRP.CFrame.lookVector * 30 + V3(0, -10, 0)
- end)]]
- delay(0.05, function()
- spawn(function()
- while true do
- local newRay = Ray.new(HRP.Position, V3(0, -3.1, 0))
- local H, _ = workspace:FindPartOnRayWithIgnoreList(newRay, Ignore)
- if H then
- onGround = true
- break
- end
- wait()
- end
- end)
- Prone()
- wait(0.1)
- BF:Destroy()
- end)
- end
- --------------------[ MOUSE FUNCTIONS ]-----------------------------------------------
- function onMB1Down()
- MB1Down = true
- firstShot = true
- if fireFunction then
- fireFunction()
- end
- end
- function onMB1Up()
- MB1Down = false
- lowerSpread()
- end
- function onMB2Down()
- if S.aimSettings.holdToADS then
- if (not AimingIn) and (not Aimed) then
- AimingIn = true
- aimGun()
- AimingIn = false
- end
- else
- if Aimed then
- unAimGun()
- else
- aimGun()
- end
- end
- end
- function onMB2Up()
- if S.aimSettings.holdToADS then
- if (not AimingOut) and Aimed then
- AimingOut = true
- unAimGun()
- AimingOut = false
- end
- end
- end
- function onScrollUp()
- local newAimSensitivity = aimSensitivity + S.sensitivitySettings.Increment
- aimSensitivity = (
- newAimSensitivity < S.sensitivitySettings.Min and S.sensitivitySettings.Min or
- newAimSensitivity > S.sensitivitySettings.Max and S.sensitivitySettings.Max or
- newAimSensitivity
- )
- mouseSensitivity = (Aimed and aimSensitivity or mouseSensitivity)
- Sens.Text = "S: "..aimSensitivity
- if mainGUI:IsDescendantOf(game) then
- Sens.Visible = true
- local t0 = tick()
- lastSensUpdate = t0
- wait(0.3)
- if lastSensUpdate <= t0 then
- Sens.Visible = false
- end
- end
- end
- function onScrollDown()
- local newAimSensitivity = aimSensitivity - S.sensitivitySettings.Increment
- aimSensitivity = (
- newAimSensitivity < S.sensitivitySettings.Min and S.sensitivitySettings.Min or
- newAimSensitivity > S.sensitivitySettings.Max and S.sensitivitySettings.Max or
- newAimSensitivity
- )
- mouseSensitivity = (Aimed and aimSensitivity or mouseSensitivity)
- Sens.Text = "S: "..aimSensitivity
- if mainGUI:IsDescendantOf(game) then
- Sens.Visible = true
- local t0 = tick()
- lastSensUpdate = t0
- wait(0.3)
- if lastSensUpdate <= t0 then
- Sens.Visible = false
- end
- end
- end
- --------------------[ KEYBOARD FUNCTIONS ]--------------------------------------------
- function keyDown(K)
- local Key = string.lower(K)
- if Key == S.Keys.lowerStance and S.canChangeStance then
- if (not Running) then
- if Stance == 0 then
- if S.stanceSettings.Stances.Crouch then
- Crouch()
- elseif S.stanceSettings.Stances.Prone then
- Prone()
- end
- elseif Stance == 1 then
- if S.stanceSettings.Stances.Prone then
- Prone()
- end
- end
- elseif S.dolphinDive then
- wait()
- if Humanoid:GetState() ~= Enum.HumanoidStateType.Freefall and (not UIS:IsKeyDown("Space")) and runReady then
- local tempConnection = Humanoid.Changed:connect(function()
- Humanoid.Jump = false
- end)
- runReady = false
- Dive()
- Running = false
- wait(S.diveSettings.rechargeTime)
- tempConnection:disconnect()
- runReady = true
- end
- end
- end
- if Key == S.Keys.raiseStance and S.canChangeStance then
- if (not Running) then
- if Stance == 2 then
- if S.stanceSettings.Stances.Crouch then
- Crouch()
- else
- Stand()
- end
- elseif Stance == 1 then
- Stand()
- end
- end
- end
- if Key == S.Keys.ADS then
- if S.aimSettings.holdToADS then
- if (not AimingIn) and (not Aimed) then
- AimingIn = true
- aimGun()
- AimingIn = false
- end
- else
- if Aimed then
- unAimGun()
- else
- aimGun()
- end
- end
- end
- if Key == S.Keys.selectFire and S.selectFire then
- if canSelectFire then
- canSelectFire = false
- rawFireMode = rawFireMode + 1
- modeGUI.Text = Modes[((rawFireMode - 1) % numModes) + 1]
- if modeGUI.Text == "AUTO" then
- fireFunction = autoFire
- elseif modeGUI.Text == "BURST" then
- fireFunction = burstFire
- elseif modeGUI.Text == "SEMI" then
- fireFunction = semiFire
- else
- fireFunction = nil
- end
- local speedAlpha = S.selectFireSettings.animSpeed / 0.6
- if S.selectFireSettings.GUI then
- spawn(function()
- fireSelect.Visible = true
- local prevRawFireMode = rawFireMode
- local Increment = 1.5 / (speedAlpha * 0.25)
- local X = 0
- wait(speedAlpha * 0.1)
- while true do
- RS.RenderStepped:wait()
- local newX = X + Increment
- X = (newX > 90 and 90 or newX)
- if prevRawFireMode ~= rawFireMode then break end
- updateModeLabels(rawFireMode - 1, rawFireMode, X)
- if X == 90 then break end
- end
- wait(speedAlpha * 0.25)
- fireSelect.Visible = false
- end)
- end
- if S.selectFireSettings.Animation and (not Aimed) and (not isRunning) and (not isCrawling) then
- spawn(function()
- local sequenceTable = {
- function()
- tweenJoint(RWeld2, nil, CFANG(0, RAD(5), 0), Sine, speedAlpha * 0.15)
- tweenJoint(LWeld, armC0[1], CF(0.1, 1, -0.3) * CFANG(RAD(-7), 0, RAD(-65)), Linear, speedAlpha * 0.15)
- wait(speedAlpha * 0.2)
- end;
- function()
- tweenJoint(LWeld, armC0[1], CF(0.1, 1, -0.3) * CFANG(RAD(-10), 0, RAD(-65)), Linear, speedAlpha * 0.1)
- wait(speedAlpha * 0.2)
- end;
- function()
- tweenJoint(RWeld2, nil, CF(), Sine, speedAlpha * 0.2)
- tweenJoint(LWeld, armC0[1], S.unAimedC1.leftArm, Sine, speedAlpha * 0.2)
- wait(speedAlpha * 0.2)
- end;
- }
- for _, F in pairs(sequenceTable) do
- if Aimed or isRunning or isCrawling or Reloading then
- break
- end
- F()
- end
- end)
- end
- if S.selectFireSettings.Animation or S.selectFireSettings.GUI then
- wait(S.selectFireSettings.animSpeed)
- end
- canSelectFire = true
- end
- end
- if Key == S.Keys.Reload then
- if (not Reloading) and (not isCrawling) then
- Reload()
- end
- end
- if Key == S.Keys.Sprint then
- runKeyPressed = true
- if runReady then
- 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
- monitorStamina()
- end
- end
- end
- if Key == S.Keys.scopeSteady then
- steadyKeyPressed = true
- if Aimed and (not Aiming) then
- takingBreath = false
- steadyCamera()
- end
- end
- for _, PTable in pairs(Plugins.KeyDown) do
- if Key == string.lower(PTable.Key) then
- spawn(function()
- PTable.Plugin()
- end)
- end
- end
- end
- function keyUp(K)
- local Key = string.lower(K)
- if Key == S.Keys.ADS then
- if S.aimSettings.holdToADS then
- if (not AimingOut) and Aimed then
- AimingOut = true
- unAimGun()
- AimingOut = false
- end
- end
- end
- if Key == S.Keys.Sprint then
- runKeyPressed = false
- Running = false
- if (not chargingStamina) then
- rechargeStamina()
- end
- end
- if Key == S.Keys.scopeSteady then
- steadyKeyPressed = false
- end
- for _, PTable in pairs(Plugins.KeyUp) do
- if Key == string.lower(PTable.Key) then
- spawn(function()
- PTable.Plugin()
- end)
- end
- end
- end
- --------------------[ END FUNCTIONS ]-------------------------------------------------
- --------------------------------------------------------------------------------------
- --------------------[ PRE-CONNECTIONS ]-----------------------------------------------
- --------------------------------------------------------------------------------------
- local function updateAnimVars()
- wait()
- Forward = (UIS:IsKeyDown("W") or UIS:IsKeyDown("Up"))
- Backward = (UIS:IsKeyDown("S") or UIS:IsKeyDown("Down"))
- local Right = UIS:IsKeyDown("D")
- local Left = UIS:IsKeyDown("A")
- local walkingForward = (Forward and (not Backward))
- local walkingBackward = ((not Forward) and Backward)
- local walkingRight = (Right and (not Left))
- local walkingLeft = ((not Right) and Left)
- if (Forward or Backward or Right or Left) then
- Walking, Idling = true, false
- if (not Running) and (not Aimed) then
- spreadMotion = "Moving"
- baseSpread = S.spreadSettings[spreadZoom][spreadStance][spreadMotion]
- end
- elseif (not (Forward and Backward and Right and Left)) then
- Walking, Idling = false, true
- if (not Aimed) then
- spreadMotion = "Idling"
- baseSpread = S.spreadSettings[spreadZoom][spreadStance][spreadMotion]
- end
- end
- local newArmTilt = (
- ((walkingForward or walkingBackward) and walkingRight) and 2.5 or
- ((walkingForward or walkingBackward) and walkingLeft) and -2.5 or
- ((not (walkingForward and walkingBackward)) and walkingRight) and 5 or
- ((not (walkingForward and walkingBackward)) and walkingLeft) and -5 or 0
- )
- local newMoveAng = (
- (walkingForward and (not (walkingRight or walkingLeft))) and 0 or
- (walkingForward and walkingRight) and RAD(-45) or
- ((not (walkingForward or walkingBackward)) and walkingRight) and RAD(-90) or
- (walkingBackward and walkingRight) and RAD(-135) or
- (walkingBackward and (not (walkingRight or walkingLeft))) and (moveAng < 0 and RAD(-180) or RAD(180)) or
- (walkingBackward and walkingLeft) and RAD(135) or
- ((not (walkingForward or walkingBackward)) and walkingLeft) and RAD(90) or
- (walkingForward and walkingLeft) and RAD(45) or 0
- )
- local newAnimCode = math.random(-1e9, 1e9)
- animCode = newAnimCode
- local startTilt = armTilt
- local startAng = (ABS(moveAng) == RAD(180)) and (newMoveAng > 0 and RAD(180) or RAD(-180)) or moveAng
- local Increment = (startTilt == newArmTilt and 1.5 / 0.7 or 1.5 / (0.35 * ABS(startTilt - newArmTilt) / 5))
- local X = 0
- while true do
- RS.RenderStepped:wait()
- local newX = X + Increment
- X = (newX > 90 and 90 or newX)
- if animCode ~= newAnimCode then break end
- armTilt = numLerp(startTilt, newArmTilt, Sine(X))
- moveAng = numLerp(startAng, newMoveAng, Sine(X))
- if X == 90 then break end
- end
- end
- M2.KeyDown:connect(updateAnimVars)
- M2.KeyUp:connect(updateAnimVars)
- updateAnimVars()
- --------------------------------------------------------------------------------------
- --------------------[ TOOL SELECTION AND DESELECTION ]--------------------------------
- --------------------------------------------------------------------------------------
- function onEquipped()
- wait()
- if Humanoid.Health ~= 0 and (not Selected) and Gun.Parent == Char then
- Selected = true
- breakReload = false
- equipAnimPlaying = true
- math.randomseed(tick()) --This sets a new seed for the random function each time you select the gun
- --------------------[ FAILSAFE RESETING ]-------------------------------------
- for _, GM in pairs(ignoreModel:GetChildren()) do
- if GM.Name == "gunIgnore_"..Player.Name then
- GM:Destroy()
- end
- end
- for _, c in pairs(Connections) do
- c:disconnect()
- end
- Connections = {}
- --------------------[ REMOTE GUN SETUP ]--------------------------------------
- --[[local Vars = {
- ignoreModel = ignoreModel;
- Humanoid = Humanoid;
- Shoulders = Shoulders;
- Torso = Torso;
- Head = Head;
- armC0 = armC0;
- leftArmC1 = S.equipSettings.leftArmC1;
- rightArmC1 = S.equipSettings.rightArmC1;
- LArm = LArm;
- RArm = RArm;
- gunParts = gunParts;
- Handle = Handle;
- }
- gunIgnore, playerFolder, headWeld, headWeld2, animWeld, ABWeld, LWeld, RWeld, LWeld2, RWeld2, LLegWeld, RLegWeld, gunParts2 = gunSetup:InvokeServer(Vars)]]
- --------------------[ CREATING IGNORE MODELS ]--------------------------------
- gunIgnore = Instance.new("Model")
- gunIgnore.Name = "gunIgnore_"..Player.Name
- gunIgnore.Parent = ignoreModel
- --------------------[ MODIFYING THE PLAYER ]----------------------------------
- Player.CameraMode = Enum.CameraMode.LockFirstPerson
- Cam.CameraType = Enum.CameraType.Scriptable
- Cam.FieldOfView = 80
- UIS.MouseBehavior = Enum.MouseBehavior.LockCenter
- UIS.MouseIconEnabled = false
- local initialX, initialY = getYawPitch(Cam.CoordinateFrame)
- camAng = -VEC2(initialX, initialY)
- mainGUI.Parent = Player.PlayerGui
- setUpGUI()
- updateHealth()
- if S.selectFire then
- local currentMode = Modes[((rawFireMode - 1) % numModes) + 1]
- if currentMode == "AUTO" then
- fireFunction = autoFire
- elseif currentMode == "BURST" then
- fireFunction = burstFire
- elseif currentMode == "SEMI" then
- fireFunction = semiFire
- else
- fireFunction = nil
- end
- else
- if S.gunType.Semi then
- fireFunction = semiFire
- elseif S.gunType.Auto then
- fireFunction = autoFire
- elseif S.gunType.Burst then
- fireFunction = burstFire
- else
- fireFunction = nil
- end
- end
- changePlayerTrans(Char, 1)
- Humanoid.AutoRotate = false
- Shoulders.Right.Part1 = nil
- Shoulders.Left.Part1 = nil
- playerFolder = Instance.new("Model")
- playerFolder.Name = "playerFolder"
- playerFolder.Parent = gunIgnore
- local headBase = Instance.new("Part")
- headBase.Transparency = 1
- headBase.Name = "headBase"
- headBase.CanCollide = false
- headBase.FormFactor = Enum.FormFactor.Custom
- headBase.Size = V3(0.2, 0.2, 0.2)
- headBase.BottomSurface = Enum.SurfaceType.Smooth
- headBase.TopSurface = Enum.SurfaceType.Smooth
- headBase.Parent = playerFolder
- headWeld = Instance.new("Weld")
- headWeld.Part0 = Torso
- headWeld.Part1 = headBase
- headWeld.C0 = CF(0, 1.5, 0)
- headWeld.Parent = Torso
- headWeld2 = Instance.new("Weld")
- headWeld2.Part0 = headBase
- headWeld2.Part1 = Head
- headWeld2.Parent = headBase
- neckClone = Neck:Clone()
- --[[local stanceBase = Instance.new("Part")
- stanceBase.Transparency = 1
- stanceBase.Name = "stanceBase"
- stanceBase.CanCollide = false
- stanceBase.FormFactor = Enum.FormFactor.Custom
- stanceBase.Size = V3(0.2, 0.2, 0.2)
- stanceBase.BottomSurface = Enum.SurfaceType.Smooth
- stanceBase.TopSurface = Enum.SurfaceType.Smooth
- stanceBase.Parent = playerFolder
- stanceWeld = Instance.new("Weld")
- stanceWeld.Part0 = stanceBase
- stanceWeld.Part1 = Torso
- stanceWeld.Parent = stanceBase]]
- local animBase = Instance.new("Part")
- animBase.Transparency = 1
- animBase.Name = "animBase"
- animBase.CanCollide = false
- animBase.FormFactor = Enum.FormFactor.Custom
- animBase.Size = V3(0.2, 0.2, 0.2)
- animBase.BottomSurface = Enum.SurfaceType.Smooth
- animBase.TopSurface = Enum.SurfaceType.Smooth
- animBase.Parent = playerFolder
- animWeld = Instance.new("Weld")
- animWeld.Part0 = animBase
- animWeld.Part1 = headBase
- animWeld.Parent = animBase
- local ArmBase = Instance.new("Part")
- ArmBase.Transparency = 1
- ArmBase.Name = "ArmBase"
- ArmBase.CanCollide = false
- ArmBase.FormFactor = Enum.FormFactor.Custom
- ArmBase.Size = V3(0.2, 0.2, 0.2)
- ArmBase.BottomSurface = Enum.SurfaceType.Smooth
- ArmBase.TopSurface = Enum.SurfaceType.Smooth
- ArmBase.Parent = playerFolder
- ABWeld = Instance.new("Weld")
- ABWeld.Part0 = ArmBase
- ABWeld.Part1 = animBase
- ABWeld.Parent = ArmBase
- local LArmBase = Instance.new("Part")
- LArmBase.Transparency = 1
- LArmBase.Name = "LArmBase"
- LArmBase.CanCollide = false
- LArmBase.FormFactor = Enum.FormFactor.Custom
- LArmBase.Size = V3(0.2, 0.2, 0.2)
- LArmBase.BottomSurface = Enum.SurfaceType.Smooth
- LArmBase.TopSurface = Enum.SurfaceType.Smooth
- LArmBase.Parent = playerFolder
- local RArmBase = Instance.new("Part")
- RArmBase.Transparency = 1
- RArmBase.Name = "RArmBase"
- RArmBase.CanCollide = false
- RArmBase.FormFactor = Enum.FormFactor.Custom
- RArmBase.Size = V3(0.2, 0.2, 0.2)
- RArmBase.BottomSurface = Enum.SurfaceType.Smooth
- RArmBase.TopSurface = Enum.SurfaceType.Smooth
- RArmBase.Parent = playerFolder
- LWeld = Instance.new("Weld")
- LWeld.Name = "LWeld"
- LWeld.Part0 = ArmBase
- LWeld.Part1 = LArmBase
- LWeld.C0 = armC0[1]
- LWeld.C1 = S.equipSettings.leftArmC1
- LWeld.Parent = ArmBase
- RWeld = Instance.new("Weld")
- RWeld.Name = "RWeld"
- RWeld.Part0 = ArmBase
- RWeld.Part1 = RArmBase
- RWeld.C0 = armC0[2]
- RWeld.C1 = S.equipSettings.rightArmC1
- RWeld.Parent = ArmBase
- LWeld2 = Instance.new("Weld")
- LWeld2.Name = "LWeld"
- LWeld2.Part0 = LArmBase
- LWeld2.Part1 = LArm
- LWeld2.Parent = LArmBase
- RWeld2 = Instance.new("Weld")
- RWeld2.Name = "RWeld"
- RWeld2.Part0 = RArmBase
- RWeld2.Part1 = RArm
- RWeld2.Parent = RArmBase
- LLegWeld = Instance.new("Weld")
- LLegWeld.Name = "LLegWeld"
- LLegWeld.Part0 = Torso
- LLegWeld.Part1 = nil
- LLegWeld.C0 = CF(-0.5, -2, 0)
- LLegWeld.Parent = Torso
- RLegWeld = Instance.new("Weld")
- RLegWeld.Name = "RLegWeld"
- RLegWeld.Part0 = Torso
- RLegWeld.Part1 = nil
- RLegWeld.C0 = CF(0.5, -2, 0)
- RLegWeld.Parent = Torso
- if S.playerArms then
- armModel = Instance.new("Model", workspace.FilteringEnabled and playerFolder or Cam)
- fakeLArm = LArm:Clone()
- fakeLArm.Parent = armModel
- fakeLArm.Transparency = S.fakeArmSettings.Transparency
- fakeLArm.CanCollide = false
- fakeLArm.Size = S.fakeArmSettings.armSize
- fakeLArm:BreakJoints()
- --LArm.Transparency = 1
- local fakeLWeld = Instance.new("Weld")
- fakeLWeld.Part0 = fakeLArm
- fakeLWeld.Part1 = LArm
- fakeLWeld.Parent = fakeLArm
- fakeRArm = RArm:Clone()
- fakeRArm.Parent = armModel
- fakeRArm.Transparency = S.fakeArmSettings.Transparency
- fakeRArm.CanCollide = false
- fakeRArm.Size = S.fakeArmSettings.armSize
- fakeRArm:BreakJoints()
- --RArm.Transparency = 1
- local fakeRWeld = Instance.new("Weld")
- fakeRWeld.Part0 = fakeRArm
- fakeRWeld.Part1 = RArm
- fakeRWeld.Parent = fakeRArm
- Instance.new("Humanoid", armModel)
- if S.fakeArmSettings.characterMeshes then
- for _,Obj in pairs(Char:GetChildren()) do
- if Obj:IsA("CharacterMesh") then
- Obj:Clone().Parent = armModel
- end
- end
- end
- for _,Obj in pairs(Char:GetChildren()) do
- if Obj:IsA("Shirt") then
- Obj:Clone().Parent = armModel
- end
- end
- else
- armTable = createArms()
- if workspace.FilteringEnabled then
- armTable[1].Model.Parent = playerFolder
- armTable[2].Model.Parent = playerFolder
- else
- armTable[1].Model.Parent = Cam--playerFolder
- armTable[2].Model.Parent = Cam--playerFolder
- end
- fakeLArm = armTable[1].armPart
- --LArm.Transparency = 1
- local fakeLWeld = Instance.new("Weld")
- fakeLWeld.Part0 = fakeLArm
- fakeLWeld.Part1 = LArm
- fakeLWeld.Parent = fakeLArm
- fakeRArm = armTable[2].armPart
- --RArm.Transparency = 1
- local fakeRWeld = Instance.new("Weld")
- fakeRWeld.Part0 = fakeRArm
- fakeRWeld.Part1 = RArm
- fakeRWeld.Parent = fakeRArm
- end
- --------------------[ MODIFYING THE GUN ]-------------------------------------
- for _, Tab in pairs(gunParts) do
- local Weld = Instance.new("Weld")
- Weld.Name = "MainWeld"
- Weld.Part0 = Handle
- Weld.Part1 = Tab.Obj
- Weld.C0 = Tab.Obj.weldCF.Value
- Weld.Parent = Handle
- Tab.Weld = Weld
- end
- Grip = RArm:WaitForChild("RightGrip")
- local handleCF = Torso.CFrame * CF(0, 0.5, 0) * armC0[2] * S.aimedC1.rightArm:inverse() * Grip.C0
- local handleOffset = AimPart.CFrame:toObjectSpace(Handle.CFrame)
- aimedGripCF = ((Torso.CFrame * CF(headOffset.X, headOffset.Y, 0)) * handleOffset):toObjectSpace(handleCF)
- Grip.C1 = S.equipSettings.GripC1
- --------------------[ RUNNING PLUGINS ]---------------------------------------
- for _, Plugin in pairs(Plugins.OnEquipped) do
- spawn(function()
- Plugin()
- end)
- end
- --------------------[ GETTING PLAYER MASS ]-----------------------------------
- local connectedParts = HRP:GetConnectedParts(true)
- for _, v in pairs(connectedParts) do
- if v:IsA("BasePart") then
- playerMass = playerMass + v:GetMass()
- end
- end
- --------------------[ CONNECTIONS ]-------------------------------------------
- INSERT(Connections, Humanoid.Died:connect(function()
- onUnequipped(true)
- end))
- INSERT(Connections, Humanoid.Jumping:connect(function()
- if Stance ~= 0 then
- Stand()
- end
- end))
- INSERT(Connections, Humanoid.StateChanged:connect(onHumanoidStateChanged))
- INSERT(Connections, Humanoid.HealthChanged:connect(updateHealth))
- INSERT(Connections, M2.Button1Down:connect(onMB1Down))
- INSERT(Connections, M2.Button1Up:connect(onMB1Up))
- INSERT(Connections, M2.Button2Down:connect(onMB2Down))
- INSERT(Connections, M2.Button2Up:connect(onMB2Up))
- INSERT(Connections, M2.KeyDown:connect(keyDown))
- INSERT(Connections, M2.KeyUp:connect(keyUp))
- if S.sensitivitySettings.scrollToChange then
- INSERT(Connections, M2.WheelForward:connect(onScrollUp))
- INSERT(Connections, M2.WheelBackward:connect(onScrollDown))
- end
- if S.AutoKnife then
- INSERT(Connections, RS.Stepped:connect(function()
- local H, P = AdvRayCast(Head.CFrame.p, Head.CFrame.lookVector, S.AutoKnifeDist, nil)
- if H then
- local HitHuman = findFirstClass(H.Parent, "Humanoid")
- if HitHuman and isEnemy(HitHuman) and HitHuman.Health ~= 0 then
- Knife()
- end
- end
- end))
- end
- INSERT(Connections, UIS.InputChanged:connect(function(inputObj)
- if inputObj.UserInputType == Enum.UserInputType.MouseMovement then
- local rawCamAng = camAng - (VEC2(RAD(inputObj.Delta.x), RAD(inputObj.Delta.y)) * mouseSensitivity * 0.25)
- camAng = VEC2(rawCamAng.x, (rawCamAng.y > RAD(80) and RAD(80) or rawCamAng.y < RAD(-80) and RAD(-80) or rawCamAng.y))
- desiredXOffset = math.min(math.max(inputObj.Delta.x, -S.momentumSettings.maxInput), S.momentumSettings.maxInput)
- desiredYOffset = math.min(math.max(inputObj.Delta.y, -S.momentumSettings.maxInput), S.momentumSettings.maxInput)
- end
- end))
- INSERT(Connections, M2.Idle:connect(function(inputObj)
- desiredXOffset = 0
- desiredYOffset = 0
- end))
- INSERT(Connections, RS.Stepped:connect(function()
- if tick() - lastBeat > (Humanoid.Health / 75) then
- lastBeat = tick()
- HUD.Health.Tray.Beat:TweenPosition(
- UDim2.new(0, -21, 0, 0),
- Enum.EasingDirection.Out,
- Enum.EasingStyle.Linear,
- 0.7 - ((100 - Humanoid.Health) / 400),
- false,
- function()
- HUD.Health.Tray.Beat.Position = UDim2.new(1, 0, 0, 0)
- end
- )
- end
- end))
- INSERT(Connections, RS.RenderStepped:connect(function()
- --Main animation
- local animC0, animC1 = getAnimCF()
- animWeld.C0 = animC0
- animWeld.C1 = animC1
- --Camera updating
- renderCamera()
- end))
- --------------------[ ANIMATE GUN ]-------------------------------------------
- tweenJoint(LWeld, nil, S.unAimedC1.leftArm, Sine, S.equipSettings.Time)
- tweenJoint(RWeld, nil, S.unAimedC1.rightArm, Sine, S.equipSettings.Time)
- tweenJoint(Grip, nil, S.unAimedC1.Grip, Sine, S.equipSettings.Time)
- spawn(function()
- local T = tick()
- while true do
- if tick() - T > S.equipSettings.Time then break end
- if (not Selected) then break end
- wait()
- end
- equipAnimPlaying = false
- end)
- Animate()
- end
- end
- function onUnequipped(deleteTool)
- if Selected then
- Selected = false
- breakReload = true
- --------------------[ RUNNING PLUGINS ]---------------------------------------
- for _, Plugin in pairs(Plugins.OnUnEquipped) do
- spawn(function()
- Plugin()
- end)
- end
- --------------------[ MODIFYING THE PLAYER ]----------------------------------
- Cam.FieldOfView = 70
- Cam.CameraType = Enum.CameraType.Custom
- UIS.MouseBehavior = Enum.MouseBehavior.Default
- UIS.MouseIconEnabled = true
- Player.CameraMode = Enum.CameraMode.Classic
- if armTable then
- armTable[1].Model:Destroy()
- armTable[2].Model:Destroy()
- elseif armModel then
- armModel:Destroy()
- end
- LLegWeld:Destroy()
- RLegWeld:Destroy()
- changePlayerTrans(Char, 0)
- mainGUI.Parent = script
- Shoulders.Right.Part1 = RArm
- Shoulders.Left.Part1 = LArm
- neckClone.Parent = Torso
- headWeld:Destroy()
- Humanoid.WalkSpeed = 16
- Humanoid.AutoRotate = true
- --------------------[ RESETING THE TOOL ]-------------------------------------
- gunIgnore:Destroy()
- mouseSensitivity = S.sensitivitySettings.Default
- MB1Down = false
- playerMass = 0
- Aimed = false
- camOffsets = {
- guiScope = {
- Rot = V3();
- };
- Reload = {
- Rot = V3();
- Code = nil;
- };
- Recoil = {
- Rot = V3();
- Code = nil;
- };
- }
- recoilAnim = {
- Pos = V3();
- Rot = V3();
- Code = nil;
- }
- --Setting the aim variables to unaimed
- spreadZoom = "unAimed"
- scopeMain.Visible = false
- scopeSteady.Visible = false
- aimAlpha = 0
- aimHeadOffset = 0
- jumpAnimMultiplier = 1
- translationDivisor = 7
- rotationMultiplier = S.momentumSettings.Amplitude.unAimed
- armTiltMultiplier = 1
- Scope.BackgroundTransparency = 1
- if S.guiScope then
- spawn(function()
- for _, Obj in pairs(Gun:GetChildren()) do
- if Obj:IsA("BasePart") then
- Obj.LocalTransparencyModifier = 0
- end
- end
- end)
- end
- onGround = true
- for _, Tab in pairs(gunParts) do
- Tab.Weld:Destroy()
- Tab.Weld = nil
- end
- for _,c in pairs(Connections) do
- c:disconnect()
- end
- Connections = {}
- if deleteTool then
- Cam:ClearAllChildren()
- Gun:Destroy()
- end
- wait() --This is here in case you dolphin dived and deselected the tool instantly
- if S.stanceSettings.standOnDeselect and Stance ~= 0 then
- crawlCamRot = 0
- isCrawling = false
- stanceSway = 1
- spreadStance = "Stand"
- Stand(true)
- end
- baseSpread = S.spreadSettings[spreadZoom][spreadStance][spreadMotion]
- end
- end
- Gun.Equipped:connect(onEquipped)
- Gun.Unequipped:connect(function() onUnequipped(false) end)
- --------------------------------------------------------------------------------------
- --------------------[ END PROGRAM ]---------------------------------------------------
- --------------------------------------------------------------------------------------
- end))
- IntValue2.Name = "ignoreCode"
- IntValue2.Parent = LocalScript1
- Folder3.Name = "Server_Scripts"
- Folder3.Parent = LocalScript1
- ScreenGui4.Name = "mainGUI"
- ScreenGui4.Parent = LocalScript1
- ImageLabel5.Name = "hitMarker"
- ImageLabel5.Parent = ScreenGui4
- ImageLabel5.Transparency = 1
- ImageLabel5.Size = UDim2.new(0, 26, 0, 26)
- ImageLabel5.Position = UDim2.new(0.5, -13, 0.5, -31)
- ImageLabel5.Visible = false
- ImageLabel5.BackgroundTransparency = 1
- ImageLabel5.ZIndex = 10
- ImageLabel5.Image = "http://www.roblox.com/asset/?id=121173757"
- NumberValue6.Name = "lastMark"
- NumberValue6.Parent = ImageLabel5
- Frame7.Name = "crossHair"
- Frame7.Parent = ScreenGui4
- Frame7.Position = UDim2.new(0.5, 0, 0.5, -18)
- Frame7.BackgroundColor3 = Color3.new(1, 1, 1)
- Frame7.BorderColor3 = Color3.new(0, 0, 0)
- Frame7.BorderSizePixel = 0
- ImageLabel8.Parent = Frame7
- ImageLabel8.Transparency = 1
- ImageLabel8.Size = UDim2.new(0, 300, 0, 300)
- ImageLabel8.Position = UDim2.new(0, -150, 0, -150)
- ImageLabel8.Visible = false
- ImageLabel8.BackgroundColor3 = Color3.new(1, 1, 1)
- ImageLabel8.BackgroundTransparency = 1
- ImageLabel8.ZIndex = 2
- ImageLabel8.Image = "http://www.roblox.com/asset/?id=68308747"
- TextLabel9.Name = "Reload"
- TextLabel9.Parent = Frame7
- TextLabel9.Transparency = 1
- TextLabel9.Size = UDim2.new(0, 100, 0, 20)
- TextLabel9.Text = "RELOADING..."
- TextLabel9.Position = UDim2.new(0, -50, 0, 70)
- TextLabel9.Visible = false
- TextLabel9.BackgroundColor3 = Color3.new(1, 1, 1)
- TextLabel9.BackgroundTransparency = 1
- TextLabel9.ZIndex = 2
- TextLabel9.Font = Enum.Font.SourceSansBold
- TextLabel9.FontSize = Enum.FontSize.Size18
- TextLabel9.TextColor3 = Color3.new(1, 1, 1)
- TextLabel9.TextStrokeTransparency = 0.5
- Frame10.Name = "C"
- Frame10.Parent = Frame7
- Frame10.Transparency = 1
- Frame10.Size = UDim2.new(0, 4, 0, 500)
- Frame10.Position = UDim2.new(0, -2, 0, 0)
- Frame10.BackgroundColor3 = Color3.new(1, 1, 1)
- Frame10.BackgroundTransparency = 1
- Frame10.ClipsDescendants = true
- TextLabel11.Name = "Line"
- TextLabel11.Parent = Frame10
- TextLabel11.Size = UDim2.new(0, 2, 0, 15)
- TextLabel11.Text = ""
- TextLabel11.Position = UDim2.new(0.5, -1, 0, 10)
- TextLabel11.BackgroundColor3 = Color3.new(1, 1, 1)
- TextLabel11.BorderColor3 = Color3.new(0.392157, 0.392157, 0.392157)
- TextLabel11.Font = Enum.Font.SourceSans
- TextLabel11.FontSize = Enum.FontSize.Size14
- Frame12.Name = "A"
- Frame12.Parent = Frame7
- Frame12.Transparency = 1
- Frame12.Size = UDim2.new(0, 4, 0, 500)
- Frame12.Position = UDim2.new(0, -2, 0, -500)
- Frame12.BackgroundColor3 = Color3.new(1, 1, 1)
- Frame12.BackgroundTransparency = 1
- Frame12.ClipsDescendants = true
- TextLabel13.Name = "Line"
- TextLabel13.Parent = Frame12
- TextLabel13.Size = UDim2.new(0, 2, 0, 15)
- TextLabel13.Text = ""
- TextLabel13.Position = UDim2.new(0.5, -1, 1, -25)
- TextLabel13.BackgroundColor3 = Color3.new(1, 1, 1)
- TextLabel13.BorderColor3 = Color3.new(0.392157, 0.392157, 0.392157)
- TextLabel13.Font = Enum.Font.SourceSans
- TextLabel13.FontSize = Enum.FontSize.Size14
- Frame14.Name = "B"
- Frame14.Parent = Frame7
- Frame14.Transparency = 1
- Frame14.Size = UDim2.new(0, 500, 0, 4)
- Frame14.Position = UDim2.new(0, 0, 0, -2)
- Frame14.BackgroundColor3 = Color3.new(1, 1, 1)
- Frame14.BackgroundTransparency = 1
- Frame14.ClipsDescendants = true
- TextLabel15.Name = "Line"
- TextLabel15.Parent = Frame14
- TextLabel15.Size = UDim2.new(0, 15, 0, 2)
- TextLabel15.Text = ""
- TextLabel15.Position = UDim2.new(0, 10, 0.5, -1)
- TextLabel15.BackgroundColor3 = Color3.new(1, 1, 1)
- TextLabel15.BorderColor3 = Color3.new(0.392157, 0.392157, 0.392157)
- TextLabel15.Font = Enum.Font.SourceSans
- TextLabel15.FontSize = Enum.FontSize.Size14
- Frame16.Name = "D"
- Frame16.Parent = Frame7
- Frame16.Transparency = 1
- Frame16.Size = UDim2.new(0, 500, 0, 4)
- Frame16.Position = UDim2.new(0, -500, 0, -2)
- Frame16.BackgroundColor3 = Color3.new(1, 1, 1)
- Frame16.BackgroundTransparency = 1
- Frame16.ClipsDescendants = true
- TextLabel17.Name = "Line"
- TextLabel17.Parent = Frame16
- TextLabel17.Size = UDim2.new(0, 15, 0, 2)
- TextLabel17.Text = ""
- TextLabel17.Position = UDim2.new(1, -25, 0.5, -1)
- TextLabel17.BackgroundColor3 = Color3.new(1, 1, 1)
- TextLabel17.BorderColor3 = Color3.new(0.392157, 0.392157, 0.392157)
- TextLabel17.Font = Enum.Font.SourceSans
- TextLabel17.FontSize = Enum.FontSize.Size14
- Frame18.Name = "fireSelect"
- Frame18.Parent = ScreenGui4
- Frame18.Transparency = 1
- Frame18.Position = UDim2.new(0.5, 0, 0.5, -18)
- Frame18.Visible = false
- Frame18.BackgroundColor3 = Color3.new(1, 1, 1)
- Frame18.BackgroundTransparency = 1
- Frame19.Name = "Modes"
- Frame19.Parent = Frame18
- Frame19.Transparency = 1
- Frame19.BackgroundColor3 = Color3.new(1, 1, 1)
- Frame19.BackgroundTransparency = 1
- ImageLabel20.Name = "Circle"
- ImageLabel20.Parent = Frame18
- ImageLabel20.Transparency = 1
- ImageLabel20.Size = UDim2.new(0, 120, 0, 120)
- ImageLabel20.Position = UDim2.new(0, -60, 0, -60)
- ImageLabel20.BackgroundColor3 = Color3.new(1, 1, 1)
- ImageLabel20.BackgroundTransparency = 1
- ImageLabel20.Image = "http://www.roblox.com/asset/?id=55754953"
- ImageLabel20.ImageTransparency = 0.5
- ImageLabel21.Name = "Arrow"
- ImageLabel21.Parent = Frame18
- ImageLabel21.Transparency = 1
- ImageLabel21.Size = UDim2.new(0, 40, 0, 20)
- ImageLabel21.Position = UDim2.new(0, -20, 0, -140)
- ImageLabel21.BackgroundColor3 = Color3.new(1, 1, 1)
- ImageLabel21.BackgroundTransparency = 1
- ImageLabel21.Image = "http://www.roblox.com/asset/?id=126877530"
- Frame22.Name = "Scope"
- Frame22.Parent = ScreenGui4
- Frame22.Transparency = 1
- Frame22.Size = UDim2.new(1, 0, 1, 36)
- Frame22.Position = UDim2.new(0, 0, 0, -36)
- Frame22.BackgroundColor3 = Color3.new(0, 0, 0)
- Frame22.BackgroundTransparency = 1
- TextLabel23.Name = "Steady"
- TextLabel23.Parent = Frame22
- TextLabel23.Transparency = 1
- TextLabel23.Size = UDim2.new(0, 120, 0, 20)
- TextLabel23.Text = ""
- TextLabel23.Position = UDim2.new(0.5, -60, 0.5, 50)
- TextLabel23.Visible = false
- TextLabel23.BackgroundColor3 = Color3.new(1, 1, 1)
- TextLabel23.BackgroundTransparency = 1
- TextLabel23.ZIndex = 9
- TextLabel23.Font = Enum.Font.ArialBold
- TextLabel23.FontSize = Enum.FontSize.Size14
- TextLabel23.TextColor3 = Color3.new(1, 1, 0)
- TextLabel23.TextStrokeTransparency = 0
- Frame24.Name = "Main"
- Frame24.Parent = Frame22
- Frame24.Transparency = 1
- Frame24.Size = UDim2.new(1, 0, 1, 0)
- Frame24.Visible = false
- Frame24.BackgroundColor3 = Color3.new(1, 1, 1)
- Frame24.BackgroundTransparency = 1
- ImageLabel25.Name = "ScopeImg2"
- ImageLabel25.Parent = Frame24
- ImageLabel25.Transparency = 1
- ImageLabel25.Size = UDim2.new(0, 20, 0, 20)
- ImageLabel25.Position = UDim2.new(0.5, -10, 0, -10)
- ImageLabel25.BackgroundColor3 = Color3.new(0, 0, 0)
- ImageLabel25.BackgroundTransparency = 1
- ImageLabel25.Image = "http://www.roblox.com/asset/?id=184922644"
- ImageLabel26.Name = "ScopeImg1"
- ImageLabel26.Parent = Frame24
- ImageLabel26.Transparency = 1
- ImageLabel26.Size = UDim2.new(0, 20, 0, 20)
- ImageLabel26.Position = UDim2.new(0.5, -10, 0, -10)
- ImageLabel26.BackgroundColor3 = Color3.new(0, 0, 0)
- ImageLabel26.BackgroundTransparency = 1
- ImageLabel26.Image = "http://www.roblox.com/asset/?id=72002022"
- Frame27.Name = "F2"
- Frame27.Parent = Frame24
- Frame27.Size = UDim2.new(0, 0, 1, 20)
- Frame27.Position = UDim2.new(0, -10, 0, -10)
- Frame27.BackgroundColor3 = Color3.new(0, 0, 0)
- Frame27.BorderColor3 = Color3.new(0, 0, 0)
- Frame27.BorderSizePixel = 0
- Frame28.Name = "F1"
- Frame28.Parent = Frame24
- Frame28.Size = UDim2.new(0, 0, 1, 20)
- Frame28.Position = UDim2.new(0, -10, 0, -10)
- Frame28.BackgroundColor3 = Color3.new(0, 0, 0)
- Frame28.BorderColor3 = Color3.new(0, 0, 0)
- Frame28.BorderSizePixel = 0
- LocalScript29.Name = "Update"
- LocalScript29.Parent = Frame24
- table.insert(cors,sandbox(LocalScript29,function()
- local GUI = script.Parent
- function updateScopeDimension()
- GUI.ScopeImg1.Position = UDim2.new(0.5, -10 - (GUI.AbsoluteSize.y / 2), 0, -10)
- GUI.ScopeImg1.Size = UDim2.new(0, 20 + GUI.AbsoluteSize.y, 0, 20 + GUI.AbsoluteSize.y)
- GUI.ScopeImg2.Position = UDim2.new(0.5, -10 - (GUI.AbsoluteSize.y / 2), 0, -10)
- GUI.ScopeImg2.Size = UDim2.new(0, 20 + GUI.AbsoluteSize.y, 0, 20 + GUI.AbsoluteSize.y)
- GUI.F1.Size = UDim2.new(0, 20 + ((GUI.AbsoluteSize.x - GUI.AbsoluteSize.y) / 2), 1, 20)
- GUI.F2.Size = UDim2.new(0, 20 + ((GUI.AbsoluteSize.x - GUI.AbsoluteSize.y) / 2), 1, 20)
- GUI.F2.Position = UDim2.new(1, -10 - ((GUI.AbsoluteSize.x - GUI.AbsoluteSize.y) / 2), 0, -10)
- end
- wait()
- GUI.Changed:connect(updateScopeDimension)
- updateScopeDimension()
- end))
- TextLabel30.Name = "Sens"
- TextLabel30.Parent = ScreenGui4
- TextLabel30.Transparency = 1
- TextLabel30.Size = UDim2.new(0, 100, 0, 20)
- TextLabel30.Text = "S: 0.3"
- TextLabel30.Position = UDim2.new(0.5, -50, 0.5, 50)
- TextLabel30.Visible = false
- TextLabel30.BackgroundColor3 = Color3.new(1, 1, 1)
- TextLabel30.BackgroundTransparency = 1
- TextLabel30.ZIndex = 10
- TextLabel30.Font = Enum.Font.SourceSansBold
- TextLabel30.FontSize = Enum.FontSize.Size28
- TextLabel30.TextColor3 = Color3.new(1, 1, 1)
- TextLabel30.TextStrokeTransparency = 0
- ImageLabel31.Name = "HUD"
- ImageLabel31.Parent = ScreenGui4
- ImageLabel31.Transparency = 1
- ImageLabel31.Size = UDim2.new(0, 100, 0, 100)
- ImageLabel31.Position = UDim2.new(1, -210, 1, -125)
- ImageLabel31.BackgroundColor3 = Color3.new(1, 1, 1)
- ImageLabel31.BackgroundTransparency = 1
- ImageLabel31.Image = "rbxassetid://500188818"
- ImageLabel31.ImageColor3 = Color3.new(0.156863, 0.156863, 0.156863)
- ImageLabel31.ImageTransparency = 0.30000001192093
- Frame32.Parent = ImageLabel31
- Frame32.Transparency = 0.30000001192093
- Frame32.Size = UDim2.new(0, 110, 0, 100)
- Frame32.Position = UDim2.new(0, 100, 0, 0)
- Frame32.Active = true
- Frame32.BackgroundColor3 = Color3.new(0.14902, 0.14902, 0.14902)
- Frame32.BackgroundTransparency = 0.30000001192093
- Frame32.BorderSizePixel = 0
- Frame33.Name = "Controls"
- Frame33.Parent = ImageLabel31
- Frame33.Transparency = 0.30000001192093
- Frame33.Size = UDim2.new(1, 0, 0, 120)
- Frame33.Position = UDim2.new(0, 0, 0, -200)
- Frame33.Visible = false
- Frame33.BackgroundColor3 = Color3.new(0.156863, 0.156863, 0.156863)
- Frame33.BackgroundTransparency = 0.30000001192093
- Frame33.BorderColor3 = Color3.new(0.156863, 0.156863, 0.156863)
- Frame33.BorderSizePixel = 5
- Frame33.ZIndex = 10
- TextLabel34.Name = "Title"
- TextLabel34.Parent = Frame33
- TextLabel34.Transparency = 1
- TextLabel34.Size = UDim2.new(1, 0, 0, 15)
- TextLabel34.Text = "CONTROLS"
- TextLabel34.BackgroundColor3 = Color3.new(1, 1, 1)
- TextLabel34.BackgroundTransparency = 1
- TextLabel34.ZIndex = 10
- TextLabel34.Font = Enum.Font.SourceSansBold
- TextLabel34.FontSize = Enum.FontSize.Size14
- TextLabel34.TextColor3 = Color3.new(1, 1, 1)
- TextLabel35.Name = "Line"
- TextLabel35.Parent = TextLabel34
- TextLabel35.Size = UDim2.new(1, 0, 0, 2)
- TextLabel35.Text = ""
- TextLabel35.Position = UDim2.new(0, 0, 1, 1)
- TextLabel35.BackgroundColor3 = Color3.new(1, 1, 0)
- TextLabel35.BorderSizePixel = 0
- TextLabel35.ZIndex = 10
- TextLabel35.Font = Enum.Font.SourceSans
- TextLabel35.FontSize = Enum.FontSize.Size14
- Frame36.Name = "Grenades"
- Frame36.Parent = ImageLabel31
- Frame36.Transparency = 1
- Frame36.Size = UDim2.new(0, 175, 0, 25)
- Frame36.Position = UDim2.new(0, 0, 0, 90)
- Frame36.Visible = false
- Frame36.BackgroundTransparency = 1
- Frame36.ZIndex = 10
- Frame37.Name = "Lethals"
- Frame37.Parent = Frame36
- Frame37.Size = UDim2.new(0.5, -2, 1, 0)
- Frame37.BackgroundColor3 = Color3.new(1, 1, 1)
- Frame37.BorderSizePixel = 0
- Frame37.ZIndex = 10
- ImageLabel38.Name = "Icon"
- ImageLabel38.Parent = Frame37
- ImageLabel38.Transparency = 1
- ImageLabel38.Size = UDim2.new(0, 21, 0, 21)
- ImageLabel38.Position = UDim2.new(0, 7, 0, 2)
- ImageLabel38.BackgroundColor3 = Color3.new(1, 1, 1)
- ImageLabel38.BackgroundTransparency = 1
- ImageLabel38.ZIndex = 10
- TextLabel39.Name = "Mult"
- TextLabel39.Parent = Frame37
- TextLabel39.Transparency = 1
- TextLabel39.Size = UDim2.new(0, 20, 1, 0)
- TextLabel39.Text = "X"
- TextLabel39.Position = UDim2.new(0.5, -10, 0, 0)
- TextLabel39.BackgroundColor3 = Color3.new(1, 1, 1)
- TextLabel39.BackgroundTransparency = 1
- TextLabel39.BorderSizePixel = 0
- TextLabel39.ZIndex = 10
- TextLabel39.Font = Enum.Font.ArialBold
- TextLabel39.FontSize = Enum.FontSize.Size18
- TextLabel39.TextColor3 = Color3.new(0, 0, 0)
- TextLabel40.Name = "Num"
- TextLabel40.Parent = Frame37
- TextLabel40.Transparency = 1
- TextLabel40.Size = UDim2.new(0, 0, 1, 0)
- TextLabel40.Text = "0"
- TextLabel40.Position = UDim2.new(1, -7, 0, 0)
- TextLabel40.BackgroundColor3 = Color3.new(1, 1, 1)
- TextLabel40.BackgroundTransparency = 1
- TextLabel40.ZIndex = 10
- TextLabel40.Font = Enum.Font.ArialBold
- TextLabel40.FontSize = Enum.FontSize.Size18
- TextLabel40.TextColor3 = Color3.new(0, 0, 0)
- TextLabel40.TextXAlignment = Enum.TextXAlignment.Right
- Frame41.Name = "Tacticals"
- Frame41.Parent = Frame36
- Frame41.Size = UDim2.new(0.5, -2, 1, 0)
- Frame41.Position = UDim2.new(0.5, 2, 0, 0)
- Frame41.BackgroundColor3 = Color3.new(1, 1, 1)
- Frame41.BorderSizePixel = 0
- Frame41.ZIndex = 10
- ImageLabel42.Name = "Icon"
- ImageLabel42.Parent = Frame41
- ImageLabel42.Transparency = 1
- ImageLabel42.Size = UDim2.new(0, 21, 0, 21)
- ImageLabel42.Position = UDim2.new(0, 7, 0, 2)
- ImageLabel42.BackgroundColor3 = Color3.new(1, 1, 1)
- ImageLabel42.BackgroundTransparency = 1
- ImageLabel42.ZIndex = 10
- TextLabel43.Name = "Num"
- TextLabel43.Parent = Frame41
- TextLabel43.Transparency = 1
- TextLabel43.Size = UDim2.new(0, 0, 1, 0)
- TextLabel43.Text = "0"
- TextLabel43.Position = UDim2.new(1, -7, 0, 0)
- TextLabel43.BackgroundColor3 = Color3.new(1, 1, 1)
- TextLabel43.BackgroundTransparency = 1
- TextLabel43.ZIndex = 10
- TextLabel43.Font = Enum.Font.ArialBold
- TextLabel43.FontSize = Enum.FontSize.Size18
- TextLabel43.TextColor3 = Color3.new(0, 0, 0)
- TextLabel43.TextXAlignment = Enum.TextXAlignment.Right
- TextLabel44.Name = "Mult"
- TextLabel44.Parent = Frame41
- TextLabel44.Transparency = 1
- TextLabel44.Size = UDim2.new(0, 20, 1, 0)
- TextLabel44.Text = "X"
- TextLabel44.Position = UDim2.new(0.5, -10, 0, 0)
- TextLabel44.BackgroundColor3 = Color3.new(1, 1, 1)
- TextLabel44.BackgroundTransparency = 1
- TextLabel44.BorderSizePixel = 0
- TextLabel44.ZIndex = 10
- TextLabel44.Font = Enum.Font.ArialBold
- TextLabel44.FontSize = Enum.FontSize.Size18
- TextLabel44.TextColor3 = Color3.new(0, 0, 0)
- Frame45.Name = "Health"
- Frame45.Parent = ImageLabel31
- Frame45.Transparency = 1
- Frame45.Size = UDim2.new(0.400000006, 0, 0, 25)
- Frame45.Position = UDim2.new(0, 25, 0, 20)
- Frame45.BackgroundColor3 = Color3.new(0.247059, 0.247059, 0.247059)
- Frame45.BackgroundTransparency = 1
- Frame45.BorderColor3 = Color3.new(0.156863, 0.156863, 0.156863)
- Frame45.BorderSizePixel = 0
- Frame45.ZIndex = 10
- Frame45.Draggable = true
- TextLabel46.Name = "Num"
- TextLabel46.Parent = Frame45
- TextLabel46.Transparency = 1
- TextLabel46.Size = UDim2.new(0, 50, 1, 0)
- TextLabel46.Text = "100%"
- TextLabel46.Position = UDim2.new(1, -50, 0, 0)
- TextLabel46.BackgroundColor3 = Color3.new(0, 0, 0)
- TextLabel46.BackgroundTransparency = 1
- TextLabel46.BorderColor3 = Color3.new(0, 0, 0)
- TextLabel46.BorderSizePixel = 0
- TextLabel46.ZIndex = 10
- TextLabel46.Font = Enum.Font.SourceSansBold
- TextLabel46.FontSize = Enum.FontSize.Size24
- TextLabel46.TextColor3 = Color3.new(1, 1, 1)
- TextLabel46.TextStrokeColor3 = Color3.new(0.745098, 0.745098, 0.745098)
- TextLabel46.TextXAlignment = Enum.TextXAlignment.Right
- Frame47.Name = "Tray"
- Frame47.Parent = Frame45
- Frame47.Transparency = 1
- Frame47.Size = UDim2.new(1, -60, 0, 20)
- Frame47.Position = UDim2.new(0, 2, 0.5, -10)
- Frame47.Visible = false
- Frame47.BackgroundColor3 = Color3.new(0, 0, 0)
- Frame47.BackgroundTransparency = 1
- Frame47.BorderColor3 = Color3.new(0, 0, 0)
- Frame47.BorderSizePixel = 0
- Frame47.ZIndex = 10
- Frame47.ClipsDescendants = true
- Frame48.Name = "Beat"
- Frame48.Parent = Frame47
- Frame48.Transparency = 1
- Frame48.Size = UDim2.new(0, 21, 1, 0)
- Frame48.Position = UDim2.new(1, 0, 0, 0)
- Frame48.BackgroundColor3 = Color3.new(0, 0, 0)
- Frame48.BackgroundTransparency = 1
- Frame48.BorderColor3 = Color3.new(0, 0, 0)
- Frame48.BorderSizePixel = 0
- Frame48.ZIndex = 10
- Frame49.Name = "00"
- Frame49.Parent = Frame48
- Frame49.Size = UDim2.new(0.0476190485, 0, 0, 3)
- Frame49.Position = UDim2.new(0, 0, 0.5, -2)
- Frame49.BackgroundColor3 = Color3.new(1, 1, 1)
- Frame49.BorderColor3 = Color3.new(0, 0, 0)
- Frame49.BorderSizePixel = 0
- Frame49.ZIndex = 10
- Frame50.Name = "01"
- Frame50.Parent = Frame48
- Frame50.Size = UDim2.new(0.0476190485, 0, 0, 4)
- Frame50.Position = UDim2.new(0.0476190485, 0, 0.423076928, -2)
- Frame50.BackgroundColor3 = Color3.new(1, 1, 1)
- Frame50.BorderColor3 = Color3.new(0, 0, 0)
- Frame50.BorderSizePixel = 0
- Frame50.ZIndex = 10
- Frame51.Name = "02"
- Frame51.Parent = Frame48
- Frame51.Size = UDim2.new(0.0476190485, 0, 0, 4)
- Frame51.Position = UDim2.new(0.095238097, 0, 0.346153855, -2)
- Frame51.BackgroundColor3 = Color3.new(1, 1, 1)
- Frame51.BorderColor3 = Color3.new(0, 0, 0)
- Frame51.BorderSizePixel = 0
- Frame51.ZIndex = 10
- Frame52.Name = "03"
- Frame52.Parent = Frame48
- Frame52.Size = UDim2.new(0.0476190485, 0, 0, 4)
- Frame52.Position = UDim2.new(0.142857149, 0, 0.269230783, -2)
- Frame52.BackgroundColor3 = Color3.new(1, 1, 1)
- Frame52.BorderColor3 = Color3.new(0, 0, 0)
- Frame52.BorderSizePixel = 0
- Frame52.ZIndex = 10
- Frame53.Name = "04"
- Frame53.Parent = Frame48
- Frame53.Size = UDim2.new(0.0476190485, 0, 0, 4)
- Frame53.Position = UDim2.new(0.190476194, 0, 0.192307696, -2)
- Frame53.BackgroundColor3 = Color3.new(1, 1, 1)
- Frame53.BorderColor3 = Color3.new(0, 0, 0)
- Frame53.BorderSizePixel = 0
- Frame53.ZIndex = 10
- Frame54.Name = "05"
- Frame54.Parent = Frame48
- Frame54.Size = UDim2.new(0.0476190485, 0, 0, 4)
- Frame54.Position = UDim2.new(0.238095239, 0, 0.115384616, -2)
- Frame54.BackgroundColor3 = Color3.new(1, 1, 1)
- Frame54.BorderColor3 = Color3.new(0, 0, 0)
- Frame54.BorderSizePixel = 0
- Frame54.ZIndex = 10
- Frame55.Name = "06"
- Frame55.Parent = Frame48
- Frame55.Size = UDim2.new(0.0476190485, 0, 0, 4)
- Frame55.Position = UDim2.new(0.285714298, 0, 0.0384615399, -2)
- Frame55.BackgroundColor3 = Color3.new(1, 1, 1)
- Frame55.BorderColor3 = Color3.new(0, 0, 0)
- Frame55.BorderSizePixel = 0
- Frame55.ZIndex = 10
- Frame56.Name = "07"
- Frame56.Parent = Frame48
- Frame56.Size = UDim2.new(0.0476190485, 0, 0, 4)
- Frame56.Position = UDim2.new(0.333333343, 0, 0, -2)
- Frame56.BackgroundColor3 = Color3.new(1, 1, 1)
- Frame56.BorderColor3 = Color3.new(0, 0, 0)
- Frame56.BorderSizePixel = 0
- Frame56.ZIndex = 10
- Frame57.Name = "08"
- Frame57.Parent = Frame48
- Frame57.Size = UDim2.new(0.0476190485, 0, 0, 4)
- Frame57.Position = UDim2.new(0.380952388, 0, 0.142857149, -2)
- Frame57.BackgroundColor3 = Color3.new(1, 1, 1)
- Frame57.BorderColor3 = Color3.new(0, 0, 0)
- Frame57.BorderSizePixel = 0
- Frame57.ZIndex = 10
- Frame58.Name = "09"
- Frame58.Parent = Frame48
- Frame58.Size = UDim2.new(0.0476190485, 0, 0, 4)
- Frame58.Position = UDim2.new(0.428571433, 0, 0.285714298, -2)
- Frame58.BackgroundColor3 = Color3.new(1, 1, 1)
- Frame58.BorderColor3 = Color3.new(0, 0, 0)
- Frame58.BorderSizePixel = 0
- Frame58.ZIndex = 10
- Frame59.Name = "10"
- Frame59.Parent = Frame48
- Frame59.Size = UDim2.new(0.0476190485, 0, 0, 4)
- Frame59.Position = UDim2.new(0.476190478, 0, 0.428571433, -2)
- Frame59.BackgroundColor3 = Color3.new(1, 1, 1)
- Frame59.BorderColor3 = Color3.new(0, 0, 0)
- Frame59.BorderSizePixel = 0
- Frame59.ZIndex = 10
- Frame60.Name = "11"
- Frame60.Parent = Frame48
- Frame60.Size = UDim2.new(0.0476190485, 0, 0, 4)
- Frame60.Position = UDim2.new(0.523809552, 0, 0.571428597, -2)
- Frame60.BackgroundColor3 = Color3.new(1, 1, 1)
- Frame60.BorderColor3 = Color3.new(0, 0, 0)
- Frame60.BorderSizePixel = 0
- Frame60.ZIndex = 10
- Frame61.Name = "12"
- Frame61.Parent = Frame48
- Frame61.Size = UDim2.new(0.0476190485, 0, 0, 4)
- Frame61.Position = UDim2.new(0.571428597, 0, 0.714285731, -2)
- Frame61.BackgroundColor3 = Color3.new(1, 1, 1)
- Frame61.BorderColor3 = Color3.new(0, 0, 0)
- Frame61.BorderSizePixel = 0
- Frame61.ZIndex = 10
- Frame62.Name = "13"
- Frame62.Parent = Frame48
- Frame62.Size = UDim2.new(0.0476190485, 0, 0, 4)
- Frame62.Position = UDim2.new(0.619047642, 0, 0.857142866, -2)
- Frame62.BackgroundColor3 = Color3.new(1, 1, 1)
- Frame62.BorderColor3 = Color3.new(0, 0, 0)
- Frame62.BorderSizePixel = 0
- Frame62.ZIndex = 10
- Frame63.Name = "14"
- Frame63.Parent = Frame48
- Frame63.Size = UDim2.new(0.0476190485, 0, 0, 4)
- Frame63.Position = UDim2.new(0.666666687, 0, 0.916666687, -2)
- Frame63.BackgroundColor3 = Color3.new(1, 1, 1)
- Frame63.BorderColor3 = Color3.new(0, 0, 0)
- Frame63.BorderSizePixel = 0
- Frame63.ZIndex = 10
- Frame64.Name = "15"
- Frame64.Parent = Frame48
- Frame64.Size = UDim2.new(0.0476190485, 0, 0, 4)
- Frame64.Position = UDim2.new(0.714285731, 0, 0.833333313, -2)
- Frame64.BackgroundColor3 = Color3.new(1, 1, 1)
- Frame64.BorderColor3 = Color3.new(0, 0, 0)
- Frame64.BorderSizePixel = 0
- Frame64.ZIndex = 10
- Frame65.Name = "16"
- Frame65.Parent = Frame48
- Frame65.Size = UDim2.new(0.0476190485, 0, 0, 4)
- Frame65.Position = UDim2.new(0.761904776, 0, 0.75, -2)
- Frame65.BackgroundColor3 = Color3.new(1, 1, 1)
- Frame65.BorderColor3 = Color3.new(0, 0, 0)
- Frame65.BorderSizePixel = 0
- Frame65.ZIndex = 10
- Frame66.Name = "17"
- Frame66.Parent = Frame48
- Frame66.Size = UDim2.new(0.0476190485, 0, 0, 4)
- Frame66.Position = UDim2.new(0.809523821, 0, 0.666666687, -2)
- Frame66.BackgroundColor3 = Color3.new(1, 1, 1)
- Frame66.BorderColor3 = Color3.new(0, 0, 0)
- Frame66.BorderSizePixel = 0
- Frame66.ZIndex = 10
- Frame67.Name = "18"
- Frame67.Parent = Frame48
- Frame67.Size = UDim2.new(0.0476190485, 0, 0, 4)
- Frame67.Position = UDim2.new(0.857142866, 0, 0.583333313, -2)
- Frame67.BackgroundColor3 = Color3.new(1, 1, 1)
- Frame67.BorderColor3 = Color3.new(0, 0, 0)
- Frame67.BorderSizePixel = 0
- Frame67.ZIndex = 10
- Frame68.Name = "19"
- Frame68.Parent = Frame48
- Frame68.Size = UDim2.new(0.0476190485, 0, 0, 4)
- Frame68.Position = UDim2.new(0.90476191, 0, 0.5, -2)
- Frame68.BackgroundColor3 = Color3.new(1, 1, 1)
- Frame68.BorderColor3 = Color3.new(0, 0, 0)
- Frame68.BorderSizePixel = 0
- Frame68.ZIndex = 10
- Frame69.Name = "20"
- Frame69.Parent = Frame48
- Frame69.Size = UDim2.new(0.0476190485, 0, 0, 4)
- Frame69.Position = UDim2.new(0.952000022, 0, 0.49000001, -2)
- Frame69.BackgroundColor3 = Color3.new(1, 1, 1)
- Frame69.BorderColor3 = Color3.new(0, 0, 0)
- Frame69.BorderSizePixel = 0
- Frame69.ZIndex = 10
- Frame70.Name = "Line"
- Frame70.Parent = Frame48
- Frame70.Size = UDim2.new(0, 200, 0, 3)
- Frame70.Position = UDim2.new(1, 0, 0.5, -2)
- Frame70.BackgroundColor3 = Color3.new(1, 1, 1)
- Frame70.BorderColor3 = Color3.new(0, 0, 0)
- Frame70.BorderSizePixel = 0
- Frame70.ZIndex = 10
- Frame71.Name = "Line"
- Frame71.Parent = Frame48
- Frame71.Size = UDim2.new(0, 200, 0, 3)
- Frame71.Position = UDim2.new(0, -200, 0.5, -2)
- Frame71.BackgroundColor3 = Color3.new(1, 1, 1)
- Frame71.BorderColor3 = Color3.new(0, 0, 0)
- Frame71.BorderSizePixel = 0
- Frame71.ZIndex = 10
- Frame72.Name = "Mode"
- Frame72.Parent = ImageLabel31
- Frame72.Transparency = 1
- Frame72.Size = UDim2.new(0, 85, 0, 20)
- Frame72.Position = UDim2.new(1, 22, 1, -60)
- Frame72.BackgroundColor3 = Color3.new(1, 1, 1)
- Frame72.BackgroundTransparency = 1
- Frame72.ZIndex = 10
- TextLabel73.Name = "Bracket"
- TextLabel73.Parent = Frame72
- TextLabel73.Transparency = 1
- TextLabel73.Size = UDim2.new(0, 5, 0, 20)
- TextLabel73.Text = "["
- TextLabel73.BackgroundTransparency = 1
- TextLabel73.ZIndex = 10
- TextLabel73.Font = Enum.Font.ArialBold
- TextLabel73.FontSize = Enum.FontSize.Size18
- TextLabel73.TextColor3 = Color3.new(1, 1, 1)
- TextLabel73.TextXAlignment = Enum.TextXAlignment.Left
- TextLabel74.Name = "Bracket"
- TextLabel74.Parent = Frame72
- TextLabel74.Transparency = 1
- TextLabel74.Size = UDim2.new(0, 5, 0, 20)
- TextLabel74.Text = "]"
- TextLabel74.Position = UDim2.new(1, -5, 0, 0)
- TextLabel74.BackgroundTransparency = 1
- TextLabel74.ZIndex = 10
- TextLabel74.Font = Enum.Font.ArialBold
- TextLabel74.FontSize = Enum.FontSize.Size18
- TextLabel74.TextColor3 = Color3.new(1, 1, 1)
- TextLabel74.TextXAlignment = Enum.TextXAlignment.Left
- TextLabel75.Name = "Main"
- TextLabel75.Parent = Frame72
- TextLabel75.Transparency = 1
- TextLabel75.Size = UDim2.new(1, 0, 0, 20)
- TextLabel75.Text = "Auto"
- TextLabel75.BackgroundTransparency = 1
- TextLabel75.ZIndex = 10
- TextLabel75.Font = Enum.Font.SourceSansItalic
- TextLabel75.FontSize = Enum.FontSize.Size18
- TextLabel75.TextColor3 = Color3.new(1, 1, 1)
- TextLabel75.TextWrapped = true
- Frame76.Name = "gunName"
- Frame76.Parent = ImageLabel31
- Frame76.Transparency = 1
- Frame76.Size = UDim2.new(1, 0, 0, 36)
- Frame76.BackgroundColor3 = Color3.new(0.352941, 0.352941, 0.352941)
- Frame76.BackgroundTransparency = 1
- Frame76.ZIndex = 10
- TextLabel77.Name = "Title"
- TextLabel77.Parent = Frame76
- TextLabel77.Transparency = 1
- TextLabel77.Size = UDim2.new(1, 75, 1, 0)
- TextLabel77.Text = "GUN"
- TextLabel77.Position = UDim2.new(0, 30, 0, -5)
- TextLabel77.BackgroundColor3 = Color3.new(1, 1, 1)
- TextLabel77.BackgroundTransparency = 1
- TextLabel77.ZIndex = 10
- TextLabel77.Font = Enum.Font.SourceSansItalic
- TextLabel77.FontSize = Enum.FontSize.Size36
- TextLabel77.TextColor3 = Color3.new(1, 1, 1)
- TextLabel77.TextStrokeColor3 = Color3.new(0.745098, 0.745098, 0.745098)
- TextLabel77.TextStrokeTransparency = 0
- TextLabel77.TextWrapped = true
- TextLabel77.TextXAlignment = Enum.TextXAlignment.Left
- Frame78.Name = "Ammo"
- Frame78.Parent = ImageLabel31
- Frame78.Transparency = 1
- Frame78.Size = UDim2.new(0, 135, 0, 40)
- Frame78.Position = UDim2.new(0, 72, 0, 60)
- Frame78.BackgroundTransparency = 1
- Frame78.ZIndex = 10
- TextLabel79.Name = "Slash"
- TextLabel79.Parent = Frame78
- TextLabel79.Transparency = 1
- TextLabel79.Size = UDim2.new(0, 0, 0, 45)
- TextLabel79.Text = "//"
- TextLabel79.Position = UDim2.new(0, 92, 0, -12)
- TextLabel79.BackgroundTransparency = 1
- TextLabel79.ZIndex = 10
- TextLabel79.Font = Enum.Font.SourceSansBold
- TextLabel79.FontSize = Enum.FontSize.Size24
- TextLabel79.TextColor3 = Color3.new(1, 1, 1)
- TextLabel80.Name = "Stored"
- TextLabel80.Parent = Frame78
- TextLabel80.Transparency = 1
- TextLabel80.Size = UDim2.new(1, 0, 0, 85)
- TextLabel80.Text = "999"
- TextLabel80.Position = UDim2.new(0, 100, 0, -35)
- TextLabel80.BackgroundTransparency = 1
- TextLabel80.ZIndex = 10
- TextLabel80.Font = Enum.Font.SourceSansBold
- TextLabel80.FontSize = Enum.FontSize.Size28
- TextLabel80.TextColor3 = Color3.new(1, 1, 1)
- TextLabel80.TextXAlignment = Enum.TextXAlignment.Left
- TextLabel81.Name = "Background"
- TextLabel81.Parent = TextLabel80
- TextLabel81.Transparency = 1
- TextLabel81.Size = UDim2.new(1, 0, 1, 0)
- TextLabel81.Text = "000"
- TextLabel81.BackgroundTransparency = 1
- TextLabel81.ZIndex = 10
- TextLabel81.Font = Enum.Font.ArialBold
- TextLabel81.FontSize = Enum.FontSize.Size24
- TextLabel81.TextColor3 = Color3.new(0.588235, 0.588235, 0.588235)
- TextLabel81.TextTransparency = 0.80000001192093
- TextLabel81.TextWrapped = true
- TextLabel81.TextXAlignment = Enum.TextXAlignment.Left
- TextLabel82.Name = "Clip"
- TextLabel82.Parent = Frame78
- TextLabel82.Transparency = 1
- TextLabel82.Size = UDim2.new(0, 85, 1, 0)
- TextLabel82.Text = "999"
- TextLabel82.Position = UDim2.new(0, 0, 0, -5)
- TextLabel82.BackgroundTransparency = 1
- TextLabel82.ZIndex = 10
- TextLabel82.Font = Enum.Font.SourceSansBold
- TextLabel82.FontSize = Enum.FontSize.Size60
- TextLabel82.TextColor3 = Color3.new(1, 1, 1)
- TextLabel82.TextXAlignment = Enum.TextXAlignment.Right
- TextLabel83.Name = "Background"
- TextLabel83.Parent = TextLabel82
- TextLabel83.Transparency = 1
- TextLabel83.Size = UDim2.new(1, 0, 1, 0)
- TextLabel83.Text = "000"
- TextLabel83.BackgroundTransparency = 1
- TextLabel83.ZIndex = 10
- TextLabel83.Font = Enum.Font.SourceSansBold
- TextLabel83.FontSize = Enum.FontSize.Size60
- TextLabel83.TextColor3 = Color3.new(0.588235, 0.588235, 0.588235)
- TextLabel83.TextTransparency = 0.80000001192093
- TextLabel83.TextXAlignment = Enum.TextXAlignment.Right
- ImageLabel84.Name = "Bear"
- ImageLabel84.Parent = ImageLabel31
- ImageLabel84.Transparency = 1
- ImageLabel84.Rotation = -10
- ImageLabel84.Size = UDim2.new(0, 80, 0, 50)
- ImageLabel84.Position = UDim2.new(0, 100, 0, 5)
- ImageLabel84.Visible = false
- ImageLabel84.BackgroundColor3 = Color3.new(1, 1, 1)
- ImageLabel84.BackgroundTransparency = 1
- ImageLabel84.Image = "rbxassetid://500200470"
- ImageLabel84.ImageTransparency = 0.69999998807907
- TextLabel85.Parent = ImageLabel84
- TextLabel85.Transparency = 1
- TextLabel85.Rotation = 10
- TextLabel85.Size = UDim2.new(1, 0, 1, 0)
- TextLabel85.Text = "~BoG~"
- TextLabel85.BackgroundColor3 = Color3.new(1, 1, 1)
- TextLabel85.BackgroundTransparency = 1
- TextLabel85.Font = Enum.Font.SourceSansItalic
- TextLabel85.FontSize = Enum.FontSize.Size24
- TextLabel85.TextColor3 = Color3.new(1, 1, 1)
- TextLabel85.TextStrokeColor3 = Color3.new(0.745098, 0.745098, 0.745098)
- TextLabel85.TextStrokeTransparency = 0.89999997615814
- TextLabel85.TextTransparency = 0.89999997615814
- TextLabel85.TextWrapped = true
- IntValue86.Name = "TacticalGrenades"
- IntValue86.Parent = Tool0
- IntValue86.Value = 15
- Part87.Name = "BoltBack"
- Part87.Parent = Tool0
- Part87.Transparency = 1
- Part87.Rotation = Vector3.new(0.149999991, 0, 0)
- Part87.Size = Vector3.new(0.200000003, 0.200000003, 0.200000003)
- Part87.CFrame = CFrame.new(1.73000002, 0.578508019, -0.666062057, 1, 0, 0, 0, 0.999996662, -0.00260399911, 0, 0.00260399911, 0.999996662)
- Part87.Position = Vector3.new(1.73000002, 0.578508019, -0.666062057)
- Part87.Orientation = Vector3.new(0.149999991, 0, 0)
- Part88.Name = "Bolt"
- Part88.Parent = Tool0
- Part88.Transparency = 1
- Part88.Rotation = Vector3.new(0.149999991, 0, 0)
- Part88.Size = Vector3.new(0.200000003, 0.200000003, 0.200000003)
- Part88.CFrame = CFrame.new(1.73000002, 0.378484428, -0.666583896, 1, 0, 0, 0, 0.999996781, -0.00260399934, 0, 0.00260399934, 0.999996781)
- Part88.Position = Vector3.new(1.73000002, 0.378484428, -0.666583896)
- Part88.Orientation = Vector3.new(0.149999991, 0, 0)
- Script89.Name = "serverMain"
- Script89.Parent = Tool0
- table.insert(cors,sandbox(Script89,function()
- local Plyr = script:WaitForChild("Plyr")
- local Gun = script.Parent
- local Handle = Gun:WaitForChild("Handle")
- local V3 = Vector3.new
- local CF, CFANG = CFrame.new, CFrame.Angles
- local RAD = math.rad
- local numLerp = function(A, B, Alpha)
- return A + (B - A) * Alpha
- end
- local inList = function(Element, List)
- for _, v in pairs(List) do
- if v == Element then
- return true
- end
- end
- return false
- end
- local getObject = function(Model, Class, Name)
- for _, v in pairs(Model:GetChildren()) do
- if v:IsA(Class) and v.Name == Name then
- return v
- end
- end
- return nil
- end
- ----------------------------------------------------------------------
- --------------------[ IGNORE MODEL HANDLING ]-------------------------
- ----------------------------------------------------------------------
- wait(math.random(0, 20) / 40) --This is to prevent more than one ignoreModel from being created
- if _G.ignoreCode then --If the ignoreCode already exists, then the script creates the ignoreModel
- --[[
- The purpose of this is so that every gun in a game that uses this gun kit will share one ignoreModel. That way,
- bullet trails, bullet holes, and other fake arms will be ignored by the gun which makes the bullets more likely to
- hit a character part
- --]]
- if (not game.Workspace:FindFirstChild("ignoreModel_".._G.ignoreCode)) then
- local ignoreModel = Instance.new("Model")
- ignoreModel.Name = "ignoreModel_".._G.ignoreCode
- ignoreModel.Parent = game.Workspace
- local grenadeFolder = Instance.new("Model")
- grenadeFolder.Name = "grenadeFolder"
- grenadeFolder.Parent = ignoreModel
- spawn(function()
- while true do
- ignoreModel.Parent = game.Workspace
- grenadeFolder.Parent = ignoreModel
- wait(1 / 20)
- end
- end)
- end
- script.Parent:WaitForChild("clientMain"):WaitForChild("ignoreCode").Value = _G.ignoreCode
- else
- --[[
- If there isn't already an ignoreCode, then this creates one. The purpose of it being random is so that if there is
- an ignoreModel for something else in the game, the script won't end up placing the ignored objects in that ignoreModel
- --]]
- _G.ignoreCode = math.random(1, 1e4)
- if (not game.Workspace:FindFirstChild("ignoreModel_".._G.ignoreCode)) then
- local ignoreModel = Instance.new("Model")
- ignoreModel.Name = "ignoreModel_".._G.ignoreCode
- ignoreModel.Parent = game.Workspace
- local grenadeFolder = Instance.new("Model")
- grenadeFolder.Name = "grenadeFolder"
- grenadeFolder.Parent = ignoreModel
- spawn(function()
- while true do
- ignoreModel.Parent = game.Workspace
- grenadeFolder.Parent = ignoreModel
- wait(1 / 20)
- end
- end)
- end
- script.Parent:WaitForChild("clientMain"):WaitForChild("ignoreCode").Value = _G.ignoreCode
- end
- spawn(function()
- --[[
- This function deletes any Player Folders that were left in the ignoreModel because the player left the game without
- deselecting the Gun first
- --]]
- repeat wait() until _G.ignoreCode
- local ignoreModel = game.Workspace:WaitForChild("ignoreModel_".._G.ignoreCode)
- while true do
- for _, gunIgnore in pairs(ignoreModel:GetChildren()) do
- if gunIgnore.Name ~= "grenadeFolder" then
- if (not game.Players:FindFirstChild(gunIgnore.Name:sub(11))) then
- gunIgnore:Destroy()
- end
- end
- end
- wait(1 / 20)
- end
- end)
- ----------------------------------------------------------------------
- --------------------[ RESET CAMERA ]----------------------------------
- ----------------------------------------------------------------------
- Gun.ChildRemoved:connect(function(Child)
- if Child == Handle and Plyr.Value then
- local ignoreCode = Gun:WaitForChild("clientMain"):WaitForChild("ignoreCode").Value
- local resetCam = script:WaitForChild("resetCam")
- resetCam:WaitForChild("ignoreCode").Value = ignoreCode
- resetCam.Parent = Plyr.Value.PlayerGui
- end
- end)
- ----------------------------------------------------------------------
- --------------------[ GET WELD CFRAMES ]------------------------------
- ----------------------------------------------------------------------
- for _, v in pairs(Gun:GetChildren()) do
- if v:IsA("BasePart") and v ~= Handle then
- if v:FindFirstChild("mainWeld") then v.mainWeld:Destroy() end
- if (not v:FindFirstChild("weldCF")) then
- local weldCF = Instance.new("CFrameValue")
- weldCF.Name = "weldCF"
- weldCF.Value = Handle.CFrame:toObjectSpace(v.CFrame)
- weldCF.Parent = v
- end
- if string.sub(v.Name, 1, 3) == "Mag" then
- if (not v:FindFirstChild("magTrans")) then
- local magTrans = Instance.new("NumberValue")
- magTrans.Name = "magTrans"
- magTrans.Value = v.Transparency
- magTrans.Parent = v
- end
- end
- v.Anchored = true
- v.CanCollide = false
- end
- end
- Handle.Anchored = false
- Handle.CanCollide = true
- ----------------------------------------------------------------------
- --------------------[ GUNSETUP HANDLING ]-----------------------------
- ----------------------------------------------------------------------
- local gunSetup = script:WaitForChild("gunSetup")
- function gunSetup.OnServerInvoke(Player, Vars)
- --------------------[ CREATING IGNORE MODELS ]--------------------------------
- local gunIgnore = Instance.new("Model")
- gunIgnore.Name = "gunIgnore_"..Player.Name
- gunIgnore.Parent = Vars.ignoreModel
- --------------------[ MODIFYING THE PLAYER ]----------------------------------
- Vars.Humanoid.AutoRotate = false
- Vars.Shoulders.Right.Part1 = nil
- Vars.Shoulders.Left.Part1 = nil
- local playerFolder = Instance.new("Model")
- playerFolder.Name = "playerFolder"
- playerFolder.Parent = gunIgnore
- local headBase = Instance.new("Part")
- headBase.Transparency = 1
- headBase.Name = "headBase"
- headBase.CanCollide = false
- headBase.FormFactor = Enum.FormFactor.Custom
- headBase.Size = V3(0.2, 0.2, 0.2)
- headBase.BottomSurface = Enum.SurfaceType.Smooth
- headBase.TopSurface = Enum.SurfaceType.Smooth
- headBase.Parent = playerFolder
- local headWeld = Instance.new("Weld")
- headWeld.Part0 = Vars.Torso
- headWeld.Part1 = headBase
- headWeld.C0 = CF(0, 1.5, 0)
- headWeld.Parent = Vars.Torso
- local headWeld2 = Instance.new("Weld")
- headWeld2.Part0 = headBase
- headWeld2.Part1 = Vars.Head
- headWeld2.Parent = headBase
- local animBase = Instance.new("Part")
- animBase.Transparency = 1
- animBase.Name = "animBase"
- animBase.CanCollide = false
- animBase.FormFactor = Enum.FormFactor.Custom
- animBase.Size = V3(0.2, 0.2, 0.2)
- animBase.BottomSurface = Enum.SurfaceType.Smooth
- animBase.TopSurface = Enum.SurfaceType.Smooth
- animBase.Parent = playerFolder
- local animWeld = Instance.new("Weld")
- animWeld.Part0 = animBase
- animWeld.Part1 = headBase
- animWeld.Parent = animBase
- local armBase = Instance.new("Part")
- armBase.Transparency = 1
- armBase.Name = "ArmBase"
- armBase.CanCollide = false
- armBase.FormFactor = Enum.FormFactor.Custom
- armBase.Size = V3(0.2, 0.2, 0.2)
- armBase.BottomSurface = Enum.SurfaceType.Smooth
- armBase.TopSurface = Enum.SurfaceType.Smooth
- armBase.Parent = playerFolder
- local ABWeld = Instance.new("Weld")
- ABWeld.Part0 = armBase
- ABWeld.Part1 = animBase
- ABWeld.Parent = armBase
- local LArmBase = Instance.new("Part")
- LArmBase.Transparency = 1
- LArmBase.Name = "LArmBase"
- LArmBase.CanCollide = false
- LArmBase.FormFactor = Enum.FormFactor.Custom
- LArmBase.Size = V3(0.2, 0.2, 0.2)
- LArmBase.BottomSurface = Enum.SurfaceType.Smooth
- LArmBase.TopSurface = Enum.SurfaceType.Smooth
- LArmBase.Parent = playerFolder
- local RArmBase = Instance.new("Part")
- RArmBase.Transparency = 1
- RArmBase.Name = "RArmBase"
- RArmBase.CanCollide = false
- RArmBase.FormFactor = Enum.FormFactor.Custom
- RArmBase.Size = V3(0.2, 0.2, 0.2)
- RArmBase.BottomSurface = Enum.SurfaceType.Smooth
- RArmBase.TopSurface = Enum.SurfaceType.Smooth
- RArmBase.Parent = playerFolder
- local LWeld = Instance.new("Weld")
- LWeld.Name = "LWeld"
- LWeld.Part0 = armBase
- LWeld.Part1 = LArmBase
- LWeld.C0 = Vars.armC0[1]
- LWeld.C1 = Vars.leftArmC1
- LWeld.Parent = armBase
- local RWeld = Instance.new("Weld")
- RWeld.Name = "RWeld"
- RWeld.Part0 = armBase
- RWeld.Part1 = RArmBase
- RWeld.C0 = Vars.armC0[2]
- RWeld.C1 = Vars.rightArmC1
- RWeld.Parent = armBase
- local LWeld2 = Instance.new("Weld")
- LWeld2.Name = "LWeld"
- LWeld2.Part0 = LArmBase
- LWeld2.Part1 = Vars.LArm
- LWeld2.Parent = LArmBase
- local RWeld2 = Instance.new("Weld")
- RWeld2.Name = "RWeld"
- RWeld2.Part0 = RArmBase
- RWeld2.Part1 = Vars.RArm
- RWeld2.Parent = RArmBase
- local LLegWeld = Instance.new("Weld")
- LLegWeld.Name = "LLegWeld"
- LLegWeld.Part0 = Vars.Torso
- LLegWeld.Part1 = nil
- LLegWeld.C0 = CF(-0.5, -2, 0)
- LLegWeld.Parent = Vars.Torso
- local RLegWeld = Instance.new("Weld")
- RLegWeld.Name = "RLegWeld"
- RLegWeld.Part0 = Vars.Torso
- RLegWeld.Part1 = nil
- RLegWeld.C0 = CF(0.5, -2, 0)
- RLegWeld.Parent = Vars.Torso
- for _, Tab in pairs(Vars.gunParts) do
- Tab.Obj.Anchored = false
- local Weld = Instance.new("Weld")
- Weld.Name = "mainWeld"
- Weld.Part0 = Vars.Handle
- Weld.Part1 = Tab.Obj
- Weld.C0 = Tab.Obj.weldCF.Value
- Weld.Parent = Vars.Handle
- Tab.Weld = Weld
- end
- return gunIgnore, playerFolder, headWeld, headWeld2, animWeld, ABWeld, LWeld, RWeld, LWeld2, RWeld2, LLegWeld, RLegWeld, Vars.gunParts
- end
- ----------------------------------------------------------------------
- --------------------[ TWEENJOINT HANDLING ]---------------------------
- ----------------------------------------------------------------------
- local createTweenIndicator = script:WaitForChild("createTweenIndicator")
- function createTweenIndicator.OnServerInvoke(_, Joint, newCode)
- local tweenIndicator = nil
- if (not Joint:findFirstChild("tweenCode")) then --If the joint isn't being tweened, then
- tweenIndicator = Instance.new("IntValue")
- tweenIndicator.Name = "tweenCode"
- tweenIndicator.Value = newCode
- tweenIndicator.Parent = Joint
- else
- tweenIndicator = Joint.tweenCode
- tweenIndicator.Value = newCode --If the joint is already being tweened, this will change the code, and the tween loop will stop
- end
- return tweenIndicator
- end
- local lerpCF = script:WaitForChild("lerpCF")
- function lerpCF.OnServerInvoke(_, Joint, Prop, startCF, endCF, Alpha)
- spawn(function()
- Joint[Prop] = startCF:lerp(endCF, Alpha)
- end)
- end
- local deleteTweenIndicator = script:WaitForChild("deleteTweenIndicator")
- function deleteTweenIndicator.OnServerInvoke(_, tweenIndicator, newCode)
- if tweenIndicator.Value == newCode then --If this tween functions was the last one called on a joint then it will remove the code
- tweenIndicator:Destroy()
- end
- end
- ----------------------------------------------------------------------
- --------------------[ BULLET IMPACT HANDLING ]------------------------
- ----------------------------------------------------------------------
- local createBulletImpact = script:WaitForChild("createBulletImpact")
- createBulletImpact.OnServerEvent:connect(function(_, H, P, N, D, humanoidFound, gunIgnore, S)
- local surfaceCF = CF(P, P + N)
- ----------------------------------------------------------------------------------
- --Creating the bullet hole--------------------------------------------------------
- ----------------------------------------------------------------------------------
- if S.bulletHoles and (not humanoidFound) then
- local Hole = Instance.new("Part")
- Hole.Transparency = 1
- Hole.Anchored = true
- Hole.CanCollide = false
- Hole.FormFactor = "Custom"
- Hole.Size = V3(1, 1, 0.2)
- Hole.TopSurface = 0
- Hole.BottomSurface = 0
- local Mesh = Instance.new("BlockMesh")
- Mesh.Offset = V3(0, 0, -0.05)
- Mesh.Scale = V3(S.holeSettings.Size, S.holeSettings.Size, 0)
- Mesh.Parent = Hole
- local Decal = Instance.new("Decal")
- Decal.Face = Enum.NormalId.Front
- Decal.Texture = S.holeSettings.Texture
- Decal.Parent = Hole
- Hole.Parent = gunIgnore
- Hole.CFrame = surfaceCF
- if (not H.Anchored) then
- local Weld = Instance.new("Weld", Hole)
- Weld.Part0 = H
- Weld.Part1 = Hole
- Weld.C0 = H.CFrame:toObjectSpace(surfaceCF)
- Hole.Anchored = false
- end
- delay(S.holeSettings.visibleTime, function()
- if S.holeSettings.disappearTime > 0 then
- local t0 = tick()
- while true do
- local Alpha = math.min((tick() - t0) / S.holeSettings.disappearTime, 1)
- Decal.Transparency = numLerp(0, 1, Alpha)
- if Alpha == 1 then break end
- wait()
- end
- Hole:Destroy()
- else
- Hole:Destroy()
- end
- end)
- end
- ----------------------------------------------------------------------------------
- --Creating the spark effect-------------------------------------------------------
- ----------------------------------------------------------------------------------
- if S.bulletSparks and (not humanoidFound) and inList(H.Material, S.sparkSettings.Materials) then
- local Sparks = Instance.new("Part")
- Sparks.Transparency = 1
- Sparks.Anchored = true
- Sparks.CanCollide = false
- Sparks.FormFactor = "Custom"
- Sparks.Size = V3(1, 1, 1)
- Sparks.TopSurface = 0
- Sparks.BottomSurface = 0
- local Particles = nil
- if S.customSparks then
- Particles = getObject(game.ServerStorage, "ParticleEmitter", "bulletSpark"):Clone()
- else
- Particles = Instance.new("ParticleEmitter")
- Particles.Color = ColorSequence.new(S.sparkSettings.Color.Start, S.sparkSettings.Color.End)
- Particles.LightEmission = 1
- Particles.Size = NumberSequence.new(
- {
- NumberSequenceKeypoint.new(0, S.sparkSettings.Size, 0.25);
- NumberSequenceKeypoint.new(1, 0);
- }
- )
- Particles.Texture = S.sparkSettings.Texture
- Particles.Transparency = NumberSequence.new(0)
- Particles.Acceleration = V3(0, -196.2, 0)
- Particles.EmissionDirection = Enum.NormalId.Front
- Particles.Lifetime = NumberRange.new(S.sparkSettings.Lifetime - 0.05, S.sparkSettings.Lifetime + 0.05)
- Particles.Rate = S.sparkSettings.Rate
- Particles.Rotation = NumberRange.new(0, 360)
- Particles.Speed = NumberRange.new(S.sparkSettings.Speed - 5, S.sparkSettings.Speed + 5)
- Particles.VelocitySpread = S.sparkSettings.Spread
- end
- Particles.Parent = Sparks
- Sparks.Parent = gunIgnore
- Sparks.CFrame = surfaceCF
- if (not H.Anchored) then
- local Weld = Instance.new("Weld", Sparks)
- Weld.Part0 = H
- Weld.Part1 = Sparks
- Weld.C0 = H.CFrame:toObjectSpace(surfaceCF)
- Sparks.Anchored = false
- end
- delay(0.1, function()
- Particles.Enabled = false
- wait(Particles.Lifetime.Max)
- Sparks:Destroy()
- end)
- end
- ----------------------------------------------------------------------------------
- --Creating the smoke effect-------------------------------------------------------
- ----------------------------------------------------------------------------------
- if S.bulletSmoke and (not humanoidFound) then
- local Smoke = Instance.new("Part")
- Smoke.Transparency = 1
- Smoke.Anchored = true
- Smoke.CanCollide = false
- Smoke.FormFactor = "Custom"
- Smoke.Size = V3(1, 1, 1)
- Smoke.TopSurface = 0
- Smoke.BottomSurface = 0
- local Particles = Instance.new("ParticleEmitter")
- Particles.Color = ColorSequence.new(S.smokeSettings.objColor and H.Color or S.smokeSettings.Color)
- Particles.LightEmission = 0
- Particles.Size = NumberSequence.new(
- {
- NumberSequenceKeypoint.new(0, S.smokeSettings.Size.Start);
- NumberSequenceKeypoint.new(1, S.smokeSettings.Size.End);
- }
- )
- Particles.Texture = S.smokeSettings.Texture
- Particles.Transparency = NumberSequence.new(
- {
- NumberSequenceKeypoint.new(0, S.smokeSettings.startTransparency);
- NumberSequenceKeypoint.new(0.5, 0.75 * S.smokeSettings.startTransparency + 0.25);
- NumberSequenceKeypoint.new(1, 1);
- }
- )
- Particles.Acceleration = V3(0, -196.2, 0)
- Particles.EmissionDirection = Enum.NormalId.Front
- Particles.Lifetime = NumberRange.new(S.smokeSettings.Lifetime - 0.05, S.smokeSettings.Lifetime + 0.05)
- Particles.Rate = S.smokeSettings.Rate
- Particles.Rotation = NumberRange.new(0, 360)
- Particles.RotSpeed = NumberRange.new(10)
- Particles.Speed = NumberRange.new(S.smokeSettings.Speed - 5, S.smokeSettings.Speed + 5)
- Particles.VelocitySpread = S.smokeSettings.Spread
- Particles.Parent = Smoke
- Smoke.Parent = gunIgnore
- Smoke.CFrame = surfaceCF
- if (not H.Anchored) then
- local Weld = Instance.new("Weld", Smoke)
- Weld.Part0 = H
- Weld.Part1 = Smoke
- Weld.C0 = H.CFrame:toObjectSpace(surfaceCF)
- Smoke.Anchored = false
- end
- delay(0.1, function()
- Particles.Enabled = false
- wait(S.smokeSettings.Lifetime + 0.05)
- Smoke:Destroy()
- end)
- end
- end)
- ----------------------------------------------------------------------
- --------------------[ SHOCKWAVE HANDLING ]----------------------------
- ----------------------------------------------------------------------
- local createShockwave = script:WaitForChild("createShockwave")
- createShockwave.OnServerEvent:connect(function(_, Center, Radius, gunIgnore, S)
- local Shockwave = Instance.new("Part")
- Shockwave.BrickColor = S.shockwaveSettings.Color
- Shockwave.Material = Enum.Material.SmoothPlastic
- Shockwave.Name = "Shockwave"
- Shockwave.Anchored = true
- Shockwave.CanCollide = false
- Shockwave.FormFactor = Enum.FormFactor.Symmetric
- Shockwave.Size = V3(1, 1, 1)
- Shockwave.BottomSurface = Enum.SurfaceType.Smooth
- Shockwave.TopSurface = Enum.SurfaceType.Smooth
- local Mesh = Instance.new("SpecialMesh")
- Mesh.MeshType = Enum.MeshType.Sphere
- Mesh.Scale = V3()
- Mesh.Parent = Shockwave
- Shockwave.Parent = gunIgnore
- Shockwave.CFrame = CF(Center)
- spawn(function()
- local t0 = tick()
- while true do
- local Alpha = math.min((tick() - t0) / S.shockwaveSettings.Duration, 1)
- local Scale = 2 * Radius * Alpha
- Mesh.Scale = V3(Scale, Scale, Scale)
- Shockwave.Transparency = Alpha
- if Alpha == 1 then break end
- wait()
- end
- Shockwave:Destroy()
- end)
- end)
- ----------------------------------------------------------------------
- --------------------[ BLOOD HANDLING ]--------------------------------
- ----------------------------------------------------------------------
- local createBlood = script:WaitForChild("createBlood")
- createBlood.OnServerEvent:connect(function(_, H, P, D, gunIgnore, S)
- local bloodCF = CF(P, P + D) * CFANG(RAD(-90), 0, 0)
- local Blood = Instance.new("Part")
- Blood.Transparency = 1
- Blood.Anchored = true
- Blood.CanCollide = false
- Blood.FormFactor = "Custom"
- Blood.Size = V3(0.2, 1, 0.2)
- Blood.TopSurface = 0
- Blood.BottomSurface = 0
- local Particles = Instance.new("ParticleEmitter")
- Particles.Color = ColorSequence.new(S.bloodSettings.Color)
- Particles.LightEmission = 0
- Particles.Size = NumberSequence.new(S.bloodSettings.Size)
- Particles.Texture = S.bloodSettings.Texture
- Particles.Transparency = NumberSequence.new(
- {
- NumberSequenceKeypoint.new(0, S.bloodSettings.startTransparency);
- NumberSequenceKeypoint.new(1, 1);
- }
- )
- Particles.EmissionDirection = Enum.NormalId.Top
- Particles.Lifetime = NumberRange.new(S.bloodSettings.Lifetime - 0.05, S.bloodSettings.Lifetime + 0.05)
- Particles.Rate = S.bloodSettings.Rate
- Particles.Rotation = NumberRange.new(0, 90)
- Particles.Speed = NumberRange.new(S.bloodSettings.Speed)
- Particles.VelocitySpread = S.bloodSettings.Spread
- Particles.Parent = Blood
- Blood.Parent = gunIgnore
- Blood.CFrame = bloodCF
- if (not H.Anchored) then
- local Weld = Instance.new("Weld", Blood)
- Weld.Part0 = H
- Weld.Part1 = Blood
- Weld.C0 = H.CFrame:toObjectSpace(bloodCF)
- Blood.Anchored = false
- end
- delay(0.15, function()
- Particles.Enabled = false
- wait(S.bloodSettings.Lifetime + 0.05)
- Blood:Destroy()
- end)
- end)
- ----------------------------------------------------------------------
- --------------------[ TRAIL HANDLING ]--------------------------------
- ----------------------------------------------------------------------
- local createTrail = script:WaitForChild("createTrail")
- createTrail.OnServerEvent:connect(function(_, Origin, P, gunIgnore, S)
- local Trail = Instance.new("Part")
- Trail.BrickColor = S.trailSettings.Color
- Trail.Transparency = S.trailSettings.Transparency
- Trail.Anchored = true
- Trail.CanCollide = false
- Trail.Size = V3(1, 1, 1)
- local Mesh = Instance.new("CylinderMesh")
- Mesh.Offset = V3(0, -(P - Origin).magnitude / 2, 0)
- Mesh.Scale = V3(S.trailSettings.Thickness, (P - Origin).magnitude, S.trailSettings.Thickness)
- Mesh.Parent = Trail
- Trail.Parent = gunIgnore
- Trail.CFrame = CF(Origin, P) * CFANG(RAD(90), 0, 0)
- delay(S.trailSettings.visibleTime, function()
- if S.trailSettings.disappearTime > 0 then
- local t0 = tick()
- while true do
- local Alpha = math.min((tick() - t0) / S.trailSettings.disappearTime, 1)
- Trail.Transparency = numLerp(S.trailSettings.Transparency, 1, Alpha)
- if Alpha == 1 then break end
- wait()
- end
- Trail:Destroy()
- else
- Trail:Destroy()
- end
- end)
- end)
- end))
- ObjectValue90.Name = "Plyr"
- ObjectValue90.Parent = Script89
- RemoteFunction91.Name = "getWeldCF"
- RemoteFunction91.Parent = Script89
- RemoteFunction92.Name = "gunSetup"
- RemoteFunction92.Parent = Script89
- RemoteFunction93.Name = "tweenJoint"
- RemoteFunction93.Parent = Script89
- RemoteEvent94.Name = "onRenderStep"
- RemoteEvent94.Parent = Script89
- RemoteFunction95.Name = "createTweenIndicator"
- RemoteFunction95.Parent = Script89
- RemoteFunction96.Name = "deleteTweenIndicator"
- RemoteFunction96.Parent = Script89
- RemoteFunction97.Name = "lerpCF"
- RemoteFunction97.Parent = Script89
- LocalScript98.Name = "resetCam"
- LocalScript98.Parent = Script89
- table.insert(cors,sandbox(LocalScript98,function()
- repeat wait() until game.Players.LocalPlayer.Character
- local Player = game.Players.LocalPlayer
- local Char = Player.Character
- local Humanoid = Char:WaitForChild("Humanoid")
- local Cam = game.Workspace.CurrentCamera
- local UIS = game:GetService("UserInputService")
- local ignoreCode = script:WaitForChild("ignoreCode")
- repeat wait() until ignoreCode.Value ~= 0
- local ignoreModel = game.Workspace:WaitForChild("ignoreModel_"..ignoreCode.Value)
- local gunIgnore = ignoreModel:FindFirstChild("gunIgnore_"..Player.Name)
- Cam.FieldOfView = 70
- Cam.CameraType = Enum.CameraType.Custom
- Cam:ClearAllChildren()
- UIS.MouseBehavior = Enum.MouseBehavior.Default
- UIS.MouseIconEnabled = true
- Player.CameraMode = Enum.CameraMode.Classic
- Humanoid.WalkSpeed = 16
- Humanoid.AutoRotate = true
- if gunIgnore then gunIgnore:Destroy() end
- end))
- IntValue99.Name = "ignoreCode"
- IntValue99.Parent = LocalScript98
- RemoteEvent100.Name = "createBulletImpact"
- RemoteEvent100.Parent = Script89
- RemoteEvent101.Name = "createShockwave"
- RemoteEvent101.Parent = Script89
- RemoteEvent102.Name = "createBlood"
- RemoteEvent102.Parent = Script89
- RemoteEvent103.Name = "createTrail"
- RemoteEvent103.Parent = Script89
- IntValue104.Name = "StoredAmmo"
- IntValue104.Parent = Tool0
- IntValue104.Value = 50
- Part105.Name = "AimPart"
- Part105.Parent = Tool0
- Part105.Transparency = 1
- Part105.Rotation = Vector3.new(0.149999991, 0, 0)
- Part105.CanCollide = false
- Part105.FormFactor = Enum.FormFactor.Custom
- Part105.Size = Vector3.new(0.38940534, 0.364850193, 0.364850193)
- Part105.CFrame = CFrame.new(1.19500005, 1.73000002, -0.61500001, 1, 0, 0, 0, 0.999996662, -0.00260399911, 0, 0.00260399911, 0.999996662)
- Part105.Position = Vector3.new(1.19500005, 1.73000002, -0.61500001)
- Part105.Orientation = Vector3.new(0.149999991, 0, 0)
- BlockMesh106.Parent = Part105
- BlockMesh106.Scale = Vector3.new(0.442413986, 0.425265998, 0.0123011963)
- BlockMesh106.Scale = Vector3.new(0.442413986, 0.425265998, 0.0123011963)
- Part107.Name = "Lens"
- Part107.Parent = Tool0
- Part107.BrickColor = BrickColor.new("Really black")
- Part107.Transparency = 1
- Part107.Rotation = Vector3.new(-89.8499985, 0, -180)
- Part107.Anchored = true
- Part107.CanCollide = false
- Part107.FormFactor = Enum.FormFactor.Custom
- Part107.Size = Vector3.new(0.38940534, 0.364850193, 0.364850193)
- Part107.CFrame = CFrame.new(1.73000002, 0.578508019, -0.666062057, -1, 0, 0, 0, -0.00260399911, 0.999996662, 0, 0.999996662, 0.00260399911)
- Part107.BottomSurface = Enum.SurfaceType.Smooth
- Part107.TopSurface = Enum.SurfaceType.Smooth
- Part107.Color = Color3.new(0.0666667, 0.0666667, 0.0666667)
- Part107.Position = Vector3.new(1.73000002, 0.578508019, -0.666062057)
- Part107.Orientation = Vector3.new(-89.8499985, 0, 180)
- Part107.Color = Color3.new(0.0666667, 0.0666667, 0.0666667)
- CylinderMesh108.Parent = Part107
- CylinderMesh108.Scale = Vector3.new(0.722060204, 0.0594919883, 0.659188926)
- CylinderMesh108.Scale = Vector3.new(0.722060204, 0.0594919883, 0.659188926)
- Part109.Name = "Main"
- Part109.Parent = Tool0
- Part109.BrickColor = BrickColor.new("Really black")
- Part109.Transparency = 1
- Part109.Rotation = Vector3.new(0.149999991, 0, 0)
- Part109.Anchored = true
- Part109.CanCollide = false
- Part109.FormFactor = Enum.FormFactor.Custom
- Part109.Size = Vector3.new(0.403505504, 0.364850193, 0.364850193)
- Part109.CFrame = CFrame.new(1.73000002, 0.578508019, -0.666062057, 1, 0, 0, 0, 0.999996662, -0.00260399911, 0, 0.00260399911, 0.999996662)
- Part109.BottomSurface = Enum.SurfaceType.Smooth
- Part109.TopSurface = Enum.SurfaceType.Smooth
- Part109.Color = Color3.new(0.0666667, 0.0666667, 0.0666667)
- Part109.Position = Vector3.new(1.73000002, 0.578508019, -0.666062057)
- Part109.Orientation = Vector3.new(0.149999991, 0, 0)
- Part109.Color = Color3.new(0.0666667, 0.0666667, 0.0666667)
- BlockMesh110.Parent = Part109
- BlockMesh110.Scale = Vector3.new(1, 0.996046901, 0.945985377)
- BlockMesh110.Scale = Vector3.new(1, 0.996046901, 0.945985377)
- BillboardGui111.Name = "FlashGui"
- BillboardGui111.Parent = Part109
- BillboardGui111.Size = UDim2.new(1.10000002, 0, 1.10000002, 0)
- BillboardGui111.Enabled = false
- ImageLabel112.Name = "Label"
- ImageLabel112.Parent = BillboardGui111
- ImageLabel112.Transparency = 1
- ImageLabel112.Size = UDim2.new(1, 0, 1, 0)
- ImageLabel112.BackgroundTransparency = 1
- ImageLabel112.Image = "http://www.roblox.com/asset/?id=117472237"
- PointLight113.Name = "FlashFX"
- PointLight113.Parent = Part109
- PointLight113.Color = Color3.new(1, 1, 0)
- PointLight113.Enabled = false
- PointLight113.Brightness = 10
- PointLight113.Range = 6
- PointLight113.Shadows = true
- PointLight113.Color = Color3.new(1, 1, 0)
- Part114.Name = "Lens"
- Part114.Parent = Tool0
- Part114.BrickColor = BrickColor.new("Really black")
- Part114.Transparency = 1
- Part114.Rotation = Vector3.new(-89.8499985, 0, -180)
- Part114.Anchored = true
- Part114.CanCollide = false
- Part114.FormFactor = Enum.FormFactor.Custom
- Part114.Size = Vector3.new(0.38940534, 0.364850193, 0.364850193)
- Part114.CFrame = CFrame.new(1.73000002, 0.578508019, -0.666062057, -1, 0, 0, 0, -0.00260399911, 0.999996662, 0, 0.999996662, 0.00260399911)
- Part114.BottomSurface = Enum.SurfaceType.Smooth
- Part114.TopSurface = Enum.SurfaceType.Smooth
- Part114.Color = Color3.new(0.0666667, 0.0666667, 0.0666667)
- Part114.Position = Vector3.new(1.73000002, 0.578508019, -0.666062057)
- Part114.Orientation = Vector3.new(-89.8499985, 0, 180)
- Part114.Color = Color3.new(0.0666667, 0.0666667, 0.0666667)
- CylinderMesh115.Parent = Part114
- CylinderMesh115.Scale = Vector3.new(0.515757143, 0.0594919883, 0.470849395)
- CylinderMesh115.Scale = Vector3.new(0.515757143, 0.0594919883, 0.470849395)
- Part116.Name = "Mag"
- Part116.Parent = Tool0
- Part116.Transparency = 1
- Part116.Rotation = Vector3.new(0.149999991, 0, 0)
- Part116.CanCollide = false
- Part116.FormFactor = Enum.FormFactor.Custom
- Part116.Size = Vector3.new(0.38940534, 0.649256229, 0.364850193)
- Part116.CFrame = CFrame.new(1.82999992, 1.37798369, -0.463978738, 1, 0, 0, 0, 0.999996781, -0.00260399934, 0, 0.00260399934, 0.999996781)
- Part116.Position = Vector3.new(1.82999992, 1.37798369, -0.463978738)
- Part116.Orientation = Vector3.new(0.149999991, 0, 0)
- BlockMesh117.Parent = Part116
- BlockMesh117.Scale = Vector3.new(0.822785795, 1, 0.84503746)
- BlockMesh117.Scale = Vector3.new(0.822785795, 1, 0.84503746)
- IntValue118.Name = "ClipSize"
- IntValue118.Parent = Tool0
- IntValue118.Value = 5
- IntValue119.Name = "Ammo"
- IntValue119.Parent = Tool0
- IntValue119.Value = 5
- IntValue120.Name = "LethalGrenades"
- IntValue120.Parent = Tool0
- IntValue120.Value = 15
- Part121.Name = "Flash"
- Part121.Parent = Tool0
- Part121.BrickColor = BrickColor.new("Really black")
- Part121.Transparency = 1
- Part121.Rotation = Vector3.new(-89.8499985, 0, 0)
- Part121.Anchored = true
- Part121.CanCollide = false
- Part121.FormFactor = Enum.FormFactor.Custom
- Part121.Size = Vector3.new(0.38940534, 0.386546612, 0.364850193)
- Part121.CFrame = CFrame.new(1.73000002, 0.578508019, -0.666062057, 1, 0, 0, 0, 0.00260399911, 0.999996662, 0, -0.999996662, 0.00260399911)
- Part121.BottomSurface = Enum.SurfaceType.Smooth
- Part121.TopSurface = Enum.SurfaceType.Smooth
- Part121.Color = Color3.new(0.0666667, 0.0666667, 0.0666667)
- Part121.Position = Vector3.new(1.73000002, 0.578508019, -0.666062057)
- Part121.Orientation = Vector3.new(-89.8499985, 0, 0)
- Part121.Color = Color3.new(0.0666667, 0.0666667, 0.0666667)
- SpecialMesh122.Parent = Part121
- SpecialMesh122.Scale = Vector3.new(0.91849041, 1.5, 0.754664302)
- SpecialMesh122.MeshType = Enum.MeshType.Sphere
- SpecialMesh122.Scale = Vector3.new(0.91849041, 1.5, 0.754664302)
- Part123.Name = "Handle"
- Part123.Parent = Tool0
- Part123.Transparency = 1
- Part123.Rotation = Vector3.new(0.149999991, 0, 0)
- Part123.CanCollide = false
- Part123.FormFactor = Enum.FormFactor.Custom
- Part123.Size = Vector3.new(0.38940534, 0.937814534, 0.51385355)
- Part123.CFrame = CFrame.new(1.73000002, 0.578508019, -0.666062057, 1, 0, 0, 0, 0.999996662, -0.00260399911, 0, 0.00260399911, 0.999996662)
- Part123.Position = Vector3.new(1.73000002, 0.578508019, -0.666062057)
- Part123.Orientation = Vector3.new(0.149999991, 0, 0)
- BlockMesh124.Parent = Part123
- BlockMesh124.Scale = Vector3.new(0.719937682, 1, 1)
- BlockMesh124.Scale = Vector3.new(0.719937682, 1, 1)
- Sound125.Name = "FireSound"
- Sound125.Parent = Part123
- Sound125.SoundId = "http://www.roblox.com/asset?id=130113322"
- Sound125.Volume = 1
- Sound126.Name = "ReloadSound"
- Sound126.Parent = Part123
- Sound126.SoundId = "rbxassetid://336591667"
- Sound126.Volume = 10
- Model127.Name = "2"
- Model127.Parent = Tool0
- Part128.Parent = Model127
- Part128.Material = Enum.Material.Metal
- Part128.Anchored = true
- Part128.Size = Vector3.new(0.130000085, 0.169999495, 0.230000034)
- Part128.CFrame = CFrame.new(0.900000513, 1.31499946, -0.864999652, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- Part128.BottomSurface = Enum.SurfaceType.Smooth
- Part128.TopSurface = Enum.SurfaceType.Smooth
- Part128.Position = Vector3.new(0.900000513, 1.31499946, -0.864999652)
- Part129.Parent = Model127
- Part129.Material = Enum.Material.Metal
- Part129.Anchored = true
- Part129.Size = Vector3.new(0.15000008, 0.0799995065, 0.0500000007)
- Part129.CFrame = CFrame.new(0.890000463, 1.2699995, -0.954999566, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- Part129.BottomSurface = Enum.SurfaceType.Smooth
- Part129.TopSurface = Enum.SurfaceType.Smooth
- Part129.Position = Vector3.new(0.890000463, 1.2699995, -0.954999566)
- ManualWeld130.Name = "Part-to-Part Strong Joint"
- ManualWeld130.Parent = Part129
- ManualWeld130.C0 = CFrame.new(-0.0750000402, -0.0399997532, 0.0250000004, 0.99999994, 0, 0, 0, 1, 0, 0, 0, 0.99999994)
- ManualWeld130.C1 = CFrame.new(-0.350000024, -0.0799999237, -0.0899999142, 0.99999994, 0, 0, 0, 1, 0, 0, 0, 0.99999994)
- ManualWeld130.Part0 = Part129
- ManualWeld130.Part1 = Part155
- Model131.Name = "Nozzle"
- Model131.Parent = Tool0
- Part132.Parent = Model131
- Part132.Material = Enum.Material.Metal
- Part132.BrickColor = BrickColor.new("Black")
- Part132.Anchored = true
- Part132.Shape = Enum.PartType.Cylinder
- Part132.Size = Vector3.new(0.330000132, 0.200000003, 0.25000003)
- Part132.CFrame = CFrame.new(-0.100000329, 1.25999963, -0.595000029, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- Part132.BottomSurface = Enum.SurfaceType.Smooth
- Part132.TopSurface = Enum.SurfaceType.Smooth
- Part132.Color = Color3.new(0.105882, 0.164706, 0.207843)
- Part132.Position = Vector3.new(-0.100000329, 1.25999963, -0.595000029)
- Part132.Color = Color3.new(0.105882, 0.164706, 0.207843)
- Part133.Parent = Model131
- Part133.Material = Enum.Material.Metal
- Part133.BrickColor = BrickColor.new("Black")
- Part133.Anchored = true
- Part133.Shape = Enum.PartType.Cylinder
- Part133.Size = Vector3.new(0.330000132, 0.200000003, 0.25000003)
- Part133.CFrame = CFrame.new(0.249999702, 1.25999963, -0.595000029, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- Part133.BottomSurface = Enum.SurfaceType.Smooth
- Part133.TopSurface = Enum.SurfaceType.Smooth
- Part133.Color = Color3.new(0.105882, 0.164706, 0.207843)
- Part133.Position = Vector3.new(0.249999702, 1.25999963, -0.595000029)
- Part133.Color = Color3.new(0.105882, 0.164706, 0.207843)
- Part134.Parent = Model131
- Part134.Material = Enum.Material.Metal
- Part134.BrickColor = BrickColor.new("Black")
- Part134.Anchored = true
- Part134.Shape = Enum.PartType.Ball
- Part134.Size = Vector3.new(0.0799999088, 0.0799999088, 0.0799999088)
- Part134.CFrame = CFrame.new(0.0799999982, 1.26125109, -0.595000029, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- Part134.BottomSurface = Enum.SurfaceType.Smooth
- Part134.TopSurface = Enum.SurfaceType.Smooth
- Part134.Color = Color3.new(0.105882, 0.164706, 0.207843)
- Part134.Position = Vector3.new(0.0799999982, 1.26125109, -0.595000029)
- Part134.Color = Color3.new(0.105882, 0.164706, 0.207843)
- Part135.Parent = Model131
- Part135.Material = Enum.Material.Metal
- Part135.BrickColor = BrickColor.new("Black")
- Part135.Anchored = true
- Part135.Shape = Enum.PartType.Cylinder
- Part135.Size = Vector3.new(0.330000132, 0.200000003, 0.25000003)
- Part135.CFrame = CFrame.new(-0.100000329, 1.30999959, -0.595000029, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- Part135.BottomSurface = Enum.SurfaceType.Smooth
- Part135.TopSurface = Enum.SurfaceType.Smooth
- Part135.Color = Color3.new(0.105882, 0.164706, 0.207843)
- Part135.Position = Vector3.new(-0.100000329, 1.30999959, -0.595000029)
- Part135.Color = Color3.new(0.105882, 0.164706, 0.207843)
- SpecialMesh136.Parent = Part135
- SpecialMesh136.MeshId = "rbxassetid://551372416"
- SpecialMesh136.Scale = Vector3.new(0.330000013, 0.0399999991, 0.0250000004)
- SpecialMesh136.MeshType = Enum.MeshType.FileMesh
- SpecialMesh136.Scale = Vector3.new(0.330000013, 0.0399999991, 0.0250000004)
- Model137.Name = "Trigger"
- Model137.Parent = Tool0
- Part138.Parent = Model137
- Part138.Material = Enum.Material.DiamondPlate
- Part138.Rotation = Vector3.new(0, 0, -5)
- Part138.Anchored = true
- Part138.Size = Vector3.new(0.153988227, 0.0624980405, 0.0835047141)
- Part138.CFrame = CFrame.new(1.38130295, 1.02090204, -0.727726996, 0.996191978, 0.0871869996, 0, -0.0871869996, 0.996191978, 0, 0, 0, 1)
- Part138.BottomSurface = Enum.SurfaceType.Smooth
- Part138.TopSurface = Enum.SurfaceType.Smooth
- Part138.Position = Vector3.new(1.38130295, 1.02090204, -0.727726996)
- Part138.Orientation = Vector3.new(0, 0, -5)
- SpecialMesh139.Parent = Part138
- SpecialMesh139.MeshType = Enum.MeshType.Torso
- ManualWeld140.Name = "Part-to-Part Strong Joint"
- ManualWeld140.Parent = Part138
- ManualWeld140.C0 = CFrame.new(-0.0769941136, 0.0312490202, 0.041752357, -0.99999994, 0, 0, 0, 0, 0.99999994, 0, 1, 0)
- ManualWeld140.C1 = CFrame.new(0.247326612, -0.201254606, -0.0809746981, -0.996191919, 0, 0.0871869922, 0.0871869922, 0, 0.996191919, 0, 1, 0)
- ManualWeld140.Part0 = Part138
- ManualWeld140.Part1 = Part165
- Part141.Parent = Model137
- Part141.Material = Enum.Material.DiamondPlate
- Part141.Rotation = Vector3.new(0, 0, 175)
- Part141.Anchored = true
- Part141.Size = Vector3.new(0.123194449, 0.10652779, 0.0668058023)
- Part141.CFrame = CFrame.new(1.36668897, 0.854288995, -0.719370008, -0.996191978, -0.0871869996, 0, 0.0871869996, -0.996191978, 0, 0, 0, 1)
- Part141.BottomSurface = Enum.SurfaceType.Smooth
- Part141.TopSurface = Enum.SurfaceType.Smooth
- Part141.Position = Vector3.new(1.36668897, 0.854288995, -0.719370008)
- Part141.Orientation = Vector3.new(0, 0, 175)
- SpecialMesh142.Parent = Part141
- SpecialMesh142.MeshType = Enum.MeshType.Torso
- ManualWeld143.Name = "Part-to-Part Strong Joint"
- ManualWeld143.Parent = Part141
- ManualWeld143.C0 = CFrame.new(0.0615972243, -0.0532638952, 0.0334029011, 1, 0, 0, 0, 0, -1, -0, 1, 0)
- ManualWeld143.C1 = CFrame.new(-0.0616314821, -0.0229838956, 0.0334087275, -1.00000095, 1.70530487e-13, 1.95399252e-13, 1.95399252e-13, 8.94073423e-07, 1.00000143, 1.13686865e-13, 1.00000238, -8.94073366e-07)
- ManualWeld143.Part0 = Part141
- ManualWeld143.Part1 = Part144
- Part144.Parent = Model137
- Part144.Material = Enum.Material.DiamondPlate
- Part144.Rotation = Vector3.new(0, 0, -5)
- Part144.Anchored = true
- Part144.Size = Vector3.new(0.123194449, 0.0500000007, 0.0668058693)
- Part144.CFrame = CFrame.new(1.37336302, 0.930227995, -0.719377995, 0.996191978, 0.0871869996, 0, -0.0871869996, 0.996191978, 0, 0, 0, 1)
- Part144.BottomSurface = Enum.SurfaceType.Smooth
- Part144.TopSurface = Enum.SurfaceType.Smooth
- Part144.Position = Vector3.new(1.37336302, 0.930227995, -0.719377995)
- Part144.Orientation = Vector3.new(0, 0, -5)
- SpecialMesh145.Parent = Part144
- SpecialMesh145.MeshType = Enum.MeshType.Torso
- Part146.Parent = Model137
- Part146.Material = Enum.Material.DiamondPlate
- Part146.Rotation = Vector3.new(0, 0, 175)
- Part146.Anchored = true
- Part146.Size = Vector3.new(0.153988227, 0.133155569, 0.0835046396)
- Part146.CFrame = CFrame.new(1.37294698, 0.925948024, -0.727719009, -0.996191978, -0.0871869996, 0, 0.0871869996, -0.996191978, 0, 0, 0, 1)
- Part146.BottomSurface = Enum.SurfaceType.Smooth
- Part146.TopSurface = Enum.SurfaceType.Smooth
- Part146.Position = Vector3.new(1.37294698, 0.925948024, -0.727719009)
- Part146.Orientation = Vector3.new(0, 0, 175)
- SpecialMesh147.Parent = Part146
- SpecialMesh147.MeshType = Enum.MeshType.Torso
- ManualWeld148.Name = "Part-to-Part Strong Joint"
- ManualWeld148.Parent = Part146
- ManualWeld148.C0 = CFrame.new(0.0769941136, -0.0665777847, 0.0417523198, 1, 0, 0, 0, 0, -1, -0, 1, 0)
- ManualWeld148.C1 = CFrame.new(-0.0770369396, -0.0287289694, 0.041759599, -1.00000095, 1.70530487e-13, 1.95399252e-13, 1.95399252e-13, 8.94073423e-07, 1.00000143, 1.13686865e-13, 1.00000238, -8.94073366e-07)
- ManualWeld148.Part0 = Part146
- ManualWeld148.Part1 = Part138
- Part149.Parent = Tool0
- Part149.Material = Enum.Material.Metal
- Part149.Anchored = true
- Part149.Size = Vector3.new(0.119999968, 0.169999912, 0.099999994)
- Part149.CFrame = CFrame.new(1.21500003, 1.72504497, -0.490000069, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- Part149.BottomSurface = Enum.SurfaceType.Smooth
- Part149.TopSurface = Enum.SurfaceType.Smooth
- Part149.Position = Vector3.new(1.21500003, 1.72504497, -0.490000069)
- ManualWeld150.Name = "Part-to-Part Strong Joint"
- ManualWeld150.Parent = Part149
- ManualWeld150.C0 = CFrame.new(-0.0599999838, 0.0849999562, 0.049999997, -1, 0, 0, 0, 0, 1, 0, 1, 0)
- ManualWeld150.C1 = CFrame.new(-0.0599999428, -0.0500321388, 0.174999952, -1, 0, 0, 0, 0, 1, 0, 1, 0)
- ManualWeld150.Part0 = Part149
- ManualWeld150.Part1 = Part160
- Part151.Parent = Tool0
- Part151.Material = Enum.Material.Metal
- Part151.Anchored = true
- Part151.Size = Vector3.new(0.119999968, 0.199999973, 0.099999994)
- Part151.CFrame = CFrame.new(1.21500003, 1.740049, -0.74000001, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- Part151.BottomSurface = Enum.SurfaceType.Smooth
- Part151.TopSurface = Enum.SurfaceType.Smooth
- Part151.Position = Vector3.new(1.21500003, 1.740049, -0.74000001)
- Part152.Parent = Tool0
- Part152.Material = Enum.Material.Metal
- Part152.Rotation = Vector3.new(0, 0, 7.32999992)
- Part152.Anchored = true
- Part152.Size = Vector3.new(0.330000013, 0.819999754, 0.370000094)
- Part152.CFrame = CFrame.new(1.73000002, 0.629999995, -0.605000019, 0.99183023, -0.127565026, 0, 0.127565026, 0.99183023, 0, 0, 0, 1)
- Part152.BottomSurface = Enum.SurfaceType.Smooth
- Part152.TopSurface = Enum.SurfaceType.Smooth
- Part152.Position = Vector3.new(1.73000002, 0.629999995, -0.605000019)
- Part152.Orientation = Vector3.new(0, 0, 7.32999992)
- Part153.Parent = Tool0
- Part153.Material = Enum.Material.Metal
- Part153.Anchored = true
- Part153.Size = Vector3.new(0.0800000057, 0.439999461, 0.140000001)
- Part153.CFrame = CFrame.new(1.20499921, 0.809999883, -0.680000007, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- Part153.BottomSurface = Enum.SurfaceType.Smooth
- Part153.TopSurface = Enum.SurfaceType.Smooth
- Part153.Position = Vector3.new(1.20499921, 0.809999883, -0.680000007)
- Part154.Parent = Tool0
- Part154.Material = Enum.Material.Neon
- Part154.BrickColor = BrickColor.new("Really red")
- Part154.Anchored = true
- Part154.Shape = Enum.PartType.Ball
- Part154.Size = Vector3.new(0.100000903, 0.100000903, 0.100000903)
- Part154.CFrame = CFrame.new(1.19500005, 1.73000002, -0.61500001, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- Part154.BottomSurface = Enum.SurfaceType.Smooth
- Part154.TopSurface = Enum.SurfaceType.Smooth
- Part154.Color = Color3.new(1, 0, 0)
- Part154.Position = Vector3.new(1.19500005, 1.73000002, -0.61500001)
- Part154.Color = Color3.new(1, 0, 0)
- Part155.Parent = Tool0
- Part155.Material = Enum.Material.Neon
- Part155.BrickColor = BrickColor.new("Really black")
- Part155.Transparency = 0.30000001192093
- Part155.Anchored = true
- Part155.Size = Vector3.new(0.470000058, 0.0700000003, 0.210000008)
- Part155.CFrame = CFrame.new(1.16500044, 1.3099997, -0.839999676, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- Part155.BottomSurface = Enum.SurfaceType.Smooth
- Part155.TopSurface = Enum.SurfaceType.Smooth
- Part155.Color = Color3.new(0.0666667, 0.0666667, 0.0666667)
- Part155.Position = Vector3.new(1.16500044, 1.3099997, -0.839999676)
- Part155.Color = Color3.new(0.0666667, 0.0666667, 0.0666667)
- Part156.Parent = Tool0
- Part156.Material = Enum.Material.Metal
- Part156.Anchored = true
- Part156.Size = Vector3.new(0.349999994, 0.0500000007, 0.350000054)
- Part156.CFrame = CFrame.new(1.18999994, 1.56499922, -0.61499989, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- Part156.BottomSurface = Enum.SurfaceType.Smooth
- Part156.TopSurface = Enum.SurfaceType.Smooth
- Part156.Position = Vector3.new(1.18999994, 1.56499922, -0.61499989)
- ManualWeld157.Name = "Part-to-Part Strong Joint"
- ManualWeld157.Parent = Part156
- ManualWeld157.C0 = CFrame.new(-0.174999997, 0.0250000004, 0.175000027, -1, 0, 0, 0, 0, 1, 0, 1, 0)
- ManualWeld157.C1 = CFrame.new(-0.200000048, -0.0250227451, 0.175000131, -1, 0, 0, 0, 0, 1, 0, 1, 0)
- ManualWeld157.Part0 = Part156
- ManualWeld157.Part1 = Part161
- Part158.Parent = Tool0
- Part158.Material = Enum.Material.Glass
- Part158.Transparency = 0.5
- Part158.Anchored = true
- Part158.Size = Vector3.new(0.0600000024, 0.180000022, 0.189999953)
- Part158.CFrame = CFrame.new(1.19500005, 1.73004901, -0.615000129, 0.999999881, 0, 0, 0, 0.999999881, 0, 0, 0, 1)
- Part158.BottomSurface = Enum.SurfaceType.Smooth
- Part158.TopSurface = Enum.SurfaceType.Smooth
- Part158.Position = Vector3.new(1.19500005, 1.73004901, -0.615000129)
- ManualWeld159.Name = "Part-to-Part Strong Joint"
- ManualWeld159.Parent = Part158
- ManualWeld159.C0 = CFrame.new(-0.0300000012, 0.090000011, 0.0949999765, -0.99999994, 0, 0, 0, 0, 0.99999994, 0, 1, 0)
- ManualWeld159.C1 = CFrame.new(-0.0499999523, -0.040027976, 0.0949998498, -0.99999994, 0, 0, 0, 0, 0.99999994, 0, 1, 0)
- ManualWeld159.Part0 = Part158
- ManualWeld159.Part1 = Part160
- Part160.Parent = Tool0
- Part160.Material = Enum.Material.Metal
- Part160.Anchored = true
- Part160.Size = Vector3.new(0.119999968, 0.099999994, 0.350000054)
- Part160.CFrame = CFrame.new(1.21500003, 1.86007702, -0.61500001, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- Part160.BottomSurface = Enum.SurfaceType.Smooth
- Part160.TopSurface = Enum.SurfaceType.Smooth
- Part160.Position = Vector3.new(1.21500003, 1.86007702, -0.61500001)
- Part161.Parent = Tool0
- Part161.Material = Enum.Material.Metal
- Part161.Anchored = true
- Part161.Size = Vector3.new(0.119999968, 0.0500000007, 0.350000054)
- Part161.CFrame = CFrame.new(1.21500003, 1.61502194, -0.61500001, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- Part161.BottomSurface = Enum.SurfaceType.Smooth
- Part161.TopSurface = Enum.SurfaceType.Smooth
- Part161.Position = Vector3.new(1.21500003, 1.61502194, -0.61500001)
- ManualWeld162.Name = "Part-to-Part Strong Joint"
- ManualWeld162.Parent = Part161
- ManualWeld162.C0 = CFrame.new(-0.0599999838, 0.0250000004, 0.175000027, -1, 0, 0, 0, 0, 1, 0, 1, 0)
- ManualWeld162.C1 = CFrame.new(-0.0599999428, -0.0850230455, 0.0500000715, -1, 0, 0, 0, 0, 1, 0, 1, 0)
- ManualWeld162.Part0 = Part161
- ManualWeld162.Part1 = Part149
- ManualWeld163.Name = "Part-to-Part Strong Joint"
- ManualWeld163.Parent = Part161
- ManualWeld163.C0 = CFrame.new(-0.0599999838, 0.0250000004, 0.175000027, -1, 0, 0, 0, 0, 1, 0, 1, 0)
- ManualWeld163.C1 = CFrame.new(-0.0599999428, -0.100027084, 0.300000012, -1, 0, 0, 0, 0, 1, 0, 1, 0)
- ManualWeld163.Part0 = Part161
- ManualWeld163.Part1 = Part151
- Part164.Parent = Tool0
- Part164.Material = Enum.Material.Metal
- Part164.Anchored = true
- Part164.Size = Vector3.new(0.690001309, 0.109999485, 0.150000006)
- Part164.CFrame = CFrame.new(1.50999963, 0.645000041, -0.685000002, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- Part164.BottomSurface = Enum.SurfaceType.Smooth
- Part164.TopSurface = Enum.SurfaceType.Smooth
- Part164.Position = Vector3.new(1.50999963, 0.645000041, -0.685000002)
- Part165.Parent = Tool0
- Part165.Material = Enum.Material.Metal
- Part165.Anchored = true
- Part165.Size = Vector3.new(1.87000036, 0.559999585, 0.389999956)
- Part165.CFrame = CFrame.new(1.05999994, 1.25999951, -0.604999959, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- Part165.BottomSurface = Enum.SurfaceType.Smooth
- Part165.TopSurface = Enum.SurfaceType.Smooth
- Part165.Position = Vector3.new(1.05999994, 1.25999951, -0.604999959)
- ManualWeld166.Name = "Part-to-Part Strong Joint"
- ManualWeld166.Parent = Part165
- ManualWeld166.C0 = CFrame.new(-0.935000181, -0.279999793, -0.194999978, -0, 0, -1, 0, 1, 0, 1, 0, -0)
- ManualWeld166.C1 = CFrame.new(0.0449997634, -0.281251371, -0.204999924, 0, 0, -1, 0, 1, 0, 1, 0, 0)
- ManualWeld166.Part0 = Part165
- ManualWeld166.Part1 = Part134
- ManualWeld167.Name = "Part-to-Part Strong Joint"
- ManualWeld167.Parent = Part165
- ManualWeld167.C0 = CFrame.new(-0.935000181, 0.279999793, 0.194999978, -1, 0, 0, 0, 0, 1, 0, 1, 0)
- ManualWeld167.C1 = CFrame.new(-1.06500018, -0.0249999762, 0.204999924, -1, 0, 0, 0, 0, 1, 0, 1, 0)
- ManualWeld167.Part0 = Part165
- ManualWeld167.Part1 = Part156
- Script168.Name = "qPerfectionWeld"
- Script168.Parent = Tool0
- table.insert(cors,sandbox(Script168,function()
- -- Created by Quenty (@Quenty, follow me on twitter).
- -- Should work with only ONE copy, seamlessly with weapons, trains, et cetera.
- -- Parts should be ANCHORED before use. It will, however, store relatives values and so when tools are reparented, it'll fix them.
- --[[ INSTRUCTIONS
- - Place in the model
- - Make sure model is anchored
- - That's it. It will weld the model and all children.
- THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
- THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
- THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
- THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
- THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
- THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
- THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
- THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
- This script is designed to be used is a regular script. In a local script it will weld, but it will not attempt to handle ancestory changes.
- ]]
- --[[ DOCUMENTATION
- - Will work in tools. If ran more than once it will not create more than one weld. This is especially useful for tools that are dropped and then picked up again.
- - Will work in PBS servers
- - Will work as long as it starts out with the part anchored
- - Stores the relative CFrame as a CFrame value
- - Takes careful measure to reduce lag by not having a joint set off or affected by the parts offset from origin
- - Utilizes a recursive algorith to find all parts in the model
- - Will reweld on script reparent if the script is initially parented to a tool.
- - Welds as fast as possible
- ]]
- -- qPerfectionWeld.lua
- -- Created 10/6/2014
- -- Author: Quenty
- -- Version 1.0.3
- -- Updated 10/14/2014 - Updated to 1.0.1
- --- Bug fix with existing ROBLOX welds ? Repro by asimo3089
- -- Updated 10/14/2014 - Updated to 1.0.2
- --- Fixed bug fix.
- -- Updated 10/14/2014 - Updated to 1.0.3
- --- Now handles joints semi-acceptably. May be rather hacky with some joints. :/
- local NEVER_BREAK_JOINTS = false -- If you set this to true it will never break joints (this can create some welding issues, but can save stuff like hinges).
- local function CallOnChildren(Instance, FunctionToCall)
- -- Calls a function on each of the children of a certain object, using recursion.
- FunctionToCall(Instance)
- for _, Child in next, Instance:GetChildren() do
- CallOnChildren(Child, FunctionToCall)
- end
- end
- local function GetNearestParent(Instance, ClassName)
- -- Returns the nearest parent of a certain class, or returns nil
- local Ancestor = Instance
- repeat
- Ancestor = Ancestor.Parent
- if Ancestor == nil then
- return nil
- end
- until Ancestor:IsA(ClassName)
- return Ancestor
- end
- local function GetBricks(StartInstance)
- local List = {}
- -- if StartInstance:IsA("BasePart") then
- -- List[#List+1] = StartInstance
- -- end
- CallOnChildren(StartInstance, function(Item)
- if Item:IsA("BasePart") then
- List[#List+1] = Item;
- end
- end)
- return List
- end
- local function Modify(Instance, Values)
- -- Modifies an Instance by using a table.
- assert(type(Values) == "table", "Values is not a table");
- for Index, Value in next, Values do
- if type(Index) == "number" then
- Value.Parent = Instance
- else
- Instance[Index] = Value
- end
- end
- return Instance
- end
- local function Make(ClassType, Properties)
- -- Using a syntax hack to create a nice way to Make new items.
- return Modify(Instance.new(ClassType), Properties)
- end
- local Surfaces = {"TopSurface", "BottomSurface", "LeftSurface", "RightSurface", "FrontSurface", "BackSurface"}
- local HingSurfaces = {"Hinge", "Motor", "SteppingMotor"}
- local function HasWheelJoint(Part)
- for _, SurfaceName in pairs(Surfaces) do
- for _, HingSurfaceName in pairs(HingSurfaces) do
- if Part[SurfaceName].Name == HingSurfaceName then
- return true
- end
- end
- end
- return false
- end
- local function ShouldBreakJoints(Part)
- --- We do not want to break joints of wheels/hinges. This takes the utmost care to not do this. There are
- -- definitely some edge cases.
- if NEVER_BREAK_JOINTS then
- return false
- end
- if HasWheelJoint(Part) then
- return false
- end
- local Connected = Part:GetConnectedParts()
- if #Connected == 1 then
- return false
- end
- for _, Item in pairs(Connected) do
- if HasWheelJoint(Item) then
- return false
- elseif not Item:IsDescendantOf(script.Parent) then
- return false
- end
- end
- return true
- end
- local function WeldTogether(Part0, Part1, JointType, WeldParent)
- --- Weld's 2 parts together
- -- @param Part0 The first part
- -- @param Part1 The second part (Dependent part most of the time).
- -- @param [JointType] The type of joint. Defaults to weld.
- -- @param [WeldParent] Parent of the weld, Defaults to Part0 (so GC is better).
- -- @return The weld created.
- JointType = JointType or "Weld"
- local RelativeValue = Part1:FindFirstChild("qRelativeCFrameWeldValue")
- local NewWeld = Part1:FindFirstChild("qCFrameWeldThingy") or Instance.new(JointType)
- Modify(NewWeld, {
- Name = "qCFrameWeldThingy";
- Part0 = Part0;
- Part1 = Part1;
- C0 = CFrame.new();--Part0.CFrame:inverse();
- C1 = RelativeValue and RelativeValue.Value or Part1.CFrame:toObjectSpace(Part0.CFrame); --Part1.CFrame:inverse() * Part0.CFrame;-- Part1.CFrame:inverse();
- Parent = Part1;
- })
- if not RelativeValue then
- RelativeValue = Make("CFrameValue", {
- Parent = Part1;
- Name = "qRelativeCFrameWeldValue";
- Archivable = true;
- Value = NewWeld.C1;
- })
- end
- return NewWeld
- end
- local function WeldParts(Parts, MainPart, JointType, DoNotUnanchor)
- -- @param Parts The Parts to weld. Should be anchored to prevent really horrible results.
- -- @param MainPart The part to weld the model to (can be in the model).
- -- @param [JointType] The type of joint. Defaults to weld.
- -- @parm DoNotUnanchor Boolean, if true, will not unachor the model after cmopletion.
- for _, Part in pairs(Parts) do
- if ShouldBreakJoints(Part) then
- Part:BreakJoints()
- end
- end
- for _, Part in pairs(Parts) do
- if Part ~= MainPart then
- WeldTogether(MainPart, Part, JointType, MainPart)
- end
- end
- if not DoNotUnanchor then
- for _, Part in pairs(Parts) do
- Part.Anchored = false
- end
- MainPart.Anchored = false
- end
- end
- local function PerfectionWeld()
- local Tool = GetNearestParent(script, "Tool")
- local Parts = GetBricks(script.Parent)
- local PrimaryPart = Tool and Tool:FindFirstChild("Handle") and Tool.Handle:IsA("BasePart") and Tool.Handle or script.Parent:IsA("Model") and script.Parent.PrimaryPart or Parts[1]
- if PrimaryPart then
- WeldParts(Parts, PrimaryPart, "Weld", false)
- else
- warn("qWeld - Unable to weld part")
- end
- return Tool
- end
- local Tool = PerfectionWeld()
- if Tool and script.ClassName == "Script" then
- --- Don't bother with local scripts
- script.Parent.AncestryChanged:connect(function()
- PerfectionWeld()
- end)
- end
- -- Created by Quenty (@Quenty, follow me on twitter).
- end))
- for i,v in pairs(mas:GetChildren()) do
- v.Parent = game:GetService("Players").LocalPlayer.Backpack
- pcall(function() v:MakeJoints() end)
- end
- mas:Destroy()
- for i,v in pairs(cors) do
- spawn(function()
- pcall(v)
- end)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement