Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- params : ...
- wait()
- local tool = script.Parent
- local config = tool:WaitForChild("Config")
- local weaponConfig = require(config:WaitForChild("WeaponConfig"))
- local WALK_SPEED = 16
- local TRUE_WALK_SPEED = WALK_SPEED
- local SHOOT_SPEED = 8
- local RUN_SPEED = 20
- local CROUCH_SPEED = 8
- local CAN_CROUCH = true
- local RELOAD_SPEED = SHOOT_SPEED
- local BULLET_SPEED = 1600
- local BULLET_STEP = 0.1
- local WIND_SCALE = 0.1
- local MAX_STEPS = 15
- local SPREAD = nil
- if weaponConfig.gunType == "rifle" then
- SPREAD = 0.001
- else
- if weaponConfig.gunType == "carbine" then
- SPREAD = 0.008
- else
- SPREAD = 0.007
- end
- end
- local TRUE_SPREAD = SPREAD
- local BULLET_DAMAGE = nil
- BULLET_DAMAGE = {}
- if weaponConfig.gunType == "rifle" then
- BULLET_DAMAGE.Head = 100
- BULLET_DAMAGE.Torso = 100
- BULLET_DAMAGE["Left Arm"] = 100
- BULLET_DAMAGE["Right Arm"] = 100
- BULLET_DAMAGE["Left Leg"] = 90
- BULLET_DAMAGE["Right Leg"] = 90
- else
- if weaponConfig.gunType == "carbine" then
- BULLET_DAMAGE.Head = 100
- BULLET_DAMAGE.Torso = 90
- BULLET_DAMAGE["Left Arm"] = 60
- BULLET_DAMAGE["Right Arm"] = 60
- BULLET_DAMAGE["Left Leg"] = 45
- BULLET_DAMAGE["Right Leg"] = 45
- else
- BULLET_DAMAGE.Head = 100
- BULLET_DAMAGE.Torso = 100
- BULLET_DAMAGE["Left Arm"] = 70
- BULLET_DAMAGE["Right Arm"] = 70
- BULLET_DAMAGE["Left Leg"] = 70
- BULLET_DAMAGE["Right Leg"] = 70
- end
- end
- local BLOCK_ANGLE = math.rad(45)
- local MIN_DAMAGE = 30
- local MAX_DAMAGE = 45
- local MIN_TIME = 0.2
- local MAX_TIME = 1.5
- local RETICLE_ON = weaponConfig.gunType == "rifle"
- local RET_STEP = 100
- local RET_RANGE_MAX = 800
- local SHOW_TEAMMATE = true
- local DISABLE_TK = config:WaitForChild("DisableTK").Value
- local SKIRMISH_ON = nil
- do
- local disableSkirmish = config:WaitForChild("DisableSkirmish", 0.25)
- if disableSkirmish then
- SKIRMISH_ON = not disableSkirmish.Value
- else
- SKIRMISH_ON = true
- end
- local SHOW_TRACER = false
- local cfVal = config:WaitForChild("CustomFlags", 0.25)
- if cfVal then
- local sep, key, value = nil, nil, nil
- for entry in cfVal.Value:gmatch("[^,]+") do
- sep = entry:find("=")
- key = entry:sub(1, sep - 1)
- value = entry:sub(sep + 1)
- -- DECOMPILER ERROR at PC126: Unhandled construct in 'MakeBoolean' P1
- if key == "tracer" and value == "true" then
- SHOW_TRACER = true
- end
- if key == "linebattle" and value == "true" then
- SHOOT_SPEED = 0
- CROUCH_SPEED = 0
- RELOAD_SPEED = 0
- CAN_CROUCH = false
- SKIRMISH_ON = false
- end
- end
- end
- local VERSION = "Musket/Rifle/Carbine/Fowling Piece 2.10.0 Public Beta"
- local COS_BA = math.sin(-BLOCK_ANGLE)
- local atan2 = math.atan2
- local random = math.random
- local getTime = time
- local userInputService = game:GetService("UserInputService")
- local cresume, ccreate = coroutine.resume, coroutine.create
- local v3n = Vector3.new
- local cfn = CFrame.new
- local cfa = CFrame.Angles
- local newRay = Ray.new
- local findPartOnRayWithIgnoreList = workspace.FindPartOnRayWithIgnoreList
- local waitForValue = function(val)
- local out = val.Value
- while not out do
- wait()
- out = val.Value
- end
- return out
- end
- local toolModel = waitForValue(tool:WaitForChild("ToolModel"))
- local musketServer = tool:WaitForChild("MusketServer")
- local holdPart = toolModel:WaitForChild("Hold")
- local shootPart = (toolModel:WaitForChild("ShootPart"))
- local hasBayonet, blade = nil, nil
- do
- local bayonet = toolModel:WaitForChild("Bayonet", 0.25)
- if bayonet then
- hasBayonet = true
- blade = bayonet:WaitForChild("Blade")
- else
- hasBayonet = false
- end
- local gunGui = tool:WaitForChild("MusketGui")
- local bulletLabel = gunGui:WaitForChild("BulletLabel")
- local players = game:GetService("Players")
- local player = players.LocalPlayer
- if not player.Character then
- local pChar = player.CharacterAdded:wait()
- end
- local mouse = player:GetMouse()
- local pHead = pChar:WaitForChild("Head")
- local pHum = pChar:WaitForChild("Humanoid")
- local pHRP = pChar:WaitForChild("HumanoidRootPart")
- local pLeftArm, pRightArm = pChar:WaitForChild("Left Arm"), (pChar:WaitForChild("Right Arm"))
- local playerJoints, holdJoint, hammerJoint, rodJoint, frizzenJoint, cartJoint, bayonetJoint = nil, nil, nil, nil, nil, nil, nil
- playerJoints = {}
- do
- local joints = tool:WaitForChild("Joints")
- playerJoints[1] = waitForValue(joints:WaitForChild("LeftShoulder"))
- playerJoints[2] = waitForValue(joints:WaitForChild("RightShoulder"))
- playerJoints[3] = waitForValue(joints:WaitForChild("LeftHip"))
- playerJoints[4] = waitForValue(joints:WaitForChild("RightHip"))
- holdJoint = waitForValue(joints:WaitForChild("Hold"))
- hammerJoint = waitForValue(joints:WaitForChild("Hammer"))
- rodJoint = waitForValue(joints:WaitForChild("Rod"))
- frizzenJoint = waitForValue(joints:WaitForChild("Frizzen"))
- cartJoint = waitForValue(joints:WaitForChild("Cartridge"))
- if hasBayonet then
- bayonetJoint = waitForValue(joints:WaitForChild("Bayonet"))
- end
- local holdDefault, hammerDefault = holdJoint:WaitForChild("Default").Value, hammerJoint:WaitForChild("Default").Value
- local rodDefault = rodJoint:WaitForChild("Default").Value
- local bindJoint, playAnim, loopAnim, setModifier = nil, nil, nil, nil
- do
- local animMgr = player.PlayerGui:WaitForChild("AnimManagerLocal")
- bindJoint = animMgr:WaitForChild("BindJoint")
- playAnim = animMgr:WaitForChild("PlayAnim")
- loopAnim = animMgr:WaitForChild("LoopAnim")
- setModifier = animMgr:WaitForChild("SetModifier")
- local damageUtil = nil
- do
- local utilModules = game:GetService("ReplicatedStorage"):WaitForChild("UtilModules")
- damageUtil = require(utilModules:WaitForChild("DamageUtil"))()
- damageUtil.disableTeamkill = DISABLE_TK
- local sendSound = nil
- do
- local pml = player.PlayerGui:WaitForChild("ProjectileManagerLocal")
- sendSound = pml:WaitForChild("SendSound")
- local playFireEffects = musketServer:WaitForChild("PlayFireEffects")
- local playSound = musketServer:WaitForChild("PlaySound")
- local createHitEffect = musketServer:WaitForChild("CreateHitEffect")
- local toggleLegJoints = musketServer:WaitForChild("ToggleLegJoints")
- local setValue = musketServer:WaitForChild("SetValue")
- local playCartridgeEffect = musketServer:WaitForChild("PlayCartridgeEffect")
- local displayBloodEffect = musketServer:WaitForChild("DisplayBloodEffect")
- local windVal = workspace:WaitForChild("WorldInfo"):WaitForChild("Wind")
- local vAmmo = tool:WaitForChild("Ammo")
- local vBayonetEnabled = tool:WaitForChild("BayonetEnabled")
- local vIsBlocking = pChar:WaitForChild("IsBlocking")
- local isEquipped = false
- local mouseChanged = false
- local animPlaying = false
- local currentPose = "leftHold"
- local musketLoaded = true
- local musketCocked = false
- local reloadCancelled = false
- local isCrouching = false
- local isWalking = false
- local isStabbing = false
- local lastSwingTime = 0
- do
- local displayRecoil = false
- local skirmishMode = false
- local aimingDownSights = false
- local shotgun = nil
- if weaponConfig.gunType == "shotgun" then
- shotgun = {}
- shotgun.shotType = 0
- shotgun.loadedShot = 0
- shotgun.maxShot = 3
- shotgun.damageMaps = {
- [1] = {Head = 25, Torso = 20, ["Left Arm"] = 20, ["Right Arm"] = 20, ["Left Leg"] = 20, ["Right Leg"] = 20}
- ,
- [2] = {Head = 15, Torso = 10, ["Left Arm"] = 10, ["Right Arm"] = 10, ["Left Leg"] = 10, ["Right Leg"] = 10}
- }
- shotgun.getLabelText = function()
- if shotgun.shotType == 0 then
- return "Buckshot"
- else
- if shotgun.shotType == 1 then
- return "Buck & Ball"
- else
- if shotgun.shotType == 2 then
- return "Birdshot"
- else
- if shotgun.shotType == 3 then
- return "Slug"
- end
- end
- end
- end
- end
- end
- local fakeArms, fakeLA, fakeRA, laW, raW = nil, nil, nil, nil, nil
- do
- fakeArms = Instance.new("Model")
- fakeArms.Name = "MusketFakeArms"
- fakeArms.Parent = workspace.CurrentCamera
- do
- local faHum = Instance.new("Humanoid")
- faHum.Name = "FakeArmHumanoid"
- faHum.Parent = fakeArms
- fakeLA = pLeftArm:Clone()
- fakeLA:ClearAllChildren()
- fakeLA.CanCollide = false
- fakeLA.Transparency = 1
- laW = Instance.new("Weld")
- laW.Part0 = pLeftArm
- laW.Part1 = fakeLA
- laW.Parent = fakeLA
- fakeRA = pRightArm:Clone()
- fakeRA:ClearAllChildren()
- fakeRA.CanCollide = false
- fakeRA.Transparency = 1
- raW = Instance.new("Weld")
- raW.Part0 = pRightArm
- raW.Part1 = fakeRA
- raW.Parent = fakeRA
- coroutine.resume(coroutine.create(function()
- wait(1)
- local pShirt = pChar:FindFirstChild("Shirt")
- if pShirt then
- local psC = pShirt:Clone()
- psC.Name = "FakeArmShirt"
- psC.Parent = fakeArms
- end
- end))
- local stabDetector, stabDetector2 = nil, nil
- stabDetector = Instance.new("Part)
- stabDetector.CanCollide = false
- stabDetector.TopSurface = 0
- stabDetector.BottomSurface = 0
- stabDetector.Transparency = 1
- stabDetector.Size = Vector3.new(0., 2, 0.2)
- stabDetector.Parent = toolModel
- stabDetector2 = stabDetector:Clone()
- stabDetector2.Size = Vector3.new(0., 1, 0.2)
- stabDetector2.Parent = toolModel
- local sdWeld = Instance.new("Weld)
- sdWeld.Part0 = shootPart
- sdWeld.Part1 = stabDetector
- sdWeld.C0 = cfn(0, 0.4, 0)
- sdWeld.Parent = stabDetector
- do
- local sd2Weld = Instance.new("Weld")
- sd2Weld.Part0 = shootPart
- sd2Weld.Part1 = stabDetector2
- sd2Weld.C0 = cfn(0, -0.2, 0)
- sd2Weld.Parent = stabDetector2
- local poseAnims, tryDrillPose = nil, nil
- poseAnims = {}
- poseAnims.leftHold = function()
- if animPlaying then
- return
- end
- currentPose = "leftHold"
- pHum.WalkSpeed = WALK_SPEED
- animPlaying = true
- playAnim:Fire(weaponConfig.animNames.switchLeft)
- wait(weaponConfig.animTimes.switchArms)
- animPlaying = false
- end
- poseAnims.returnToLeft = function()
- if animPlaying or currentPose == "leftHold" or currentPose == "makeReady" or currentPose == "presentArms" or currentPose == "bayonetDown" then
- return
- end
- local lastPose = currentPose
- animPlaying = true
- pHum.WalkSpeed = WALK_SPEED
- currentPose = "leftHold"
- if lastPose == "rightHold" then
- playAnim:Fire(weaponConfig.animNames.switchLeft)
- wait(weaponConfig.animTimes.switchArms)
- else
- if lastPose == "orderArms" then
- playAnim:Fire(weaponConfig.animNames.unOrderArms)
- wait(weaponConfig.animTimes.orderArms)
- else
- if lastPose == "trailArms" then
- playAnim:Fire(weaponConfig.animNames.unTrailArms)
- wait(weaponConfig.animTimes.trailArms)
- else
- if lastPose == "portArms" then
- playAnim:Fire(weaponConfig.animNames.unPortArms)
- wait(weaponConfig.animTimes.portArms)
- else
- if lastPose == "rightShoulderShift" then
- playAnim:Fire(weaponConfig.animNames.rightShoulderShiftReturn)
- wait(weaponConfig.animTimes.rightShoulderShift)
- else
- if lastPose == "supportArms" then
- playAnim:Fire(weaponConfig.animNames.unSupportArms)
- wait(weaponConfig.animTimes.supportArms)
- end
- end
- end
- end
- end
- end
- animPlaying = false
- end
- poseAnims.switchRight = function()
- if animPlaying or currentPose ~= "leftHold" then
- return
- end
- currentPose = "rightHold"
- animPlaying = true
- playAnim:Fire(weaponConfig.animNames.switchRight)
- wait(weaponConfig.animTimes.switchArms)
- animPlaying = false
- return true
- end
- poseAnims.orderArms = function()
- if animPlaying or currentPose ~= "leftHold" then
- return
- end
- currentPose = "orderArms"
- pHum.WalkSpeed = 0
- animPlaying = true
- playAnim:Fire("musketOrderArms")
- wait(2.2)
- animPlaying = false
- return true
- end
- poseAnims.trailArms = function()
- if animPlaying or currentPose ~= "leftHold" then
- return
- end
- currentPose = "trailArms"
- if not isCrouching then
- pHum.WalkSpeed = RUN_SPEED
- end
- animPlaying = true
- playAnim:Fire(weaponConfig.animNames.trailArms)
- wait(weaponConfig.animTimes.trailArms)
- animPlaying = false
- return true
- end
- poseAnims.portArms = function()
- if animPlaying or currentPose ~= "leftHold" and currentPose ~= "bayonetDown" then
- return
- end
- local lastPose = currentPose
- currentPose = "portArms"
- animPlaying = true
- if lastPose == "leftHold" then
- playAnim:Fire(weaponConfig.animNames.portArms)
- wait(weaponConfig.animTimes.portArms)
- else
- if not weaponConfig.animNames.portArmsDirect then
- playAnim:Fire(lastPose ~= "bayonetDown" or "musketPortArmsDirect")
- wait(0.4)
- animPlaying = false
- return true
- end
- end
- end
- poseAnims.rightShoulderShift = function()
- if animPlaying or currentPose ~= "leftHold" then
- return
- end
- currentPose = "rightShoulderShift"
- animPlaying = true
- if not isCrouching then
- pHum.WalkSpeed = RUN_SPEED
- end
- playAnim:Fire(weaponConfig.animNames.rightShoulderShift)
- wait(weaponConfig.animTimes.rightShoulderShift)
- animPlaying = false
- return true
- end
- poseAnims.supportArms = function()
- if animPlaying or currentPose ~= "leftHold" then
- return
- end
- currentPose = "supportArms"
- animPlaying = true
- playAnim:Fire(weaponConfig.animNames.supportArms)
- wait(weaponConfig.animTimes.supportArms)
- animPlaying = false
- return true
- end
- poseAnims.makeReady = function()
- if animPlaying then
- return
- end
- if currentPose == "leftHold" then
- currentPose = "makeReady"
- musketCocked = true
- pHum.WalkSpeed = SHOOT_SPEED
- animPlaying = true
- playAnim:Fire(weaponConfig.animNames.makeReady)
- wait(0.65)
- playSound:FireServer("M2")
- wait(0.3)
- animPlaying = false
- else
- if currentPose == "makeReady" then
- currentPose = "leftHold"
- musketCocked = false
- pHum.WalkSpeed = WALK_SPEED
- animPlaying = true
- playAnim:Fire(weaponConfig.animNames.unMakeReady)
- playSound:FireServer("M1")
- wait(0.8)
- animPlaying = false
- end
- end
- end
- poseAnims.presentArms = function()
- if animPlaying then
- return
- end
- animPlaying = true
- pHum.WalkSpeed = SHOOT_SPEED
- if currentPose == "makeReady" or currentPose == "rightHold" then
- playAnim:Fire(weaponConfig.animNames.presentDirect)
- else
- playAnim:Fire(weaponConfig.animNames.presentArms)
- wait(1)
- end
- currentPose = "presentArms"
- wait(0.3)
- animPlaying = false
- end
- poseAnims.presentBack = function()
- if animPlaying then
- return
- end
- musketCocked = true
- animPlaying = true
- playAnim:Fire(weaponConfig.animNames.presentBack)
- wait(0.3)
- playSound:FireServer("M2")
- wait(0.5)
- animPlaying = false
- end
- poseAnims.shootEmpty = function()
- animPlaying = true
- musketCocked = false
- playSound:FireServer("Click")
- playAnim:Fire(weaponConfig.animNames.shootEmpty)
- wait(0.3)
- animPlaying = false
- end
- poseAnims.reload = function()
- animPlaying = true
- currentPose = "reload"
- setModifier:Fire(cfn(), true)
- if RELOAD_SPEED >= CROUCH_SPEED or not RELOAD_SPEED then
- pHum.WalkSpeed = not isCrouching or CROUCH_SPEED
- pHum.WalkSpeed = RELOAD_SPEED
- playAnim:Fire(weaponConfig.animNames.reload)
- local waitErr = wait(weaponConfig.animTimes.reload - 1.6)
- if not weaponConfig.animNames.reloadShoulder then
- playAnim:Fire(skirmishMode or reloadCancelled or "musketReloadShoulder")
- wait(1.6 - waitErr)
- if not reloadCancelled then
- pHum.WalkSpeed = WALK_SPEED
- animPlaying = false
- if skirmishMode then
- if isWalking then
- poseAnims.skirmishHold()
- else
- poseAnims.skirmishPresentDirect()
- end
- else
- currentPose = "leftHold"
- end
- else
- reloadCancelled = false
- end
- end
- end
- end
- poseAnims.stabGrip = function()
- animPlaying = true
- if currentPose == "leftHold" then
- currentPose = "bayonetDown"
- if skirmishMode then
- playAnim:Fire(weaponConfig.animNames.bayonetDownDirect)
- wait(weaponConfig.animTimes.bayonetDownDirect)
- else
- playAnim:Fire(weaponConfig.animNames.bayonetDown)
- wait(weaponConfig.animTimes.bayonetDown)
- end
- else
- if currentPose == "portArms" or currentPose == "presentArms" then
- currentPose = "bayonetDown"
- pHum.WalkSpeed = WALK_SPEED
- playAnim:Fire(weaponConfig.animNames.bayonetDownDirect)
- wait(weaponConfig.animTimes.bayonetDownDirect)
- else
- if skirmishMode then
- animPlaying = false
- if isWalking then
- poseAnims.skirmishHold()
- else
- poseAnims.skirmishPresentDirect()
- end
- else
- currentPose = "leftHold"
- setModifier:Fire(cfn(), true)
- playAnim:Fire(weaponConfig.animNames.bayonetUp)
- wait(weaponConfig.animTimes.bayonetUp)
- end
- end
- end
- animPlaying = false
- end
- poseAnims.toggleBayonet = function()
- animPlaying = true
- local bVal = not vBayonetEnabled.Value
- setValue:FireServer(vBayonetEnabled, bVal)
- if bVal then
- playAnim:Fire(weaponConfig.animNames.mountBayonet)
- else
- playAnim:Fire(weaponConfig.animNames.dismountBayonet)
- end
- wait(weaponConfig.animTimes.toggleBayonet)
- animPlaying = false
- end
- poseAnims.block = function()
- currentPose = "block"
- playAnim:Fire(weaponConfig.animNames.block)
- end
- poseAnims.presentDown = function()
- if animPlaying then
- return
- end
- animPlaying = true
- if musketCocked then
- playAnim:Fire(weaponConfig.animNames.presentDownHammer)
- wait(0.3)
- currentPose = "leftHold"
- setModifier:Fire(cfn(), true)
- wait(0.2)
- musketCocked = false
- playSound:FireServer("M1")
- wait(0.6)
- else
- playAnim:Fire(weaponConfig.animNames.presentDown)
- wait(0.3)
- currentPose = "leftHold"
- setModifier:Fire(cfn(), true)
- wait(0.8)
- end
- pHum.WalkSpeed = WALK_SPEED
- animPlaying = false
- end
- poseAnims.skirmishHoldSwitch = function()
- if animPlaying then
- return
- end
- animPlaying = true
- currentPose = "leftHold"
- playAnim:Fire(weaponConfig.animNames.skirmishHoldSwitch or "musketSkirmishHoldSwitch")
- wait(0.8)
- animPlaying = false
- end
- poseAnims.skirmishHold = function()
- if animPlaying then
- return
- end
- currentPose = "leftHold"
- setModifier:Fire(cfn(), true)
- playAnim:Fire(weaponConfig.animNames.skirmishHold or "musketSkirmishHold")
- end
- poseAnims.skirmishPresent = function()
- if animPlaying then
- return
- end
- animPlaying = true
- playAnim:Fire(weaponConfig.animNames.presentArms)
- wait(1)
- currentPose = "presentArms"
- wait(0.3)
- animPlaying = false
- end
- poseAnims.skirmishPresentDirect = function()
- if animPlaying then
- return
- end
- playAnim:Fire(weaponConfig.animNames.presentDirect)
- currentPose = "presentArms"
- end
- poseAnims.skirmishReturn = function()
- animPlaying = true
- currentPose = "leftHold"
- playAnim:Fire(weaponConfig.animNames.reloadShoulder or "musketReloadShoulder")
- wait(1.6)
- animPlaying = false
- end
- do
- local drillBinds = {[Enum.KeyCode.G] = poseAnims.switchRight, [Enum.KeyCode.H] = poseAnims.orderArms, [Enum.KeyCode.J] = poseAnims.portArms, [Enum.KeyCode.K] = poseAnims.trailArms, [Enum.KeyCode.N] = poseAnims.rightShoulderShift, [Enum.KeyCode.L] = poseAnims.supportArms}
- tryDrillPose = function(keyCode)
- local drill = drillBinds[keyCode]
- if drill and not drill() then
- poseAnims.returnToLeft()
- end
- end
- local retGui, mainRet, invertReticle, isRetInverted, swapReticle, isRetSwapped, shotLabel = nil, nil, nil, nil, nil, nil, nil
- local forceMult = -workspace.Gravity / (BULLET_SPEED * BULLET_SPEED)
- local viewY, sizeX = nil, nil
- retGui = Instance.new("Frame")
- retGui.BackgroundTransparency = 1
- retGui.Size = UDim2.new(0, 0, 0, 0)
- retGui.Parent = gunGui
- local ret = Instance.new("Frame")
- ret.Size = UDim2.new(0, 1, 0, 1)
- ret.Position = UDim2.new(0, 0, 0, 0)
- ret.BackgroundColor3 = Color3.new(1, 1, 1)
- ret.BorderColor3 = Color3.new(0, 0, 0)
- ret.Parent = retGui
- mainRet = ret
- local mainLines = {}
- local retSizes = {}
- do
- if RETICLE_ON then
- local tanHalfFOV = math.tan(math.rad(0.5 * workspace.CurrentCamera.FieldOfView))
- for i = RET_STEP, RET_RANGE_MAX, RET_STEP do
- viewY = math.asin(i * forceMult)
- viewY = viewY * -0.5 * gunGui.AbsoluteSize.y
- sizeX = math.floor(4 / i * tanHalfFOV * 0.5 * gunGui.AbsoluteSize.x)
- if sizeX % 2 == 0 or not sizeX - 1 then
- do
- local frame = Instance.new("Frame")
- frame.Size = UDim2.new(0, sizeX, 0, 1)
- frame.Position = UDim2.new(0, -0.5 * frame.Size.X.Offset, 0, viewY)
- frame.BackgroundColor3 = Color3.new(1, 1, 1)
- frame.BorderSizePixel = 0
- frame.Parent = retGui
- mainLines[#mainLines + 1] = frame
- retSizes[#retSizes + 1] = sizeX
- -- DECOMPILER ERROR at PC838: LeaveBlock: unexpected jumping out IF_THEN_STMT
- -- DECOMPILER ERROR at PC838: LeaveBlock: unexpected jumping out IF_STMT
- end
- end
- end
- end
- bulletLabel.Text = vAmmo.Value .. "/" .. vAmmo.MaxValue
- isRetInverted = false
- isRetSwapped = false
- invertReticle = function()
- isRetInverted = not isRetInverted
- if isRetInverted then
- mainRet.BackgroundColor3 = Color3.new(0, 0, 0)
- mainRet.BorderColor3 = Color3.new(1, 1, 1)
- for _,v in pairs(retGui:GetChildren()) do
- if v:IsA("Frame") and v ~= mainRet then
- v.BackgroundColor3 = Color3.new(0, 0, 0)
- end
- end
- else
- do
- mainRet.BackgroundColor3 = Color3.new(1, 1, 1)
- mainRet.BorderColor3 = Color3.new(0, 0, 0)
- for _,v in pairs(retGui:GetChildren()) do
- if v:IsA("Frame") and v ~= mainRet then
- v.BackgroundColor3 = Color3.new(1, 1, 1)
- end
- end
- end
- end
- end
- swapReticle = function()
- if not RETICLE_ON then
- return
- end
- isRetSwapped = not isRetSwapped
- local frame = nil
- if isRetSwapped then
- for i = 1, #mainLines do
- frame = mainLines[i]
- frame.Size = UDim2.new(0, i % 2 ~= 0 and 12 or 8, 0, 1)
- frame.Position = UDim2.new(0, -0.5 * frame.Size.X.Offset, 0, frame.Position.Y.Offset)
- end
- else
- do
- for i = 1, #mainLines do
- frame = mainLines[i]
- frame.Size = UDim2.new(0, retSizes[i], 0, 1)
- frame.Position = UDim2.new(0, -0.5 * frame.Size.X.Offset, 0, frame.Position.Y.Offset)
- end
- end
- end
- end
- do
- local nameMarker = bulletLabel:Clone()
- nameMarker.FontSize = Enum.FontSize.Size18
- nameMarker.Text = "-whupdup"
- nameMarker.Size = UDim2.new(0, 30, 0, 10)
- nameMarker.Position = UDim2.new(0, 36, 0, 43)
- nameMarker.Parent = bulletLabel
- if weaponConfig.gunType == "shotgun" then
- shotLabel = bulletLabel:Clone()
- shotLabel:ClearAllChildren()
- shotLabel.Text = shotgun.getLabelText()
- shotLabel.FontSize = Enum.FontSize.Size24
- shotLabel.Position = UDim2.new(0, -70, 0, 15)
- shotLabel.Parent = bulletLabel
- end
- local tagHumanoid = function(hum)
- local tag = Instance.new("ObjectValue")
- tag.Name = "creator"
- tag.Value = player
- tag.Parent = hum
- cresume(ccreate(function()
- wait(1)
- if tag and tag.Parent then
- tag:Destroy()
- end
- end))
- end
- local calcMouseHit = function()
- local ray = newRay(mouse.Origin.p, mouse.UnitRay.Direction * 1000)
- return findPartOnRayWithIgnoreList(workspace, ray, {workspace.CurrentCamera, toolModel, pChar})
- end
- local isBarrelObstructed = function()
- local dir = shootPart.CFrame.upVector
- local ray = newRay(shootPart.Position - 5 * dir, dir)
- do
- local hit = findPartOnRayWithIgnoreList(workspace, ray, {workspace.CurrentCamera, pChar, toolModel})
- do return hit ~= nil and not hit.CanCollide or hit.Transparency > 0.99 end
- -- DECOMPILER ERROR: 2 unprocessed JMP targets
- end
- end
- local closestPointToSegment = function(a, b, q)
- local ab = b - a
- local aq = q - a
- local bq = q - b
- local u, v = ab:Dot(aq), ab:Dot(bq)
- if u > 0 and v < 0 then
- ab = ab.unit
- local d = ab:Dot(aq)
- return a + d * ab
- else
- do
- if u <= 0 and v < 0 then
- return a
- else
- return b
- end
- end
- end
- end
- local dispatchWhoosh = function(a, b)
- local head, point = nil, nil
- for _,plr in pairs(players:GetPlayers()) do
- if plr ~= player then
- if plr.Character then
- head = plr.Character:FindFirstChild("Head")
- end
- if head then
- point = closestPointToSegment(a, b, head.Position)
- if point - head.Position.magnitude <= 8 then
- sendSound:Fire(plr, 1, point - head.Position)
- end
- end
- end
- end
- end
- local fireBullet = function(start, pos, dmgMap, spread)
- if isBarrelObstructed() then
- return
- end
- local dSpread = 2 * spread
- local dir = cfn(v3n(), pos - start.unit) * cfa(random() * dSpread - spread, random() * dSpread - spread, 0).lookVector
- local velT = dir * BULLET_SPEED * BULLET_STEP
- local baseGrav = -workspace.Gravity * BULLET_STEP
- local baseWind = windVal.Value * WIND_SCALE * BULLET_STEP
- local grav = baseGrav
- local wind = baseWind
- local numSteps = 1
- local lastStep = start
- local currStep, deltaStep, ray, hit, hPos, hNorm, nextPos, innerCount = nil, nil, nil, nil, nil, nil, nil, nil
- local breakAll = false
- repeat
- deltaStep = velT + v3n(0, grav * BULLET_STEP, 0) + wind * BULLET_STEP
- currStep = lastStep + (deltaStep)
- nextPos = lastStep
- do
- if SHOW_TRACER then
- local p = Instance.new("Part")
- p.Anchored = true
- p.CanCollide = false
- p.BrickColor = BrickColor.Yellow()
- p.Transparency = 0.5
- p.Size = v3n(0.2, 0.2, deltaStep.magnitude)
- p.CFrame = cfn(0.5 * (currStep + lastStep), currStep)
- p.Parent = workspace
- game:GetService("Debris"):AddItem(p, 6)
- end
- local ignoreList = {pChar, toolModel}
- innerCount = 1
- dispatchWhoosh(nextPos, currStep)
- repeat
- ray = newRay(nextPos, currStep - nextPos)
- hit = findPartOnRayWithIgnoreList(workspace, ray, ignoreList)
- if hit then
- local hum = damageUtil:findHumanoid(hit, 2)
- if hum then
- if not workspace.FilteringEnabled then
- tagHumanoid(hum)
- end
- if not dmgMap[hit.Name] or not hit.Name then
- displayBloodEffect:FireServer(hum, weaponConfig.gunType == "shotgun" or (not dmgMap[hit.Name] and not damageUtil:tryDamageHumanoid(hum, dmgMap.Torso)) or "Torso")
- if (dmgMap[hit.Name] and hit.Name) or not dmgMap[hit.Name] then
- do
- displayBloodEffect:FireServer(hum, not dmgMap[hit.Name] and not damageUtil:tryDamageHumanoid(hum, dmgMap.Torso) or "Torso", dmgMap.Torso / BULLET_DAMAGE.Torso)
- damageUtil.hitHums = {}
- createHitEffect:FireServer(cfn(hPos, hPos + hNorm), "Player")
- breakAll = true
- do break end
- if hit.CanCollide and hit.Transparency < 1 then
- createHitEffect:FireServer(cfn(hPos, hPos + hNorm), hit.Material)
- breakAll = true
- break
- end
- ignoreList[#ignoreList + 1] = hit
- innerCount = innerCount + 1
- end
- end
- end
- end
- end
- until not hit or innerCount >= 8
- if breakAll then
- break
- end
- grav = grav + baseGrav
- wind = wind + baseWind
- lastStep = currStep
- numSteps = numSteps + 1
- wait(BULLET_STEP)
- end
- until MAX_STEPS < numSteps
- end
- if weaponConfig.gunType == "shotgun" then
- shotgun.fireShot = function(start, pos)
- if shotgun.loadedShot == 0 then
- for i = 1, 8 do
- cresume(ccreate(fireBullet), start, pos, shotgun.damageMaps[1], 0.02)
- end
- else
- do
- if shotgun.loadedShot == 1 then
- for i = 1, 4 do
- cresume(ccreate(fireBullet), start, pos, shotgun.damageMaps[1], 0.02)
- end
- cresume(ccreate(fireBullet), start, pos, BULLET_DAMAGE, 0.02)
- else
- if shotgun.loadedShot == 2 then
- for i = 1, 12 do
- cresume(ccreate(fireBullet), start, pos, shotgun.damageMaps[2], 0.018)
- end
- else
- do
- if shotgun.loadedShot == 3 then
- cresume(ccreate(fireBullet), start, pos, BULLET_DAMAGE, 0.01)
- end
- end
- end
- end
- end
- end
- end
- end
- local shootMusket = function()
- musketLoaded = false
- musketCocked = false
- if not aimingDownSights then
- playAnim:Fire(weaponConfig.animNames.shoot)
- else
- playAnim:Fire(weaponConfig.animNames.shootADS or "musketShootADS")
- end
- playFireEffects:FireServer()
- wait(0.1)
- local hit, pos = calcMouseHit()
- if weaponConfig.gunType == "shotgun" then
- shotgun.fireShot(shootPart.Position, pos)
- else
- cresume(ccreate(fireBullet), shootPart.Position, pos, BULLET_DAMAGE, SPREAD)
- end
- displayRecoil = true
- mouseChanged = true
- animPlaying = true
- wait(0.4)
- displayRecoil = false
- animPlaying = false
- end
- local onStab = function(hit)
- if not damageUtil.canHit then
- return
- end
- local hum = damageUtil:findHumanoid(hit, 2)
- if hum then
- local dmgScale = (getTime() - lastSwingTime) / MAX_TIME
- if dmgScale <= 1 or not 1 then
- local dmg = MIN_DAMAGE + (MAX_DAMAGE - MIN_DAMAGE) * dmgScale
- local hrp = hum.Parent:FindFirstChild("HumanoidRootPart")
- local hIsBlocking = hum.Parent:FindFirstChild("IsBlocking")
- -- DECOMPILER ERROR at PC62: Unhandled construct in 'MakeBoolean' P1
- if hrp and hIsBlocking and (not hIsBlocking.Value or hrp.CFrame.lookVector:Dot(hrp.Position - pHRP.Position.unit) > COS_BA) then
- if not workspace.FilteringEnabled then
- tagHumanoid(hum)
- end
- if damageUtil:tryDamageHumanoid(hum, dmg) then
- local scl = dmg / BULLET_DAMAGE.Torso
- displayBloodEffect:FireServer(hum, BULLET_DAMAGE[hit.Name] and hit.Name or "Torso", scl)
- end
- end
- do
- if not workspace.FilteringEnabled then
- tagHumanoid(hum)
- end
- do
- if damageUtil:tryDamageHumanoid(hum, dmg) then
- local scl = dmg / BULLET_DAMAGE.Torso
- displayBloodEffect:FireServer(hum, BULLET_DAMAGE[hit.Name] and hit.Name or "Torso", scl)
- end
- playSound:FireServer("Flesh")
- end
- end
- end
- end
- end
- local doStabDamage = function()
- local dir = shootPart.CFrame.upVector
- local vStart = blade.Position - 5 * dir
- local vDir = 5.5 * dir
- local ray = newRay(blade.Position - 5 * dir, 5.5 * dir)
- local hit, pos = findPartOnRayWithIgnoreList(workspace, ray, {pChar, toolModel})
- local p = Instance.new("Part")
- p.Anchored = true
- p.CanCollide = false
- p.Size = Vector3.new(0.2, 0.2, vDir.magnitude)
- p.CFrame = CFrame.new((vStart + vStart + vDir) / 2, vStart)
- p.Parent = workspace
- game.Debris:AddItem(p, 5)
- if hit then
- local hum = damageUtil:findHumanoid(hit, 2)
- if hum then
- local dmgScale = (getTime() - lastSwingTime) / MAX_TIME
- if dmgScale <= 1 or not 1 then
- local dmg = MIN_DAMAGE + (MAX_DAMAGE - MIN_DAMAGE) * dmgScale
- local hrp = hum.Parent:FindFirstChild("HumanoidRootPart")
- local hIsBlocking = hum.Parent:FindFirstChild("IsBlocking")
- -- DECOMPILER ERROR at PC111: Unhandled construct in 'MakeBoolean' P1
- if hrp and hIsBlocking and (not hIsBlocking.Value or hrp.CFrame.lookVector:Dot(hrp.Position - pHRP.Position.unit) > COS_BA) then
- if not workspace.FilteringEnabled then
- tagHumanoid(hum)
- end
- if damageUtil:tryDamageHumanoid(hum, dmg) then
- local scl = dmg / BULLET_DAMAGE.Torso
- displayBloodEffect:FireServer(hum, BULLET_DAMAGE[hit.Name] and hit.Name or "Torso", scl)
- end
- end
- do
- if not workspace.FilteringEnabled then
- tagHumanoid(hum)
- end
- do
- if damageUtil:tryDamageHumanoid(hum, dmg) then
- local scl = dmg / BULLET_DAMAGE.Torso
- displayBloodEffect:FireServer(hum, BULLET_DAMAGE[hit.Name] and hit.Name or "Torso", scl)
- end
- playSound:FireServer("Flesh")
- end
- end
- end
- end
- end
- end
- local stabMusketRelease = function()
- if not isStabbing and not animPlaying then
- return
- end
- local timeDiff = MIN_TIME - (getTime() - lastSwingTime)
- if timeDiff > 0 then
- wait(timeDiff)
- end
- isStabbing = false
- playAnim:Fire(weaponConfig.animNames.stabForward)
- playSound:FireServer("Stab")
- damageUtil:enableHit()
- wait(0.15)
- damageUtil:disableHit()
- wait(0.2)
- animPlaying = false
- end
- local stabMusketHold = function()
- if animPlaying or isStabbing then
- return
- end
- if getTime() - lastSwingTime < MIN_TIME then
- lastSwingTime = getTime()
- return
- end
- animPlaying = true
- isStabbing = true
- lastSwingTime = getTime()
- playAnim:Fire(weaponConfig.animNames.stabBack)
- wait(MAX_TIME)
- if isEquipped and animPlaying and isStabbing and MAX_TIME <= getTime() - lastSwingTime then
- stabMusketRelease()
- end
- end
- local reloadMusket = function()
- if vAmmo.Value <= 0 then
- return
- end
- cresume(ccreate(poseAnims.reload))
- musketCocked = false
- playCartridgeEffect:FireServer()
- for i,soundTime in ipairs(weaponConfig.reloadAudio) do
- wait(soundTime[2])
- if not isEquipped or currentPose ~= "reload" then
- return
- end
- playSound:FireServer(soundTime[1])
- if i == #weaponConfig.reloadAudio - 1 and currentPose == "reload" then
- musketLoaded = true
- setValue:FireServer(vAmmo, vAmmo.Value - 1)
- if weaponConfig.gunType == "shotgun" then
- shotgun.loadedShot = shotgun.shotType
- end
- end
- end
- end
- local toggleCrouch = function()
- isCrouching = not isCrouching
- if isCrouching then
- WALK_SPEED = CROUCH_SPEED
- toggleLegJoints:FireServer(true)
- bindJoint:Fire(playerJoints[3])
- bindJoint:Fire(playerJoints[4])
- loopAnim:Fire(weaponConfig.animNames.crouchDown)
- if currentPose ~= "reload" then
- pHum.WalkSpeed = CROUCH_SPEED
- else
- pHum.WalkSpeed = CROUCH_SPEED < RELOAD_SPEED and CROUCH_SPEED or RELOAD_SPEED
- end
- pHum.HipHeight = -0.8
- wait()
- if isCrouching and isWalking then
- loopAnim:Fire(weaponConfig.animNames.crouchWalk)
- end
- else
- WALK_SPEED = TRUE_WALK_SPEED
- toggleLegJoints:FireServer(false)
- loopAnim:Fire(weaponConfig.animNames.crouchUp)
- pHum.HipHeight = 0
- if currentPose == "makeReady" then
- pHum.WalkSpeed = SHOOT_SPEED
- else
- if not skirmishMode or not WALK_SPEED then
- pHum.WalkSpeed = currentPose ~= "presentArms" or SHOOT_SPEED
- if currentPose == "reload" then
- pHum.WalkSpeed = RELOAD_SPEED
- else
- if currentPose == "trailArms" or currentPose == "rightShoulderShift" then
- pHum.WalkSpeed = RUN_SPEED
- else
- pHum.WalkSpeed = WALK_SPEED
- end
- end
- loopAnim:Fire(nil)
- end
- end
- end
- end
- local toggleSkirmishMode = function()
- skirmishMode = not skirmishMode
- if skirmishMode then
- if isWalking then
- poseAnims.skirmishHoldSwitch()
- else
- poseAnims.skirmishPresent()
- end
- else
- if isWalking then
- poseAnims.skirmishReturn()
- else
- poseAnims.presentDown()
- end
- end
- end
- local aimDownSights = function()
- if aimingDownSights then
- return
- end
- aimingDownSights = true
- userInputService.MouseDeltaSensitivity = 0.6
- SPREAD = 0.8 * TRUE_SPREAD
- currentPose = "presentArms"
- for _,v in pairs(retGui:GetChildren()) do
- v.Transparency = 1
- end
- pHum.WalkSpeed = SHOOT_SPEED
- playAnim:Fire(weaponConfig.animNames.aimDownSights or "musketADS")
- end
- local returnFromAim = function()
- if not aimingDownSights then
- return
- end
- aimingDownSights = false
- userInputService.MouseDeltaSensitivity = 1
- SPREAD = TRUE_SPREAD
- pHum.WalkSpeed = WALK_SPEED
- for _,v in pairs(retGui:GetChildren()) do
- v.Transparency = 0
- end
- if isWalking then
- poseAnims.skirmishHold()
- else
- poseAnims.skirmishPresentDirect()
- end
- end
- local onInputBeganLine = function(input)
- -- DECOMPILER ERROR at PC19: Unhandled construct in 'MakeBoolean' P1
- if input.UserInputType == Enum.UserInputType.Keyboard and input.KeyCode == Enum.KeyCode.R and not animPlaying and not musketLoaded then
- reloadMusket()
- end
- if input.KeyCode == Enum.KeyCode.B and hasBayonet and not animPlaying and currentPose == "leftHold" then
- poseAnims.toggleBayonet()
- end
- if input.KeyCode == Enum.KeyCode.X and hasBayonet and not animPlaying and vBayonetEnabled.Value and (currentPose == "leftHold" or currentPose == "bayonetDown" or currentPose == "portArms" or currentPose == "presentArms") then
- poseAnims.stabGrip()
- end
- if input.KeyCode == Enum.KeyCode.C and CAN_CROUCH then
- toggleCrouch()
- end
- if input.KeyCode == Enum.KeyCode.F then
- if currentPose == "presentArms" then
- poseAnims.presentDown()
- else
- if currentPose == "makeReady" or currentPose == "leftHold" or currentPose == "rightHold" then
- poseAnims.presentArms()
- end
- end
- else
- if input.KeyCode == Enum.KeyCode.Y and SKIRMISH_ON and not animPlaying and currentPose == "leftHold" then
- toggleSkirmishMode()
- end
- end
- if input.KeyCode == Enum.KeyCode.Z then
- swapReticle()
- else
- -- DECOMPILER ERROR at PC154: Unhandled construct in 'MakeBoolean' P1
- if input.KeyCode == Enum.KeyCode.Q and weaponConfig.gunType == "shotgun" and currentPose ~= "reload" then
- shotgun.shotType = shotgun.shotType - 1
- if shotgun.shotType < 0 then
- shotgun.shotType = shotgun.maxShot
- end
- shotLabel.Text = shotgun.getLabelText()
- end
- end
- -- DECOMPILER ERROR at PC186: Unhandled construct in 'MakeBoolean' P1
- if input.KeyCode == Enum.KeyCode.E and weaponConfig.gunType == "shotgun" and currentPose ~= "reload" then
- shotgun.shotType = shotgun.shotType + 1
- if shotgun.maxShot < shotgun.shotType then
- shotgun.shotType = 0
- end
- shotLabel.Text = shotgun.getLabelText()
- end
- if input.KeyCode == Enum.KeyCode.M then
- print("[whupdup] " .. VERSION)
- else
- tryDrillPose(input.KeyCode)
- end
- if input.UserInputType == Enum.UserInputType.MouseButton1 and not animPlaying then
- if currentPose == "presentArms" then
- if musketCocked then
- if musketLoaded then
- shootMusket()
- else
- poseAnims.shootEmpty()
- end
- else
- poseAnims.presentBack()
- end
- else
- if currentPose == "makeReady" or currentPose == "leftHold" then
- poseAnims.makeReady()
- else
- if currentPose == "bayonetDown" then
- stabMusketHold()
- end
- end
- end
- end
- if input.UserInputType == Enum.UserInputType.MouseButton2 then
- if workspace.CurrentCamera.CFrame.p - pHead.Position.magnitude < 0.6 + 0.016 * pHum.WalkSpeed then
- if currentPose == "makeReady" or currentPose == "leftHold" or currentPose == "rightHold" then
- poseAnims.presentArms()
- else
- if currentPose == "presentArms" then
- poseAnims.presentDown()
- else
- if not animPlaying and currentPose == "bayonetDown" then
- setValue:FireServer(vIsBlocking, true)
- poseAnims.block()
- end
- end
- end
- else
- if not animPlaying and currentPose == "bayonetDown" then
- setValue:FireServer(vIsBlocking, true)
- poseAnims.block()
- end
- end
- else
- if input.UserInputType == Enum.UserInputType.MouseButton3 then
- invertReticle()
- end
- end
- end
- local onInputBeganSkirmish = function(input)
- -- DECOMPILER ERROR at PC19: Unhandled construct in 'MakeBoolean' P1
- if input.UserInputType == Enum.UserInputType.Keyboard and input.KeyCode == Enum.KeyCode.R and not animPlaying and not musketLoaded then
- reloadMusket()
- end
- if input.KeyCode == Enum.KeyCode.C and CAN_CROUCH then
- toggleCrouch()
- end
- if input.KeyCode == Enum.KeyCode.X and hasBayonet and not aimingDownSights and not animPlaying and vBayonetEnabled.Value and (currentPose == "leftHold" or currentPose == "bayonetDown" or currentPose == "portArms" or currentPose == "presentArms") then
- poseAnims.stabGrip()
- end
- if input.KeyCode == Enum.KeyCode.Y and not animPlaying and (currentPose == "leftHold" or currentPose == "presentArms") then
- toggleSkirmishMode()
- end
- -- DECOMPILER ERROR at PC103: Unhandled construct in 'MakeBoolean' P1
- if input.KeyCode == Enum.KeyCode.Q and weaponConfig.gunType == "shotgun" and currentPose ~= "reload" then
- shotgun.shotType = shotgun.shotType - 1
- if shotgun.shotType < 0 then
- shotgun.shotType = shotgun.maxShot
- end
- shotLabel.Text = shotgun.getLabelText()
- end
- if input.KeyCode == Enum.KeyCode.E and weaponConfig.gunType == "shotgun" and currentPose ~= "reload" then
- shotgun.shotType = shotgun.shotType + 1
- if shotgun.maxShot < shotgun.shotType then
- shotgun.shotType = 0
- end
- shotLabel.Text = shotgun.getLabelText()
- end
- if input.UserInputType == Enum.UserInputType.MouseButton1 then
- if currentPose == "bayonetDown" then
- stabMusketHold()
- else
- if (currentPose == "leftHold" or currentPose == "presentArms") and musketCocked and (currentPose == "presentArms" or aimingDownSights) then
- if musketLoaded then
- shootMusket()
- else
- poseAnims.shootEmpty()
- end
- end
- end
- if currentPose == "presentArms" and not aimingDownSights then
- poseAnims.presentBack()
- end
- else
- if input.UserInputType == Enum.UserInputType.MouseButton2 then
- if not animPlaying and currentPose == "bayonetDown" then
- setValue:FireServer(vIsBlocking, true)
- poseAnims.block()
- else
- if workspace.CurrentCamera.CFrame.p - pHead.Position.magnitude < 0.6 + 0.016 * pHum.WalkSpeed and (currentPose == "leftHold" or currentPose == "presentArms") then
- aimDownSights()
- end
- end
- else
- if input.UserInputType == Enum.UserInputType.MouseButton3 then
- invertReticle()
- end
- end
- end
- end
- local onInputEndedLine = function(input)
- if input.UserInputType == Enum.UserInputType.MouseButton1 and animPlaying and isStabbing and currentPose == "bayonetDown" then
- stabMusketRelease()
- end
- if input.UserInputType == Enum.UserInputType.MouseButton2 and not animPlaying and currentPose == "block" then
- setValue:FireServer(vIsBlocking, false)
- currentPose = "bayonetDown"
- playAnim:Fire(weaponConfig.animNames.bayonetDownDirect)
- end
- end
- local onInputEndedSkirmish = function(input)
- if input.UserInputType == Enum.UserInputType.MouseButton1 and animPlaying and isStabbing and currentPose == "bayonetDown" then
- stabMusketRelease()
- end
- if input.UserInputType == Enum.UserInputType.MouseButton2 then
- if not animPlaying and currentPose == "block" then
- setValue:FireServer(vIsBlocking, false)
- currentPose = "bayonetDown"
- playAnim:Fire(weaponConfig.animNames.bayonetDownDirect)
- else
- returnFromAim()
- end
- end
- end
- userInputService.InputBegan:connect(function(input, proc)
- if isEquipped and not proc then
- if skirmishMode then
- onInputBeganSkirmish(input)
- else
- onInputBeganLine(input)
- end
- end
- end)
- userInputService.InputChanged:connect(function(input, proc)
- if isEquipped and input.UserInputType == Enum.UserInputType.MouseMovement then
- retGui.Position = UDim2.new(0, input.Position.x, 0, input.Position.y)
- if SHOW_TEAMMATE then
- if not isRetInverted or not Color3.new(0, 0, 0) then
- mainRet.BackgroundColor3 = Color3.new(1, 1, 1)
- if not isRetInverted or not Color3.new(1, 1, 1) then
- mainRet.BorderColor3 = Color3.new(0, 0, 0)
- do
- if mouse.Target then
- local plr = game.Players:GetPlayerFromCharacter(mouse.Target.Parent)
- if plr and plr.TeamColor == player.TeamColor then
- mainRet.BackgroundColor3 = Color3.new(0, 1, 0)
- mainRet.BorderColor3 = Color3.new(0, 1, 0)
- end
- end
- mouseChanged = true
- end
- end
- end
- end
- end
- end)
- userInputService.InputEnded:connect(function(input, proc)
- if isEquipped and not proc then
- if skirmishMode then
- onInputEndedSkirmish(input)
- else
- onInputEndedLine(input)
- end
- end
- end)
- tool.Selected:connect(function()
- isEquipped = true
- userInputService.MouseIconEnabled = false
- fakeLA.Parent = fakeArms
- fakeRA.Parent = fakeArms
- laW.Parent = fakeLA
- laW.Part0 = pLeftArm
- raW.Parent = fakeRA
- raW.Part0 = pRightArm
- gunGui.Parent = player.PlayerGui
- wait(0.02)
- for i = 1, #playerJoints do
- if playerJoints[i]:FindFirstChild("Default") then
- do
- bindJoint:Fire(playerJoints[i], playerJoints[i].Default.Value)
- -- DECOMPILER ERROR at PC50: LeaveBlock: unexpected jumping out IF_THEN_STMT
- -- DECOMPILER ERROR at PC50: LeaveBlock: unexpected jumping out IF_STMT
- end
- end
- end
- bindJoint:Fire(holdJoint, holdDefault)
- bindJoint:Fire(hammerJoint, hammerDefault)
- bindJoint:Fire(rodJoint, rodDefault)
- bindJoint:Fire(frizzenJoint, cfn())
- bindJoint:Fire(cartJoint, cfn())
- if hasBayonet then
- bindJoint:Fire(bayonetJoint, cfn())
- end
- setModifier:Fire(true)
- setModifier:Fire(cfn(), true)
- if not musketLoaded or not weaponConfig.animNames.leftHoldFrizzen then
- playAnim:Fire(weaponConfig.animNames.leftHold)
- if skirmishMode then
- if isWalking then
- poseAnims.skirmishHoldSwitch()
- else
- poseAnims.skirmishPresent()
- end
- end
- end
- end)
- tool.Deselected:connect(function()
- isEquipped = false
- musketServer.Unequip:FireServer()
- if currentPose == "reload" then
- reloadCancelled = true
- end
- userInputService.MouseIconEnabled = true
- userInputService.MouseDeltaSensitivity = 1
- fakeLA.Parent = nil
- fakeRA.Parent = nil
- WALK_SPEED = TRUE_WALK_SPEED
- pHum.WalkSpeed = WALK_SPEED
- pHum.HipHeight = 0
- SPREAD = TRUE_SPREAD
- currentPose = "leftHold"
- animPlaying = false
- isCrouching = false
- isStabbing = false
- displayRecoil = false
- aimingDownSights = false
- setModifier:Fire(cfn(), true)
- playAnim:Fire("baseAnim")
- gunGui.Parent = tool
- pHum.AutoRotate = true
- for _,v in pairs(retGui:GetChildren()) do
- v.Transparency = 0
- end
- end)
- vAmmo.Changed:connect(function()
- bulletLabel.Text = vAmmo.Value .. "/" .. vAmmo.MaxValue
- end)
- stabDetector.Touched:connect(onSta)
- stabDetector2.Touched:connect(onSta)
- pHum.Died:connect(function()
- isEquipped = false
- userInputService.MouseIconEnabled = true
- userInputService.MouseDeltaSensitivity = 1
- fakeArms:Destroy()
- end)
- pHum.Running:connect(function(speed)
- local pv = pHRP.Velocity
- isWalking = pv.x * pv.x + pv.z * pv.z > 0.5
- if isCrouching and (not isWalking or not weaponConfig.animNames.crouchWalk) then
- do
- loopAnim:Fire(weaponConfig.animNames.crouchIdle)
- -- DECOMPILER ERROR at PC48: Unhandled construct in 'MakeBoolean' P1
- if isEquipped and skirmishMode and not aimingDownSights and isWalking and currentPose == "presentArms" then
- poseAnims.skirmishHold()
- end
- if currentPose == "leftHold" then
- poseAnims.skirmishPresentDirect()
- end
- -- DECOMPILER ERROR: 6 unprocessed JMP targets
- end
- end
- end)
- local camDist = nil
- game:GetService("RunService").Heartbeat:connect(function()
- if isEquipped then
- camDist = workspace.CurrentCamera.CFrame.p - pHead.Position.magnitude
- if currentPose == "presentArms" and 0.6 + 0.016 * pHum.WalkSpeed < camDist and not pHum.Sit then
- pHum.AutoRotate = false
- local hit, pos = calcMouseHit()
- pHRP.CFrame = cfn(pHRP.Position, v3n(pos.x, pHRP.Position.y, pos.z))
- else
- do
- pHum.AutoRotate = true
- if camDist < 0.6 + 0.07 * pHum.WalkSpeed then
- fakeLA.Transparency = 0
- fakeRA.Transparency = 0
- else
- fakeLA.Transparency = 1
- fakeRA.Transparency = 1
- end
- if mouseChanged and (currentPose == "presentArms" or currentPose == "bayonetDown") then
- mouseChanged = false
- local hit, pos = calcMouseHit()
- local pos = pHRP.CFrame * cfn(0, 1.5, 0):inverse() * pos
- local ang = atan2(pos.y, -pos.z)
- -- DECOMPILER ERROR at PC105: Unhandled construct in 'MakeBoolean' P1
- if currentPose == "presentArms" and ang > -0.95 and ang < 0.999 then
- setModifier:Fire(cfa(ang, 0, 0))
- end
- end
- if currentPose == "bayonetDown" and ang > -0.4 and ang < 0.7 then
- setModifier:Fire(cfa(ang, 0, 0))
- end
- end
- end
- end
- end)
- game:GetService("RunService).RenderStepped:connect(function()
- if isEquipped and displayRecoil then
- workspace.CurrentCamera.CFrame = workspace.CurrentCamera.CFrame * CFrame.Angles(0.007 * math.sin(25 * getTime()), 0.004 * math.cos(25 * getTime()), 0)
- end
- end)
- end
- -- DECOMPILER ERROR: 15 unprocessed JMP targets
- end
- end
- end
- end
- end
- end
- end
- end
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement