make some value names more clean and do nothing else (this is roblox lua module script)
-- Decompiled with the Synapse X Luau decompiler.
local l__ReplicatedStorage__1 = game:GetService("ReplicatedStorage");
local l__RunService__2 = game:GetService("RunService");
local l__ServerStorage__3 = game:GetService("ServerStorage");
local v4 = _G.require("ProjectileFramework");
local v5 = _G.require("MuzzleHandler");
local v6 = _G.require("FastWait");
local v7 = _G.require("LaserHandler");
local v8 = {};
local u1 = l__RunService__2:IsClient();
local u2 = _G.require("Spring");
local u3 = _G.require("Player");
local l__InputService__4 = _G.require("Velocity"):Init(true):GetService("InputService");
local u5 = _G.require("ShellHandler");
local u6 = _G.require("Math");
local l__Assets__7 = l__ReplicatedStorage__1.Assets;
local u8 = _G.require("AudioHandler");
local u9 = {
__index = v8
};
function v8.new(p1)
local v9 = {};
if u1 then
v9.springs = {};
v9.animations = {};
v9.binds = {};
v9.springs.cameraRotRecoil = u2.new((Vector3.new()));
v9.springs.cameraPosRecoil = u2.new((Vector3.new()));
v9.springs.scope = u2.new((Vector3.new(0, 200, 0)));
v9.springs.knockback = u2.new((Vector3.new()));
u3.viewmodel.springs.vmRotRecoil = u2.new((Vector3.new()));
u3.viewmodel.springs.vmPosRecoil = u2.new((Vector3.new()));
function v9.markHit(p2, p3)
local l__FX__10 = v9.player.PlayerGui:FindFirstChild("FX");
if not l__FX__10 then
return;
end;
l__FX__10.Crosshair.Hitmarker.ImageTransparency = 0;
l__FX__10.Crosshair.Hitmarker.Rotation = math.random(-30, 30);
local v11 = l__FX__10.Crosshair.MarkHit:Clone();
v11.Parent = game.SoundService;
v11:Play();
v11.Ended:Connect(function()
v11:Destroy();
end);
v9.lastHitmarker = os.clock();
end;
function v9.wallShot()
local v12 = nil;
local l__head__13 = u3.head;
v12 = v9.toolModel.RootPart:FindFirstChild("firePoint");
if not l__head__13 or not v12 then
return;
end;
local l__Position__14 = l__head__13.Position;
local v15 = RaycastParams.new();
v15.FilterDescendantsInstances = { u3.character, u3.camera };
v15.FilterType = Enum.RaycastFilterType.Blacklist;
local v16 = workspace:Raycast(l__Position__14, CFrame.new(l__Position__14, v12.WorldPosition).LookVector * (l__Position__14 - v12.WorldPosition).magnitude, v15);
if v16 and v16.Instance and v16.Instance.CanCollide then
return false;
end;
return true;
end;
function v9.getAttachment(p4)
local v17 = v9.attachments and v9.attachments:FindFirstChild(p4);
local v18 = v17 and v17:FindFirstChild("settings");
return v17, v18 and require(v18) or {};
end;
function v9.getFiremode()
return v9.settings.gunFiremodes[v9.firemodeIndex];
end;
function v9.bindInput(p5)
local function v19(p6, p7)
l__InputService__4[p6](p5.mouseType, p5.keyType, function()
p5.execFunction(p7);
end, p5.contextName .. tostring(p7));
v9.binds[#v9.binds + 1] = p5.contextName .. tostring(p7);
end;
v19("BindOnBegan", true);
v19("BindOnEnded", false);
end;
function v9.ejectShell()
if not v9.equipped then
return;
end;
if not v9.settings.gunShellEjection then
return;
end;
local l__chamberPoint__20 = v9.toolModel.RootPart:FindFirstChild("chamberPoint");
if not l__chamberPoint__20 then
return;
end;
u5:ejectShell(l__chamberPoint__20, {
name = v9.settings.gunShellName,
velocity = v9.settings.gunShellVelocity,
rotvelocity = v9.settings.gunShellRotVelocity
});
end;
function v9.recoilCamera()
local l__recoilCameraTable__21 = v9.settings.recoilCameraTable;
local l__recoilViewmodelTable__22 = v9.settings.recoilViewmodelTable;
local v23, v24 = v9.getAttachment("Sight");
local v25, v26 = v9.getAttachment("Barrel");
local v27 = 1;
if v25 then
v27 = v27 * (1 - (v26.aimRecoilRedution and 0));
end;
if v9.aiming then
v27 = v27 * (1 - (v26.aimRecoilRedution and 0));
end;
if l__recoilCameraTable__21 then
if l__recoilCameraTable__21.rotEnabled then
local v28 = l__recoilCameraTable__21.rotScale * v27;
local l__rotMin__29 = l__recoilCameraTable__21.rotMin;
local l__rotMax__30 = l__recoilCameraTable__21.rotMax;
if u3.stress > 10 then
v28 = v28 + math.min(u3.stress / 5, 15);
end;
if u3.isLimbGibbed("Left Arm") then
v28 = v28 * 2;
end;
local v31 = math.rad((u6.Randomize2(l__rotMin__29.X, l__rotMax__30.X, 0.01)));
local v32 = math.rad((u6.Randomize2(l__rotMin__29.Y, l__rotMax__30.Y, 0.01)));
if v24.scopeEnabled then
v9.springs.knockback:Impulse((Vector3.new(-v31 * v24.scopeKnockbackMultiplier, -v32 * v24.scopeKnockbackMultiplier, 0)));
end;
v9.springs.cameraRotRecoil:Impulse(Vector3.new(v31, v32, (math.rad((u6.Randomize2(l__rotMin__29.Z, l__rotMax__30.Z, 0.01))))) * v28);
task.delay(0.03, function()
v9.springs.cameraRotRecoil:Impulse(Vector3.new(-v31, -v32, 0) * v28);
end);
end;
if l__recoilCameraTable__21.posEnabled then
local l__posMin__33 = l__recoilCameraTable__21.posMin;
local l__posMax__34 = l__recoilCameraTable__21.posMax;
v9.springs.cameraPosRecoil:Impulse(Vector3.new(u6.Randomize2(l__posMin__33.X, l__posMax__34.X, 0.01), u6.Randomize2(l__posMin__33.Y, l__posMax__34.Y, 0.01), (u6.Randomize2(l__posMin__33.Z, l__posMax__34.Z, 0.01))) * (l__recoilCameraTable__21.posScale * v27));
end;
end;
if l__recoilViewmodelTable__22 then
if l__recoilViewmodelTable__22.rotEnabled then
local v35 = l__recoilViewmodelTable__22.rotScale * v27;
local l__rotMin__36 = l__recoilViewmodelTable__22.rotMin;
local l__rotMax__37 = l__recoilViewmodelTable__22.rotMax;
if u3.stress > 10 then
v35 = v35 + math.min(u3.stress / 5, 15);
end;
if u3.isLimbGibbed("Left Arm") then
v35 = v35 * 2;
end;
u3.viewmodel.springs.vmRotRecoil:Impulse(Vector3.new(math.rad((u6.Randomize2(l__rotMin__36.X, l__rotMax__37.X, 0.01))), math.rad((u6.Randomize2(l__rotMin__36.Y, l__rotMax__37.Y, 0.01))), (math.rad((u6.Randomize2(l__rotMin__36.Z, l__rotMax__37.Z, 0.01))))) * v35);
end;
if l__recoilViewmodelTable__22.posEnabled then
local l__posMin__38 = l__recoilViewmodelTable__22.posMin;
local l__posMax__39 = l__recoilViewmodelTable__22.posMax;
u3.viewmodel.springs.vmPosRecoil:Impulse(Vector3.new(u6.Randomize2(l__posMin__38.X, l__posMax__39.X, 0.01), u6.Randomize2(l__posMin__38.Y, l__posMax__39.Y, 0.01), (u6.Randomize2(l__posMin__38.Z, l__posMax__39.Z, 0.01))) * (l__recoilViewmodelTable__22.posScale * v27));
end;
end;
end;
function v9.loadData()
v9.animations = {};
v9.binds = {};
v9.variables = {};
for v40, v41 in pairs(v9.tool:FindFirstChild("variables"):GetChildren()) do
v9.variables[v41.Name] = v41.Value;
end;
local v42, v43 = v9.getAttachment("Sight");
if v43.scopeEnabled then
v9.springs.knockback.s = v43.scopeKnockbackSpeed;
v9.springs.knockback.d = v43.scopeKnockbackDamper;
v9.springs.scope.s = v43.scopeSwaySpeed;
v9.springs.scope.d = v43.scopeSwayDamper;
end;
local l__recoilCameraTable__44 = v9.settings.recoilCameraTable;
local l__recoilViewmodelTable__45 = v9.settings.recoilViewmodelTable;
if l__recoilCameraTable__44 then
if l__recoilCameraTable__44.rotEnabled then
v9.springs.cameraRotRecoil.s = l__recoilCameraTable__44.rotSpeed;
v9.springs.cameraRotRecoil.d = l__recoilCameraTable__44.rotDamper;
end;
if l__recoilCameraTable__44.posEnabled then
v9.springs.cameraPosRecoil.s = l__recoilCameraTable__44.posSpeed;
v9.springs.cameraPosRecoil.d = l__recoilCameraTable__44.posDamper;
end;
end;
if l__recoilViewmodelTable__45 then
if l__recoilViewmodelTable__45.posEnabled then
u3.viewmodel.springs.vmPosRecoil.s = l__recoilViewmodelTable__45.posSpeed;
u3.viewmodel.springs.vmPosRecoil.d = l__recoilViewmodelTable__45.posDamper;
end;
if l__recoilViewmodelTable__45.rotEnabled then
u3.viewmodel.springs.vmRotRecoil.s = l__recoilViewmodelTable__45.rotSpeed;
u3.viewmodel.springs.vmRotRecoil.d = l__recoilViewmodelTable__45.rotDamper;
end;
end;
for v46, v47 in pairs(v9.settings.animations) do
local v48 = Instance.new("Animation");
v48.AnimationId = "rbxassetid://" .. v47.id;
local v49 = u3.humanoid:LoadAnimation(v48);
if not v9.animations[v47.type] then
v9.animations[v47.type] = {};
end;
v9.animations[v47.type][#v9.animations[v47.type] + 1] = {
instance = v48,
track = v49,
data = v47
};
v49:GetMarkerReachedSignal("ejectShell"):Connect(function()
task.spawn(v9.ejectShell);
end);
v49:GetMarkerReachedSignal("magDrop"):Connect(function()
if v9.settings.gunMagazineDropEnabled then
l__Assets__7.Events.Remotes.MagazineDrop:FireServer(v9.toolModel.magPart.Value.CFrame, -v9.toolModel.RootPart:FindFirstChild("magWatcher").WorldCFrame.upVector);
end;
end);
v49:GetMarkerReachedSignal("playSound"):Connect(function(p8)
v9.playSound(p8);
end);
v49:GetMarkerReachedSignal("showAmmo"):Connect(function(p9)
if v9.ammoGUI then
v9.ammoGUI.Enabled = true;
v9.ammoGUI.Magazine.Text = v9.variables.magazine;
end;
end);
v49:GetMarkerReachedSignal("hideAmmo"):Connect(function(p10)
if v9.ammoGUI then
v9.ammoGUI.Enabled = false;
end;
end);
end;
if v9.settings.throwableEnabled then
v9.bindInput({
mouseType = "MouseButton1",
keyType = nil,
execFunction = function(p11)
v9:pinAndThrow(p11);
end,
contextName = "Throw Grenade"
});
end;
if v9.settings.gunEnabled then
v9.bindInput({
mouseType = "MouseButton1",
keyType = nil,
execFunction = function(p12)
v9:fire(p12);
end,
contextName = "Gun Fire"
});
if v9.settings.gunLimitedAmmo then
v9.bindInput({
mouseType = nil,
keyType = "R",
execFunction = function(p13)
v9:reload(p13);
end,
contextName = "Gun Reload"
});
end;
if v9.settings.gunMagazineCheckEnabled then
v9.bindInput({
mouseType = nil,
keyType = "B",
execFunction = function(p14)
v9:magCheck(p14);
end,
contextName = "Magazine Check"
});
end;
end;
if v9.settings.aimEnabled then
v9.bindInput({
mouseType = "MouseButton2",
keyType = nil,
execFunction = function(p15)
v9:aim(p15);
end,
contextName = "Aim"
});
end;
end;
function v9.playSound(p16)
local v50 = v9.sounds and v9.sounds:FindFirstChild(p16);
if not v50 then
return;
end;
local v51 = v50:GetChildren();
local v52 = v51[math.random(1, #v51)];
if p16 ~= "fire" and p16 ~= "fire-s" then
u8:playAudio(v9.toolModel.RootPart, v52);
return;
end;
u8:playFireSound(v9.toolModel.RootPart.muzzlePoint.WorldPosition, v52, {
lowAmmo = v9.settings.gunLowAmmoEnabled and {
CurrentAmmo = v9.variables.magazine,
AmmoPerMag = v9.settings.gunMagazineCapacity,
Instance = v9.sounds:FindFirstChild("lowAmmo"),
Origin = v9.toolModel.RootPart:FindFirstChild("muzzlePoint"),
RaisePitch = v9.settings.gunLowAmmoRaisePitch
},
farSound = v9.settings.gunFarSoundEnabled and {
IDs = v9.settings.gunFarSoundIDs,
Volume = v9.settings.gunFarSoundVolume,
Pitch = u6.Randomize2(v9.settings.gunFarSoundPitch[1], v9.settings.gunFarSoundPitch[2], 0.01),
Distance = v9.settings.gunFarSoundMinDistance
}
});
end;
function v9.playAnim(p17, p18)
local v53 = v9.animations[p17];
if v53 then
local v54 = v53[math.random(1, #v53)];
if v54 then
v54.track:Play(p18);
end;
end;
end;
function v9.stopAnim(p19, p20)
local v55 = v9.animations[p19];
if v55 then
for v56, v57 in pairs(v55) do
v57.track:Stop(p20);
end;
end;
end;
v9.character = p1;
v9.player = game.Players.LocalPlayer;
v9.camera = workspace.Camera;
v9.mouse = v9.player:GetMouse();
else
v9.character = p1;
v9.player = game.Players:GetPlayerFromCharacter(v9.character);
end;
return setmetatable(v9, u9);
end;
local l__RenderStepped__10 = l__RunService__2.RenderStepped;
function v8.pinAndThrow(p21, p22)
if not p21.equipped then
return;
end;
if not p21.actuallyEquipped then
return;
end;
if p21.throwing then
return;
end;
if p21.arming then
return;
end;
if not p22 then
return;
end;
if p21.settings.throwablePinEnabled and not p21.armed then
task.spawn(function()
local v58 = os.clock() + p21.settings.throwablePinTime;
p21.playAnim("pin");
p21.playSound("pin");
p21.arming = true;
while true do
l__RenderStepped__10:Wait();
if v58 < os.clock() then
break;
end;
if not p21.equipped then
break;
end;
end;
if p21.equipped then
p21.armed = true;
p21.playAnim("armed");
end;
p21.arming = false;
end);
return;
end;
if p21.settings.throwablePinEnabled and p21.armed then
task.spawn(function()
local v59 = os.clock() + p21.settings.throwableThrowTime;
p21.playAnim("throw");
p21.stopAnim("armed");
p21.playSound("throw");
p21.armed = false;
p21.throwing = true;
while true do
l__RenderStepped__10:Wait();
if v59 < os.clock() then
break;
end;
if not p21.equipped then
break;
end;
end;
if p21.equipped then
l__Assets__7.Events.Remotes.ThrowGrenade:FireServer(p21.mouse.Hit.p);
end;
p21.throwing = false;
end);
end;
end;
function v8.magCheck(p23, p24)
if not p24 then
return;
end;
if not p23.equipped then
return;
end;
if not p23.actuallyEquipped then
return;
end;
if p23.checkingAmmo then
return;
end;
if p23.reloading then
return;
end;
if u3.running then
return;
end;
p23.firing = false;
p23.aiming = false;
p23.playAnim("magcheck");
u3.toggleBackpack(false);
task.spawn(function()
local v60 = tick() + p23.settings.gunMagazineCheckTime;
p23.checkingAmmo = true;
while true do
l__RenderStepped__10:Wait();
if v60 < tick() then
break;
end;
if not p23.equipped then
break;
end;
end;
u3.toggleBackpack(true);
p23.checkingAmmo = false;
end);
end;
local l__UserInputService__11 = game:GetService("UserInputService");
local l__Players__12 = game:GetService("Players");
local u13 = _G.require("Roblox");
function v8.aim(p25, p26)
if not p25.equipped then
return;
end;
if not p25.actuallyEquipped then
return;
end;
if p25.reloading then
return;
end;
if p25.checkingAmmo then
return;
end;
if u3.running then
return;
end;
if not u3.firstPerson() then
return;
end;
p25.aiming = p26;
if p25.initialSensitivity then
l__UserInputService__11.MouseDeltaSensitivity = p25.initialSensitivity;
p25.initialSensitivity = nil;
end;
if not p25.aiming then
return;
end;
task.spawn(function()
u3.springs.aim.t = 1;
l__Players__12.LocalPlayer.CameraMode = Enum.CameraMode.LockFirstPerson;
u3.setFOV(0, TweenInfo.new(0.5, Enum.EasingStyle.Cubic, Enum.EasingDirection.Out));
local v61 = l__Assets__7.Framework.Sounds.Character.AimSounds:FindFirstChild("AimIn"):Clone();
v61.Parent = p25.toolModel.RootPart;
v61:Play();
v61.Ended:Connect(function()
game.Debris:AddItem(v61, 1);
end);
if u3.animations and u3.animations.headTilt then
u3.animations.headTilt:Play();
end;
local v62, v63 = p25.getAttachment("Sight");
local v64 = v63.aimSensitivity or p25.settings.aimSensitivity;
if v64 then
p25.initialSensitivity = l__UserInputService__11.MouseDeltaSensitivity;
l__UserInputService__11.MouseDeltaSensitivity = l__UserInputService__11.MouseDeltaSensitivity * v64;
end;
if v63.scopeEnabled then
task.spawn(function()
if v63.scopeDelay then
local v65 = tick() + v63.scopeDelay;
while true do
l__RenderStepped__10:Wait();
if v65 < tick() then
break;
end;
if not p25.equipped then
break;
end;
if not p25.aiming then
break;
end;
end;
end;
if p25.equipped and p25.aiming then
p25.scoping = true;
for v66, v67 in pairs(v62:GetDescendants()) do
if v67:IsA("BasePart") then
u13.tween(v67, TweenInfo.new(0.35, Enum.EasingStyle.Linear, Enum.EasingDirection.Out), {
LocalTransparencyModifier = 1
});
end;
end;
end;
end);
end;
while p25.aiming do
l__RenderStepped__10:Wait();
end;
if v63.scopeEnabled then
for v68, v69 in pairs(v62:GetDescendants()) do
if v69:IsA("BasePart") then
u13.tween(v69, TweenInfo.new(0.5, Enum.EasingStyle.Linear, Enum.EasingDirection.Out), {
LocalTransparencyModifier = 0
});
end;
end;
end;
p25.scoping = false;
if u3.animations and u3.animations.headTilt then
u3.animations.headTilt:Stop();
end;
u3.setFOV(0, TweenInfo.new(0.5, Enum.EasingStyle.Cubic, Enum.EasingDirection.Out));
if p25.equipped then
local v70 = l__Assets__7.Framework.Sounds.Character.AimSounds:FindFirstChild("AimOut"):Clone();
v70.Parent = p25.toolModel.RootPart;
v70:Play();
v70.Ended:Connect(function()
game.Debris:AddItem(v70, 1);
end);
end;
if l__UserInputService__11:IsKeyDown(Enum.KeyCode.LeftShift) then
u3.sprint(true);
end;
u3.springs.aim.t = 0;
l__Players__12.LocalPlayer.CameraMode = Enum.CameraMode.Classic;
end);
end;
function v8.reload(p27, p28)
if not p28 then
return;
end;
if not p27.equipped then
return;
end;
if not p27.actuallyEquipped then
return;
end;
if p27.reloading then
return;
end;
if p27.checkingAmmo then
return;
end;
if u3.running then
return;
end;
if p27.variables.reserve == 0 then
return;
end;
if p27.variables.magazine == p27.settings.gunMagazineCapacity then
return;
end;
task.spawn(function()
p27.firing = false;
p27.aiming = false;
p27.reloading = true;
local v71 = p27.settings.gunTacticalReloadEnabled and p27.variables.magazine > 0;
u3.toggleBackpack(false);
if p27.settings.gunClipInReload then
if p27.settings.gunClipInPreReloadEnabled then
p27.playAnim("prereload");
local v72 = tick() + p27.settings.gunClipInPreReloadTime;
while true do
l__RenderStepped__10:Wait();
if v72 < tick() then
break;
end;
if not p27.equipped then
break;
end;
end;
end;
if p27.equipped then
local v73 = math.min(p27.settings.gunMagazineCapacity - p27.variables.magazine, p27.variables.reserve);
for v74 = 1, v73 do
local v75 = tick() + (v74 == v73 and p27.settings.gunClipInLastTime or p27.settings.gunClipInTime);
p27.playAnim("clipinsert");
p27.playSound("clipinsert");
while true do
l__RenderStepped__10:Wait();
if v75 < tick() then
break;
end;
if not p27.equipped then
break;
end;
end;
if not p27.equipped then
break;
end;
local l__variables__76 = p27.variables;
l__variables__76.magazine = l__variables__76.magazine + 1;
local l__variables__77 = p27.variables;
l__variables__77.reserve = l__variables__77.reserve - 1;
end;
p27.stopAnim("clipinsert");
end;
end;
local v78 = tick() + (v71 and p27.settings.gunTacticalReloadTime or p27.settings.gunReloadTime);
if v71 then
local v79 = "tacticalreload";
else
v79 = "reload";
end;
p27.playAnim(v79);
p27.stopAnim("slidelock");
if p27.equipped then
while true do
l__RenderStepped__10:Wait();
if v78 < tick() then
break;
end;
if not p27.equipped then
break;
end;
end;
end;
u3.toggleBackpack(true);
p27.reloading = false;
if p27.equipped then
if not p27.settings.gunClipInReload then
local v80 = math.min(p27.settings.gunMagazineCapacity - p27.variables.magazine, p27.variables.reserve);
p27.variables.magazine = p27.variables.magazine + v80;
p27.variables.reserve = p27.variables.reserve - v80;
end;
task.spawn(function()
l__Assets__7.Events.Remotes.SyncAmmo:FireServer(p27.variables.magazine, p27.variables.reserve, p27.tool);
end);
if l__UserInputService__11:IsMouseButtonPressed(Enum.UserInputType.MouseButton2) then
p27:aim(true);
end;
end;
end);
end;
local u14 = Random.new(os.clock());
local u15 = math.pi / 2;
function v8.fire(p29, p30)
local v81 = nil;
if not p29.equipped then
return;
end;
if not p29.actuallyEquipped then
return;
end;
if p29.reloading then
return;
end;
if p29.checkingAmmo then
return;
end;
if u3.running then
return;
end;
p29.firing = p30;
if not p30 then
return;
end;
if p29.variables.magazine <= 0 then
p29.playSound("dryfire");
p29.playAnim("dryfire");
return;
end;
v81 = function()
if not p29.wallShot() then
return;
end;
if tick() - (p29.lastShot and 0) < 60 / p29.getFiremode().rpm then
return;
end;
if p29.variables.magazine <= 0 then
return;
end;
p29.variables.magazine = p29.variables.magazine - 1;
if p29.variables.magazine == 0 and p29.settings.gunSlidelockEnabled then
p29.playAnim("firelast");
p29.playAnim("slidelock");
else
p29.playAnim("fire");
end;
local v82, v83 = p29.getAttachment("Barrel");
local v84 = v82;
if v84 then
v84 = v83 and v83.barrelType == "Suppressor";
end;
if v84 then
local v85 = "fire-s";
else
v85 = "fire";
end;
p29.playSound(v85);
task.spawn(p29.recoilCamera);
if not p29.settings.gunPump then
task.spawn(p29.ejectShell);
end;
local l__firePoint__86 = p29.toolModel.RootPart:FindFirstChild("firePoint");
local v87 = l__firePoint__86.WorldPosition - l__firePoint__86.WorldCFrame.lookVector * 5;
local v88 = RaycastParams.new();
v88.FilterDescendantsInstances = { u3.character, u3.camera };
local v89 = workspace:Raycast(l__firePoint__86.WorldPosition, -l__firePoint__86.WorldCFrame.lookVector * 5, v88);
if v89 and v89.Instance then
v87 = v89.Position;
end;
local v90, v91 = p29.getAttachment("Sight");
if u3.crouching then
local v92 = 0.65;
else
v92 = 1;
end;
local v93 = p29.settings.gunSpread * (1 - (p29.aiming and v91.aimSpreadRedution or (p29.settings.aimSpreadRedution or 0))) * v92;
if u3.stress > 10 then
v93 = v93 + math.min(u3.stress / 6, 5);
end;
if u3.isLimbGibbed("Left Arm") then
v93 = v93 + 2;
end;
local v94 = {};
for v95 = 1, p29.settings.gunBulletsPerShot do
v94[#v94 + 1] = (CFrame.new(Vector3.new(), l__firePoint__86.WorldCFrame.lookVector) * CFrame.fromOrientation(0, 0, u14:NextNumber(0, u15)) * CFrame.fromOrientation(math.rad((u14:NextNumber(-v93, v93))), 0, 0)).LookVector;
end;
v4:fire(v87, v94, p29.settings, u3.character);
local l__muzzlePoint__96 = p29.toolModel.RootPart:FindFirstChild("muzzlePoint");
if l__muzzlePoint__96 then
v5:visualize(l__muzzlePoint__96, p29.settings.gunMuzzleFlashParticlesEnabled or (v84 and l__Assets__7.Framework.Particles.MuzzleFlash.Suppressed or l__Assets__7.Framework.Particles.MuzzleFlash.Unsuppressed), {
enabled = p29.settings.gunMuzzleFlashLightEnabled,
range = p29.settings.gunMuzzleFlashLightRange,
brightness = p29.settings.gunMuzzleFlashLightBrightness,
color = p29.settings.gunMuzzleFlashLightColor,
lifetime = p29.settings.gunMuzzleFlashLightLifetime
}, nil);
end;
task.spawn(function()
l__Assets__7.Events.Remotes.SyncAmmo:FireServer(p29.variables.magazine, p29.variables.reserve, p29.tool);
end);
p29.lastShot = tick();
end;
local v97 = p29.getFiremode();
if v97.type == "semi" then
task.spawn(function()
v81();
end);
return;
end;
if v97.type == "auto" then
task.spawn(function()
while true do
v6();
v81();
if not p29.firing then
break;
end;
if not p29.equipped then
break;
end;
end;
if l__UserInputService__11:IsKeyDown(Enum.KeyCode.LeftShift) then
u3.sprint(true);
end;
end);
end;
end;
function v8.equip(p31, p32)
if not p32 then
return;
end;
if u1 then
p31.toolModel = l__ReplicatedStorage__1.Assets.Events.Remotes.EquipTool:InvokeServer(p32);
if not p31.toolModel then
return;
else
p31.tool = p32;
p31.module = p32:FindFirstChild("settings");
p31.settings = p31.module and require(p31.module);
p31.attachments = p31.toolModel:FindFirstChild("Attachments");
p31.sounds = p31.toolModel.PrimaryPart:FindFirstChild("sounds");
if p31.settings.gunMagazineCheckEnabled then
local l__AmmoPart__98 = p31.toolModel:FindFirstChild("AmmoPart");
if l__AmmoPart__98 then
p31.ammoGUI = l__Assets__7.Framework:FindFirstChild("AmmoGUI"):Clone();
p31.ammoGUI.Parent = l__AmmoPart__98;
end;
end;
p31.loadData();
p31.playAnim("idle");
if p31.settings.gunSlidelockEnabled and p31.variables.magazine == 0 then
p31.playAnim("emptyequip");
p31.playAnim("slidelock");
else
p31.playAnim("equip");
end;
p31.playSound("equip");
local l__equipOffset__99 = p31.toolModel:FindFirstChild("equipOffset");
p31.equipOffset = l__equipOffset__99 and l__equipOffset__99.Value or CFrame.new();
u3.springs.equip.t = 1;
if p31.initialSensitivity then
l__UserInputService__11.MouseDeltaSensitivity = p31.initialSensitivity;
p31.initialSensitivity = nil;
end;
local l__FX__100 = p31.player.PlayerGui:FindFirstChild("FX");
if l__FX__100 then
l__FX__100.Crosshair.Visible = true;
end;
l__UserInputService__11.MouseIconEnabled = false;
p31.equipped = true;
task.spawn(function()
local v101 = tick() + p31.settings.equipTime;
while true do
l__RenderStepped__10:Wait();
if not p31.equipped then
break;
end;
if v101 < tick() then
break;
end;
end;
if p31.equipped then
p31.actuallyEquipped = true;
if u3.running then
p31.playAnim("sprint");
end;
end;
end);
p31.firemodeIndex = 1;
return;
end;
end;
local l__settings__102 = p32:FindFirstChild("settings");
local v103 = l__settings__102 and require(l__settings__102);
if not v103 then
return;
end;
p31.tool = p32;
p31.module = l__settings__102;
p31.settings = v103;
p31.toolModel = l__ServerStorage__3.ServerAssets.Items:FindFirstChild(p31.settings.name);
if not p31.toolModel then
return;
end;
p31.toolModel = p31.toolModel:Clone();
p31.toolModel.PrimaryPart = p31.toolModel:FindFirstChild("RootPart");
for v104, v105 in pairs(p31.toolModel:GetDescendants()) do
if v105:IsA("BasePart") then
v105.CanCollide = false;
v105.CanTouch = false;
end;
end;
p31.toolModel.Name = "toolModel";
p31.toolModel.Parent = p31.character;
local v106 = { "Right Arm" };
if v103.gripArm then
if v103.gripArm == "Left" then
v106 = { "Left Arm" };
elseif v103.gripArm == "Right" then
v106 = { "Right Arm" };
elseif v103.gripArm == "Both" then
v106 = { "Left Arm", "Right Arm" };
end;
end;
for v107, v108 in pairs(v106) do
local v109 = p31.character:FindFirstChild(v108);
if v109 then
local v110 = v109 and v109:FindFirstChild("toolGrip");
if not v110 then
v110 = Instance.new("Motor6D");
v110.Name = "toolGrip";
v110.Part0 = v109;
v110.Parent = v109;
end;
v110.Part1 = p31.toolModel.RootPart;
end;
end;
p31.variables = p31.tool:FindFirstChild("variables");
if not p31.variables then
p31.variables = Instance.new("Folder");
p31.variables.Name = "variables";
p31.variables.Parent = p31.tool;
local v111 = {};
local v112 = p31.settings.gunEnabled;
if v112 then
v112 = false;
if p31.settings.gunMagazineCapacity ~= math.huge then
v112 = {
name = "magazine",
class = "NumberValue",
value = p31.settings.gunMagazineCapacity
};
end;
end;
v111[1] = v112;
v111[2] = p31.settings.gunEnabled and (p31.settings.gunLimitedAmmo and {
name = "reserve",
class = "NumberValue",
value = p31.settings.gunReserveCapacity
});
for v113, v114 in pairs(v111) do
if v114 ~= nil and v114 ~= false then
local v115 = Instance.new(v114.class);
v115.Name = v114.name;
v115.Value = v114.value;
v115.Parent = p31.variables;
end;
end;
end;
p31.attachments = p31.tool:FindFirstChild("attachments");
if not p31.attachments then
p31.attachments = Instance.new("Folder");
p31.attachments.Name = "attachments";
p31.attachments.Parent = p31.tool;
for v116, v117 in pairs({ "Sight", "Barrel", "Underbarrel" }) do
local v118 = Instance.new("StringValue");
v118.Name = v117;
v118.Value = "";
v118.Parent = p31.attachments;
end;
end;
local l__Nodes__119 = p31.toolModel:FindFirstChild("Nodes");
for v120, v121 in pairs(p31.attachments:GetChildren()) do
if v121:IsA("StringValue") then
local l__Value__122 = v121.Value;
if l__Value__122 ~= "" then
local v123 = l__Assets__7.Framework.Attachments:FindFirstChild(l__Value__122);
if v123 and l__Nodes__119 then
local v124 = v123:Clone();
local l__settings__125 = v124:FindFirstChild("settings");
local v126 = l__settings__125 and require(l__settings__125);
if v126 then
local v127 = l__Nodes__119:FindFirstChild(v126.type);
if v127 then
local l__Node__128 = v124:FindFirstChild("Node");
if l__Node__128 then
v124.PrimaryPart = l__Node__128;
v124.Name = v126.type;
for v129, v130 in pairs(v124:GetDescendants()) do
if v130:IsA("BasePart") then
v130.CanCollide = false;
v130.CanTouch = false;
v130.Anchored = false;
if v130 ~= l__Node__128 then
local v131 = Instance.new("WeldConstraint");
v131.Part0 = l__Node__128;
v131.Part1 = v130;
v131.Name = v130.Name;
v131.Parent = l__Node__128;
end;
end;
end;
local v132 = Instance.new("Weld");
v132.Name = "NodeWeld";
v132.Part0 = v127;
v132.Part1 = l__Node__128;
v132.Parent = l__Node__128;
v124.Parent = p31.toolModel:FindFirstChild("Attachments");
end;
end;
end;
end;
end;
end;
end;
if p31.settings.sounds and #p31.settings.sounds > 0 then
local v133 = Instance.new("Folder");
v133.Name = "sounds";
v133.Parent = p31.toolModel.PrimaryPart;
if p31.settings.gunLowAmmoEnabled then
local v134 = Instance.new("Sound");
v134.Name = "lowAmmo";
v134.Volume = p31.settings.gunLowAmmoVolume and 0.5;
v134.SoundId = "rbxassetid://" .. p31.settings.gunLowAmmoID;
v134.Parent = v133;
end;
local v135, v136, v137 = pairs(p31.settings.sounds);
while true do
local v138, v139 = v135(v136, v137);
if not v138 then
break;
end;
local v140 = v133:FindFirstChild(v139.type);
if not v140 then
v140 = Instance.new("Folder");
v140.Name = v139.type;
v140.Parent = v133;
end;
local v141 = Instance.new("Sound");
v141.PlaybackSpeed = v139.pitch and 1;
v141.Volume = v139.volume and 0.5;
v141.SoundId = "rbxassetid://" .. v139.id;
if v139.type == "fire" or v139.type == "fire-s" then
v141.RollOffMinDistance = 100;
v141.RollOffMaxDistance = 1000;
else
v141.RollOffMaxDistance = 200;
v141.RollOffMinDistance = 10;
end;
v141.Parent = v140;
end;
end;
p31.equipped = true;
return p31.toolModel;
end;
function v8.remove(p33)
if not u1 then
if p33.toolModel then
p33.toolModel:Destroy();
p33.toolModel = nil;
end;
p33.equipped = false;
p33.tool = nil;
p33.module = nil;
p33.settings = nil;
return;
end;
task.spawn(function()
l__Assets__7.Events.Remotes.SyncAmmo:FireServer(p33.variables.magazine, p33.variables.reserve, p33.tool);
l__ReplicatedStorage__1.Assets.Events.Remotes.RemoveTool:InvokeServer();
end);
if p33.initialSensitivity then
l__UserInputService__11.MouseDeltaSensitivity = p33.initialSensitivity;
p33.initialSensitivity = nil;
end;
if p33.ammoGUI then
p33.ammoGUI.Enabled = false;
p33.ammoGUI = nil;
end;
local l__FX__142 = p33.player.PlayerGui:FindFirstChild("FX");
if l__FX__142 then
l__FX__142.Scope.Visible = false;
l__FX__142.Crosshair.Visible = false;
end;
local v143, v144 = p33.getAttachment("Underbarrel");
if v143 then
v7:update(v143.PrimaryPart:FindFirstChild("laserPoint"), {
id = p33.player.UserId,
character = p33.character,
width = v144.laserWidth and 0.2,
color = v144.laserColor or Color3.new(1, 0, 0),
distance = v144.laserDistance and 300
}, false);
end;
for v145, v146 in pairs(p33.binds) do
l__InputService__4.Unbind(v146);
end;
p33.binds = {};
l__UserInputService__11.MouseIconEnabled = true;
u3.springs.equip.t = 0;
p33.aiming = false;
p33.firing = false;
p33.reloading = false;
p33.scoping = false;
p33.equipped = false;
p33.actuallyEquipped = false;
p33.toolModel = nil;
for v147, v148 in pairs(p33.animations) do
p33.stopAnim(v147);
end;
end;
function v8.update(p34, p35)
if p34.camera then
local l__p__149 = p34.springs.cameraRotRecoil.p;
local l__p__150 = p34.springs.cameraPosRecoil.p;
p34.camera.CFrame = p34.camera.CFrame * CFrame.Angles(l__p__149.X, l__p__149.Y, l__p__149.Z) * CFrame.new(l__p__150.X, l__p__150.Y, l__p__150.Z);
end;
if p34.equipped then
local v151, v152 = p34.getAttachment("Underbarrel");
if v151 then
v7:update(v151.PrimaryPart:FindFirstChild("laserPoint"), {
id = p34.player.UserId,
character = p34.character,
width = v152.laserWidth and 0.2,
color = v152.laserColor or Color3.new(1, 0, 0),
distance = v152.laserDistance and 300
}, true);
end;
local v153, v154 = p34.getAttachment("Sight");
if v153 then
for v155, v156 in pairs(v153:GetChildren()) do
if v156:IsA("BasePart") and string.match(v156.Name, "ProjectorSight") then
local l__SurfaceGui__157 = v156.SurfaceGui;
l__SurfaceGui__157.Adornee = v156;
local v158 = v156.CFrame:pointToObjectSpace(p34.camera.CFrame.Position) / v156.Size;
l__SurfaceGui__157.ClippingFrame.Reticle.Position = UDim2.new(0.5 + v158.x, 0, 0.5 - v158.y, 0);
end;
end;
end;
if v154.scopeEnabled then
p34.springs.knockback.t = p34.springs.knockback.t:Lerp(Vector3.new(), 0.2);
end;
local l__FX__159 = p34.player.PlayerGui:FindFirstChild("FX");
if l__FX__159 then
if v154.scopeEnabled then
local v160 = l__UserInputService__11:GetMouseDelta() / v154.scopeSensitive;
local v161 = l__FX__159.Scope.Reticle.AbsoluteSize.X * 0.5;
local l__scope__162 = p34.springs.scope;
local l__knockback__163 = p34.springs.knockback;
l__FX__159.Scope.Visible = p34.scoping;
l__FX__159.Scope.Reticle.Position = UDim2.new(0.5, l__scope__162.p.X + l__knockback__163.p.Y * 1000, 0.5, l__scope__162.p.Y + l__knockback__163.p.X * 200);
p34.springs.scope.t = Vector3.new(v161 + v160.X, -v161 + v160.Y, 0);
end;
if p34.toolModel and p34.toolModel.RootPart:FindFirstChild("firePoint") then
local v164, v165 = p34.camera:WorldToScreenPoint((p34.toolModel.RootPart.firePoint.WorldCFrame * CFrame.new(0, 0, -5000)).p);
l__FX__159.Crosshair.Position = UDim2.fromOffset(v164.X, v164.Y);
else
l__FX__159.Crosshair.Position = UDim2.fromOffset(p34.mouse.X, p34.mouse.Y);
end;
if os.clock() - (p34.lastHitmarker and 0) > 0.25 then
local l__Rotation__166 = l__FX__159.Crosshair.Hitmarker.Rotation;
l__FX__159.Crosshair.Hitmarker.Rotation = l__Rotation__166 + (0 - l__Rotation__166) * 0.1;
local l__ImageTransparency__167 = l__FX__159.Crosshair.Hitmarker.ImageTransparency;
l__FX__159.Crosshair.Hitmarker.ImageTransparency = l__ImageTransparency__167 + (1 - l__ImageTransparency__167) * 0.1;
end;
end;
end;
end;
return v8;