Advertisement
iiFlamez

Untitled

Nov 12th, 2017
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 48.77 KB | None | 0 0
  1. -- params : ...
  2.  
  3. wait()
  4. local tool = script.Parent
  5. local config = tool:WaitForChild("Config")
  6. local weaponConfig = require(config:WaitForChild("WeaponConfig"))
  7. local WALK_SPEED = 16
  8. local TRUE_WALK_SPEED = WALK_SPEED
  9. local SHOOT_SPEED = 8
  10. local RUN_SPEED = 20
  11. local CROUCH_SPEED = 8
  12. local CAN_CROUCH = true
  13. local RELOAD_SPEED = SHOOT_SPEED
  14. local BULLET_SPEED = 1600
  15. local BULLET_STEP = 0.1
  16. local WIND_SCALE = 0.1
  17. local MAX_STEPS = 15
  18. local SPREAD = nil
  19. if weaponConfig.gunType == "rifle" then
  20. SPREAD = 0.001
  21. else
  22. if weaponConfig.gunType == "carbine" then
  23. SPREAD = 0.008
  24. else
  25. SPREAD = 0.007
  26. end
  27. end
  28. local TRUE_SPREAD = SPREAD
  29. local BULLET_DAMAGE = nil
  30. BULLET_DAMAGE = {}
  31. if weaponConfig.gunType == "rifle" then
  32. BULLET_DAMAGE.Head = 100
  33. BULLET_DAMAGE.Torso = 100
  34. BULLET_DAMAGE["Left Arm"] = 100
  35. BULLET_DAMAGE["Right Arm"] = 100
  36. BULLET_DAMAGE["Left Leg"] = 90
  37. BULLET_DAMAGE["Right Leg"] = 90
  38. else
  39. if weaponConfig.gunType == "carbine" then
  40. BULLET_DAMAGE.Head = 100
  41. BULLET_DAMAGE.Torso = 90
  42. BULLET_DAMAGE["Left Arm"] = 60
  43. BULLET_DAMAGE["Right Arm"] = 60
  44. BULLET_DAMAGE["Left Leg"] = 45
  45. BULLET_DAMAGE["Right Leg"] = 45
  46. else
  47. BULLET_DAMAGE.Head = 100
  48. BULLET_DAMAGE.Torso = 100
  49. BULLET_DAMAGE["Left Arm"] = 70
  50. BULLET_DAMAGE["Right Arm"] = 70
  51. BULLET_DAMAGE["Left Leg"] = 70
  52. BULLET_DAMAGE["Right Leg"] = 70
  53. end
  54. end
  55. local BLOCK_ANGLE = math.rad(45)
  56. local MIN_DAMAGE = 30
  57. local MAX_DAMAGE = 45
  58. local MIN_TIME = 0.2
  59. local MAX_TIME = 1.5
  60. local RETICLE_ON = weaponConfig.gunType == "rifle"
  61. local RET_STEP = 100
  62. local RET_RANGE_MAX = 800
  63. local SHOW_TEAMMATE = true
  64. local DISABLE_TK = config:WaitForChild("DisableTK").Value
  65. local SKIRMISH_ON = nil
  66. do
  67. local disableSkirmish = config:WaitForChild("DisableSkirmish", 0.25)
  68. if disableSkirmish then
  69. SKIRMISH_ON = not disableSkirmish.Value
  70. else
  71. SKIRMISH_ON = true
  72. end
  73. local SHOW_TRACER = false
  74. local cfVal = config:WaitForChild("CustomFlags", 0.25)
  75. if cfVal then
  76. local sep, key, value = nil, nil, nil
  77. for entry in cfVal.Value:gmatch("[^,]+") do
  78. sep = entry:find("=")
  79. key = entry:sub(1, sep - 1)
  80. value = entry:sub(sep + 1)
  81. -- DECOMPILER ERROR at PC126: Unhandled construct in 'MakeBoolean' P1
  82.  
  83. if key == "tracer" and value == "true" then
  84. SHOW_TRACER = true
  85. end
  86. if key == "linebattle" and value == "true" then
  87. SHOOT_SPEED = 0
  88. CROUCH_SPEED = 0
  89. RELOAD_SPEED = 0
  90. CAN_CROUCH = false
  91. SKIRMISH_ON = false
  92. end
  93. end
  94. end
  95. local VERSION = "Musket/Rifle/Carbine/Fowling Piece 2.10.0 Public Beta"
  96. local COS_BA = math.sin(-BLOCK_ANGLE)
  97. local atan2 = math.atan2
  98. local random = math.random
  99. local getTime = time
  100. local userInputService = game:GetService("UserInputService")
  101. local cresume, ccreate = coroutine.resume, coroutine.create
  102. local v3n = Vector3.new
  103. local cfn = CFrame.new
  104. local cfa = CFrame.Angles
  105. local newRay = Ray.new
  106. local findPartOnRayWithIgnoreList = workspace.FindPartOnRayWithIgnoreList
  107. local waitForValue = function(val)
  108. local out = val.Value
  109. while not out do
  110. wait()
  111. out = val.Value
  112. end
  113. return out
  114. end
  115.  
  116. local toolModel = waitForValue(tool:WaitForChild("ToolModel"))
  117. local musketServer = tool:WaitForChild("MusketServer")
  118. local holdPart = toolModel:WaitForChild("Hold")
  119. local shootPart = (toolModel:WaitForChild("ShootPart"))
  120. local hasBayonet, blade = nil, nil
  121. do
  122. local bayonet = toolModel:WaitForChild("Bayonet", 0.25)
  123. if bayonet then
  124. hasBayonet = true
  125. blade = bayonet:WaitForChild("Blade")
  126. else
  127. hasBayonet = false
  128. end
  129. local gunGui = tool:WaitForChild("MusketGui")
  130. local bulletLabel = gunGui:WaitForChild("BulletLabel")
  131. local players = game:GetService("Players")
  132. local player = players.LocalPlayer
  133. if not player.Character then
  134. local pChar = player.CharacterAdded:wait()
  135. end
  136. local mouse = player:GetMouse()
  137. local pHead = pChar:WaitForChild("Head")
  138. local pHum = pChar:WaitForChild("Humanoid")
  139. local pHRP = pChar:WaitForChild("HumanoidRootPart")
  140. local pLeftArm, pRightArm = pChar:WaitForChild("Left Arm"), (pChar:WaitForChild("Right Arm"))
  141. local playerJoints, holdJoint, hammerJoint, rodJoint, frizzenJoint, cartJoint, bayonetJoint = nil, nil, nil, nil, nil, nil, nil
  142. playerJoints = {}
  143. do
  144. local joints = tool:WaitForChild("Joints")
  145. playerJoints[1] = waitForValue(joints:WaitForChild("LeftShoulder"))
  146. playerJoints[2] = waitForValue(joints:WaitForChild("RightShoulder"))
  147. playerJoints[3] = waitForValue(joints:WaitForChild("LeftHip"))
  148. playerJoints[4] = waitForValue(joints:WaitForChild("RightHip"))
  149. holdJoint = waitForValue(joints:WaitForChild("Hold"))
  150. hammerJoint = waitForValue(joints:WaitForChild("Hammer"))
  151. rodJoint = waitForValue(joints:WaitForChild("Rod"))
  152. frizzenJoint = waitForValue(joints:WaitForChild("Frizzen"))
  153. cartJoint = waitForValue(joints:WaitForChild("Cartridge"))
  154. if hasBayonet then
  155. bayonetJoint = waitForValue(joints:WaitForChild("Bayonet"))
  156. end
  157. local holdDefault, hammerDefault = holdJoint:WaitForChild("Default").Value, hammerJoint:WaitForChild("Default").Value
  158. local rodDefault = rodJoint:WaitForChild("Default").Value
  159. local bindJoint, playAnim, loopAnim, setModifier = nil, nil, nil, nil
  160. do
  161. local animMgr = player.PlayerGui:WaitForChild("AnimManagerLocal")
  162. bindJoint = animMgr:WaitForChild("BindJoint")
  163. playAnim = animMgr:WaitForChild("PlayAnim")
  164. loopAnim = animMgr:WaitForChild("LoopAnim")
  165. setModifier = animMgr:WaitForChild("SetModifier")
  166. local damageUtil = nil
  167. do
  168. local utilModules = game:GetService("ReplicatedStorage"):WaitForChild("UtilModules")
  169. damageUtil = require(utilModules:WaitForChild("DamageUtil"))()
  170. damageUtil.disableTeamkill = DISABLE_TK
  171. local sendSound = nil
  172. do
  173. local pml = player.PlayerGui:WaitForChild("ProjectileManagerLocal")
  174. sendSound = pml:WaitForChild("SendSound")
  175. local playFireEffects = musketServer:WaitForChild("PlayFireEffects")
  176. local playSound = musketServer:WaitForChild("PlaySound")
  177. local createHitEffect = musketServer:WaitForChild("CreateHitEffect")
  178. local toggleLegJoints = musketServer:WaitForChild("ToggleLegJoints")
  179. local setValue = musketServer:WaitForChild("SetValue")
  180. local playCartridgeEffect = musketServer:WaitForChild("PlayCartridgeEffect")
  181. local displayBloodEffect = musketServer:WaitForChild("DisplayBloodEffect")
  182. local windVal = workspace:WaitForChild("WorldInfo"):WaitForChild("Wind")
  183. local vAmmo = tool:WaitForChild("Ammo")
  184. local vBayonetEnabled = tool:WaitForChild("BayonetEnabled")
  185. local vIsBlocking = pChar:WaitForChild("IsBlocking")
  186. local isEquipped = false
  187. local mouseChanged = false
  188. local animPlaying = false
  189. local currentPose = "leftHold"
  190. local musketLoaded = true
  191. local musketCocked = false
  192. local reloadCancelled = false
  193. local isCrouching = false
  194. local isWalking = false
  195. local isStabbing = false
  196. local lastSwingTime = 0
  197. do
  198. local displayRecoil = false
  199. local skirmishMode = false
  200. local aimingDownSights = false
  201. local shotgun = nil
  202. if weaponConfig.gunType == "shotgun" then
  203. shotgun = {}
  204. shotgun.shotType = 0
  205. shotgun.loadedShot = 0
  206. shotgun.maxShot = 3
  207. shotgun.damageMaps = {
  208. [1] = {Head = 25, Torso = 20, ["Left Arm"] = 20, ["Right Arm"] = 20, ["Left Leg"] = 20, ["Right Leg"] = 20}
  209. ,
  210. [2] = {Head = 15, Torso = 10, ["Left Arm"] = 10, ["Right Arm"] = 10, ["Left Leg"] = 10, ["Right Leg"] = 10}
  211. }
  212. shotgun.getLabelText = function()
  213. if shotgun.shotType == 0 then
  214. return "Buckshot"
  215. else
  216. if shotgun.shotType == 1 then
  217. return "Buck & Ball"
  218. else
  219. if shotgun.shotType == 2 then
  220. return "Birdshot"
  221. else
  222. if shotgun.shotType == 3 then
  223. return "Slug"
  224. end
  225. end
  226. end
  227. end
  228. end
  229.  
  230. end
  231. local fakeArms, fakeLA, fakeRA, laW, raW = nil, nil, nil, nil, nil
  232. do
  233. fakeArms = Instance.new("Model")
  234. fakeArms.Name = "MusketFakeArms"
  235. fakeArms.Parent = workspace.CurrentCamera
  236. do
  237. local faHum = Instance.new("Humanoid")
  238. faHum.Name = "FakeArmHumanoid"
  239. faHum.Parent = fakeArms
  240. fakeLA = pLeftArm:Clone()
  241. fakeLA:ClearAllChildren()
  242. fakeLA.CanCollide = false
  243. fakeLA.Transparency = 1
  244. laW = Instance.new("Weld")
  245. laW.Part0 = pLeftArm
  246. laW.Part1 = fakeLA
  247. laW.Parent = fakeLA
  248. fakeRA = pRightArm:Clone()
  249. fakeRA:ClearAllChildren()
  250. fakeRA.CanCollide = false
  251. fakeRA.Transparency = 1
  252. raW = Instance.new("Weld")
  253. raW.Part0 = pRightArm
  254. raW.Part1 = fakeRA
  255. raW.Parent = fakeRA
  256. coroutine.resume(coroutine.create(function()
  257. wait(1)
  258. local pShirt = pChar:FindFirstChild("Shirt")
  259. if pShirt then
  260. local psC = pShirt:Clone()
  261. psC.Name = "FakeArmShirt"
  262. psC.Parent = fakeArms
  263. end
  264. end))
  265. local stabDetector, stabDetector2 = nil, nil
  266. stabDetector = Instance.new("Part)
  267. stabDetector.CanCollide = false
  268. stabDetector.TopSurface = 0
  269. stabDetector.BottomSurface = 0
  270. stabDetector.Transparency = 1
  271. stabDetector.Size = Vector3.new(0., 2, 0.2)
  272. stabDetector.Parent = toolModel
  273. stabDetector2 = stabDetector:Clone()
  274. stabDetector2.Size = Vector3.new(0., 1, 0.2)
  275. stabDetector2.Parent = toolModel
  276. local sdWeld = Instance.new("Weld)
  277. sdWeld.Part0 = shootPart
  278. sdWeld.Part1 = stabDetector
  279. sdWeld.C0 = cfn(0, 0.4, 0)
  280. sdWeld.Parent = stabDetector
  281. do
  282. local sd2Weld = Instance.new("Weld")
  283. sd2Weld.Part0 = shootPart
  284. sd2Weld.Part1 = stabDetector2
  285. sd2Weld.C0 = cfn(0, -0.2, 0)
  286. sd2Weld.Parent = stabDetector2
  287. local poseAnims, tryDrillPose = nil, nil
  288. poseAnims = {}
  289. poseAnims.leftHold = function()
  290. if animPlaying then
  291. return
  292. end
  293. currentPose = "leftHold"
  294. pHum.WalkSpeed = WALK_SPEED
  295. animPlaying = true
  296. playAnim:Fire(weaponConfig.animNames.switchLeft)
  297. wait(weaponConfig.animTimes.switchArms)
  298. animPlaying = false
  299. end
  300.  
  301. poseAnims.returnToLeft = function()
  302. if animPlaying or currentPose == "leftHold" or currentPose == "makeReady" or currentPose == "presentArms" or currentPose == "bayonetDown" then
  303. return
  304. end
  305. local lastPose = currentPose
  306. animPlaying = true
  307. pHum.WalkSpeed = WALK_SPEED
  308. currentPose = "leftHold"
  309. if lastPose == "rightHold" then
  310. playAnim:Fire(weaponConfig.animNames.switchLeft)
  311. wait(weaponConfig.animTimes.switchArms)
  312. else
  313. if lastPose == "orderArms" then
  314. playAnim:Fire(weaponConfig.animNames.unOrderArms)
  315. wait(weaponConfig.animTimes.orderArms)
  316. else
  317. if lastPose == "trailArms" then
  318. playAnim:Fire(weaponConfig.animNames.unTrailArms)
  319. wait(weaponConfig.animTimes.trailArms)
  320. else
  321. if lastPose == "portArms" then
  322. playAnim:Fire(weaponConfig.animNames.unPortArms)
  323. wait(weaponConfig.animTimes.portArms)
  324. else
  325. if lastPose == "rightShoulderShift" then
  326. playAnim:Fire(weaponConfig.animNames.rightShoulderShiftReturn)
  327. wait(weaponConfig.animTimes.rightShoulderShift)
  328. else
  329. if lastPose == "supportArms" then
  330. playAnim:Fire(weaponConfig.animNames.unSupportArms)
  331. wait(weaponConfig.animTimes.supportArms)
  332. end
  333. end
  334. end
  335. end
  336. end
  337. end
  338. animPlaying = false
  339. end
  340.  
  341. poseAnims.switchRight = function()
  342. if animPlaying or currentPose ~= "leftHold" then
  343. return
  344. end
  345. currentPose = "rightHold"
  346. animPlaying = true
  347. playAnim:Fire(weaponConfig.animNames.switchRight)
  348. wait(weaponConfig.animTimes.switchArms)
  349. animPlaying = false
  350. return true
  351. end
  352.  
  353. poseAnims.orderArms = function()
  354. if animPlaying or currentPose ~= "leftHold" then
  355. return
  356. end
  357. currentPose = "orderArms"
  358. pHum.WalkSpeed = 0
  359. animPlaying = true
  360. playAnim:Fire("musketOrderArms")
  361. wait(2.2)
  362. animPlaying = false
  363. return true
  364. end
  365.  
  366. poseAnims.trailArms = function()
  367. if animPlaying or currentPose ~= "leftHold" then
  368. return
  369. end
  370. currentPose = "trailArms"
  371. if not isCrouching then
  372. pHum.WalkSpeed = RUN_SPEED
  373. end
  374. animPlaying = true
  375. playAnim:Fire(weaponConfig.animNames.trailArms)
  376. wait(weaponConfig.animTimes.trailArms)
  377. animPlaying = false
  378. return true
  379. end
  380.  
  381. poseAnims.portArms = function()
  382. if animPlaying or currentPose ~= "leftHold" and currentPose ~= "bayonetDown" then
  383. return
  384. end
  385. local lastPose = currentPose
  386. currentPose = "portArms"
  387. animPlaying = true
  388. if lastPose == "leftHold" then
  389. playAnim:Fire(weaponConfig.animNames.portArms)
  390. wait(weaponConfig.animTimes.portArms)
  391. else
  392. if not weaponConfig.animNames.portArmsDirect then
  393. playAnim:Fire(lastPose ~= "bayonetDown" or "musketPortArmsDirect")
  394. wait(0.4)
  395. animPlaying = false
  396. return true
  397. end
  398. end
  399. end
  400.  
  401. poseAnims.rightShoulderShift = function()
  402. if animPlaying or currentPose ~= "leftHold" then
  403. return
  404. end
  405. currentPose = "rightShoulderShift"
  406. animPlaying = true
  407. if not isCrouching then
  408. pHum.WalkSpeed = RUN_SPEED
  409. end
  410. playAnim:Fire(weaponConfig.animNames.rightShoulderShift)
  411. wait(weaponConfig.animTimes.rightShoulderShift)
  412. animPlaying = false
  413. return true
  414. end
  415.  
  416. poseAnims.supportArms = function()
  417. if animPlaying or currentPose ~= "leftHold" then
  418. return
  419. end
  420. currentPose = "supportArms"
  421. animPlaying = true
  422. playAnim:Fire(weaponConfig.animNames.supportArms)
  423. wait(weaponConfig.animTimes.supportArms)
  424. animPlaying = false
  425. return true
  426. end
  427.  
  428. poseAnims.makeReady = function()
  429. if animPlaying then
  430. return
  431. end
  432. if currentPose == "leftHold" then
  433. currentPose = "makeReady"
  434. musketCocked = true
  435. pHum.WalkSpeed = SHOOT_SPEED
  436. animPlaying = true
  437. playAnim:Fire(weaponConfig.animNames.makeReady)
  438. wait(0.65)
  439. playSound:FireServer("M2")
  440. wait(0.3)
  441. animPlaying = false
  442. else
  443. if currentPose == "makeReady" then
  444. currentPose = "leftHold"
  445. musketCocked = false
  446. pHum.WalkSpeed = WALK_SPEED
  447. animPlaying = true
  448. playAnim:Fire(weaponConfig.animNames.unMakeReady)
  449. playSound:FireServer("M1")
  450. wait(0.8)
  451. animPlaying = false
  452. end
  453. end
  454. end
  455.  
  456. poseAnims.presentArms = function()
  457. if animPlaying then
  458. return
  459. end
  460. animPlaying = true
  461. pHum.WalkSpeed = SHOOT_SPEED
  462. if currentPose == "makeReady" or currentPose == "rightHold" then
  463. playAnim:Fire(weaponConfig.animNames.presentDirect)
  464. else
  465. playAnim:Fire(weaponConfig.animNames.presentArms)
  466. wait(1)
  467. end
  468. currentPose = "presentArms"
  469. wait(0.3)
  470. animPlaying = false
  471. end
  472.  
  473. poseAnims.presentBack = function()
  474. if animPlaying then
  475. return
  476. end
  477. musketCocked = true
  478. animPlaying = true
  479. playAnim:Fire(weaponConfig.animNames.presentBack)
  480. wait(0.3)
  481. playSound:FireServer("M2")
  482. wait(0.5)
  483. animPlaying = false
  484. end
  485.  
  486. poseAnims.shootEmpty = function()
  487. animPlaying = true
  488. musketCocked = false
  489. playSound:FireServer("Click")
  490. playAnim:Fire(weaponConfig.animNames.shootEmpty)
  491. wait(0.3)
  492. animPlaying = false
  493. end
  494.  
  495. poseAnims.reload = function()
  496. animPlaying = true
  497. currentPose = "reload"
  498. setModifier:Fire(cfn(), true)
  499. if RELOAD_SPEED >= CROUCH_SPEED or not RELOAD_SPEED then
  500. pHum.WalkSpeed = not isCrouching or CROUCH_SPEED
  501. pHum.WalkSpeed = RELOAD_SPEED
  502. playAnim:Fire(weaponConfig.animNames.reload)
  503. local waitErr = wait(weaponConfig.animTimes.reload - 1.6)
  504. if not weaponConfig.animNames.reloadShoulder then
  505. playAnim:Fire(skirmishMode or reloadCancelled or "musketReloadShoulder")
  506. wait(1.6 - waitErr)
  507. if not reloadCancelled then
  508. pHum.WalkSpeed = WALK_SPEED
  509. animPlaying = false
  510. if skirmishMode then
  511. if isWalking then
  512. poseAnims.skirmishHold()
  513. else
  514. poseAnims.skirmishPresentDirect()
  515. end
  516. else
  517. currentPose = "leftHold"
  518. end
  519. else
  520. reloadCancelled = false
  521. end
  522. end
  523. end
  524. end
  525.  
  526. poseAnims.stabGrip = function()
  527. animPlaying = true
  528. if currentPose == "leftHold" then
  529. currentPose = "bayonetDown"
  530. if skirmishMode then
  531. playAnim:Fire(weaponConfig.animNames.bayonetDownDirect)
  532. wait(weaponConfig.animTimes.bayonetDownDirect)
  533. else
  534. playAnim:Fire(weaponConfig.animNames.bayonetDown)
  535. wait(weaponConfig.animTimes.bayonetDown)
  536. end
  537. else
  538. if currentPose == "portArms" or currentPose == "presentArms" then
  539. currentPose = "bayonetDown"
  540. pHum.WalkSpeed = WALK_SPEED
  541. playAnim:Fire(weaponConfig.animNames.bayonetDownDirect)
  542. wait(weaponConfig.animTimes.bayonetDownDirect)
  543. else
  544. if skirmishMode then
  545. animPlaying = false
  546. if isWalking then
  547. poseAnims.skirmishHold()
  548. else
  549. poseAnims.skirmishPresentDirect()
  550. end
  551. else
  552. currentPose = "leftHold"
  553. setModifier:Fire(cfn(), true)
  554. playAnim:Fire(weaponConfig.animNames.bayonetUp)
  555. wait(weaponConfig.animTimes.bayonetUp)
  556. end
  557. end
  558. end
  559. animPlaying = false
  560. end
  561.  
  562. poseAnims.toggleBayonet = function()
  563. animPlaying = true
  564. local bVal = not vBayonetEnabled.Value
  565. setValue:FireServer(vBayonetEnabled, bVal)
  566. if bVal then
  567. playAnim:Fire(weaponConfig.animNames.mountBayonet)
  568. else
  569. playAnim:Fire(weaponConfig.animNames.dismountBayonet)
  570. end
  571. wait(weaponConfig.animTimes.toggleBayonet)
  572. animPlaying = false
  573. end
  574.  
  575. poseAnims.block = function()
  576. currentPose = "block"
  577. playAnim:Fire(weaponConfig.animNames.block)
  578. end
  579.  
  580. poseAnims.presentDown = function()
  581. if animPlaying then
  582. return
  583. end
  584. animPlaying = true
  585. if musketCocked then
  586. playAnim:Fire(weaponConfig.animNames.presentDownHammer)
  587. wait(0.3)
  588. currentPose = "leftHold"
  589. setModifier:Fire(cfn(), true)
  590. wait(0.2)
  591. musketCocked = false
  592. playSound:FireServer("M1")
  593. wait(0.6)
  594. else
  595. playAnim:Fire(weaponConfig.animNames.presentDown)
  596. wait(0.3)
  597. currentPose = "leftHold"
  598. setModifier:Fire(cfn(), true)
  599. wait(0.8)
  600. end
  601. pHum.WalkSpeed = WALK_SPEED
  602. animPlaying = false
  603. end
  604.  
  605. poseAnims.skirmishHoldSwitch = function()
  606. if animPlaying then
  607. return
  608. end
  609. animPlaying = true
  610. currentPose = "leftHold"
  611. playAnim:Fire(weaponConfig.animNames.skirmishHoldSwitch or "musketSkirmishHoldSwitch")
  612. wait(0.8)
  613. animPlaying = false
  614. end
  615.  
  616. poseAnims.skirmishHold = function()
  617. if animPlaying then
  618. return
  619. end
  620. currentPose = "leftHold"
  621. setModifier:Fire(cfn(), true)
  622. playAnim:Fire(weaponConfig.animNames.skirmishHold or "musketSkirmishHold")
  623. end
  624.  
  625. poseAnims.skirmishPresent = function()
  626. if animPlaying then
  627. return
  628. end
  629. animPlaying = true
  630. playAnim:Fire(weaponConfig.animNames.presentArms)
  631. wait(1)
  632. currentPose = "presentArms"
  633. wait(0.3)
  634. animPlaying = false
  635. end
  636.  
  637. poseAnims.skirmishPresentDirect = function()
  638. if animPlaying then
  639. return
  640. end
  641. playAnim:Fire(weaponConfig.animNames.presentDirect)
  642. currentPose = "presentArms"
  643. end
  644.  
  645. poseAnims.skirmishReturn = function()
  646. animPlaying = true
  647. currentPose = "leftHold"
  648. playAnim:Fire(weaponConfig.animNames.reloadShoulder or "musketReloadShoulder")
  649. wait(1.6)
  650. animPlaying = false
  651. end
  652.  
  653. do
  654. 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}
  655. tryDrillPose = function(keyCode)
  656. local drill = drillBinds[keyCode]
  657. if drill and not drill() then
  658. poseAnims.returnToLeft()
  659. end
  660. end
  661.  
  662. local retGui, mainRet, invertReticle, isRetInverted, swapReticle, isRetSwapped, shotLabel = nil, nil, nil, nil, nil, nil, nil
  663. local forceMult = -workspace.Gravity / (BULLET_SPEED * BULLET_SPEED)
  664. local viewY, sizeX = nil, nil
  665. retGui = Instance.new("Frame")
  666. retGui.BackgroundTransparency = 1
  667. retGui.Size = UDim2.new(0, 0, 0, 0)
  668. retGui.Parent = gunGui
  669. local ret = Instance.new("Frame")
  670. ret.Size = UDim2.new(0, 1, 0, 1)
  671. ret.Position = UDim2.new(0, 0, 0, 0)
  672. ret.BackgroundColor3 = Color3.new(1, 1, 1)
  673. ret.BorderColor3 = Color3.new(0, 0, 0)
  674. ret.Parent = retGui
  675. mainRet = ret
  676. local mainLines = {}
  677. local retSizes = {}
  678. do
  679. if RETICLE_ON then
  680. local tanHalfFOV = math.tan(math.rad(0.5 * workspace.CurrentCamera.FieldOfView))
  681. for i = RET_STEP, RET_RANGE_MAX, RET_STEP do
  682. viewY = math.asin(i * forceMult)
  683. viewY = viewY * -0.5 * gunGui.AbsoluteSize.y
  684. sizeX = math.floor(4 / i * tanHalfFOV * 0.5 * gunGui.AbsoluteSize.x)
  685. if sizeX % 2 == 0 or not sizeX - 1 then
  686. do
  687. local frame = Instance.new("Frame")
  688. frame.Size = UDim2.new(0, sizeX, 0, 1)
  689. frame.Position = UDim2.new(0, -0.5 * frame.Size.X.Offset, 0, viewY)
  690. frame.BackgroundColor3 = Color3.new(1, 1, 1)
  691. frame.BorderSizePixel = 0
  692. frame.Parent = retGui
  693. mainLines[#mainLines + 1] = frame
  694. retSizes[#retSizes + 1] = sizeX
  695. -- DECOMPILER ERROR at PC838: LeaveBlock: unexpected jumping out IF_THEN_STMT
  696.  
  697. -- DECOMPILER ERROR at PC838: LeaveBlock: unexpected jumping out IF_STMT
  698.  
  699. end
  700. end
  701. end
  702. end
  703. bulletLabel.Text = vAmmo.Value .. "/" .. vAmmo.MaxValue
  704. isRetInverted = false
  705. isRetSwapped = false
  706. invertReticle = function()
  707. isRetInverted = not isRetInverted
  708. if isRetInverted then
  709. mainRet.BackgroundColor3 = Color3.new(0, 0, 0)
  710. mainRet.BorderColor3 = Color3.new(1, 1, 1)
  711. for _,v in pairs(retGui:GetChildren()) do
  712. if v:IsA("Frame") and v ~= mainRet then
  713. v.BackgroundColor3 = Color3.new(0, 0, 0)
  714. end
  715. end
  716. else
  717. do
  718. mainRet.BackgroundColor3 = Color3.new(1, 1, 1)
  719. mainRet.BorderColor3 = Color3.new(0, 0, 0)
  720. for _,v in pairs(retGui:GetChildren()) do
  721. if v:IsA("Frame") and v ~= mainRet then
  722. v.BackgroundColor3 = Color3.new(1, 1, 1)
  723. end
  724. end
  725. end
  726. end
  727. end
  728.  
  729. swapReticle = function()
  730. if not RETICLE_ON then
  731. return
  732. end
  733. isRetSwapped = not isRetSwapped
  734. local frame = nil
  735. if isRetSwapped then
  736. for i = 1, #mainLines do
  737. frame = mainLines[i]
  738. frame.Size = UDim2.new(0, i % 2 ~= 0 and 12 or 8, 0, 1)
  739. frame.Position = UDim2.new(0, -0.5 * frame.Size.X.Offset, 0, frame.Position.Y.Offset)
  740. end
  741. else
  742. do
  743. for i = 1, #mainLines do
  744. frame = mainLines[i]
  745. frame.Size = UDim2.new(0, retSizes[i], 0, 1)
  746. frame.Position = UDim2.new(0, -0.5 * frame.Size.X.Offset, 0, frame.Position.Y.Offset)
  747. end
  748. end
  749. end
  750. end
  751.  
  752. do
  753. local nameMarker = bulletLabel:Clone()
  754. nameMarker.FontSize = Enum.FontSize.Size18
  755. nameMarker.Text = "-whupdup"
  756. nameMarker.Size = UDim2.new(0, 30, 0, 10)
  757. nameMarker.Position = UDim2.new(0, 36, 0, 43)
  758. nameMarker.Parent = bulletLabel
  759. if weaponConfig.gunType == "shotgun" then
  760. shotLabel = bulletLabel:Clone()
  761. shotLabel:ClearAllChildren()
  762. shotLabel.Text = shotgun.getLabelText()
  763. shotLabel.FontSize = Enum.FontSize.Size24
  764. shotLabel.Position = UDim2.new(0, -70, 0, 15)
  765. shotLabel.Parent = bulletLabel
  766. end
  767. local tagHumanoid = function(hum)
  768. local tag = Instance.new("ObjectValue")
  769. tag.Name = "creator"
  770. tag.Value = player
  771. tag.Parent = hum
  772. cresume(ccreate(function()
  773. wait(1)
  774. if tag and tag.Parent then
  775. tag:Destroy()
  776. end
  777. end))
  778. end
  779.  
  780. local calcMouseHit = function()
  781. local ray = newRay(mouse.Origin.p, mouse.UnitRay.Direction * 1000)
  782. return findPartOnRayWithIgnoreList(workspace, ray, {workspace.CurrentCamera, toolModel, pChar})
  783. end
  784.  
  785. local isBarrelObstructed = function()
  786. local dir = shootPart.CFrame.upVector
  787. local ray = newRay(shootPart.Position - 5 * dir, dir)
  788. do
  789. local hit = findPartOnRayWithIgnoreList(workspace, ray, {workspace.CurrentCamera, pChar, toolModel})
  790. do return hit ~= nil and not hit.CanCollide or hit.Transparency > 0.99 end
  791. -- DECOMPILER ERROR: 2 unprocessed JMP targets
  792. end
  793. end
  794.  
  795. local closestPointToSegment = function(a, b, q)
  796. local ab = b - a
  797. local aq = q - a
  798. local bq = q - b
  799. local u, v = ab:Dot(aq), ab:Dot(bq)
  800. if u > 0 and v < 0 then
  801. ab = ab.unit
  802. local d = ab:Dot(aq)
  803. return a + d * ab
  804. else
  805. do
  806. if u <= 0 and v < 0 then
  807. return a
  808. else
  809. return b
  810. end
  811. end
  812. end
  813. end
  814.  
  815. local dispatchWhoosh = function(a, b)
  816. local head, point = nil, nil
  817. for _,plr in pairs(players:GetPlayers()) do
  818. if plr ~= player then
  819. if plr.Character then
  820. head = plr.Character:FindFirstChild("Head")
  821. end
  822. if head then
  823. point = closestPointToSegment(a, b, head.Position)
  824. if point - head.Position.magnitude <= 8 then
  825. sendSound:Fire(plr, 1, point - head.Position)
  826. end
  827. end
  828. end
  829. end
  830. end
  831.  
  832. local fireBullet = function(start, pos, dmgMap, spread)
  833. if isBarrelObstructed() then
  834. return
  835. end
  836. local dSpread = 2 * spread
  837. local dir = cfn(v3n(), pos - start.unit) * cfa(random() * dSpread - spread, random() * dSpread - spread, 0).lookVector
  838. local velT = dir * BULLET_SPEED * BULLET_STEP
  839. local baseGrav = -workspace.Gravity * BULLET_STEP
  840. local baseWind = windVal.Value * WIND_SCALE * BULLET_STEP
  841. local grav = baseGrav
  842. local wind = baseWind
  843. local numSteps = 1
  844. local lastStep = start
  845. local currStep, deltaStep, ray, hit, hPos, hNorm, nextPos, innerCount = nil, nil, nil, nil, nil, nil, nil, nil
  846. local breakAll = false
  847. repeat
  848. deltaStep = velT + v3n(0, grav * BULLET_STEP, 0) + wind * BULLET_STEP
  849. currStep = lastStep + (deltaStep)
  850. nextPos = lastStep
  851. do
  852. if SHOW_TRACER then
  853. local p = Instance.new("Part")
  854. p.Anchored = true
  855. p.CanCollide = false
  856. p.BrickColor = BrickColor.Yellow()
  857. p.Transparency = 0.5
  858. p.Size = v3n(0.2, 0.2, deltaStep.magnitude)
  859. p.CFrame = cfn(0.5 * (currStep + lastStep), currStep)
  860. p.Parent = workspace
  861. game:GetService("Debris"):AddItem(p, 6)
  862. end
  863. local ignoreList = {pChar, toolModel}
  864. innerCount = 1
  865. dispatchWhoosh(nextPos, currStep)
  866. repeat
  867. ray = newRay(nextPos, currStep - nextPos)
  868. hit = findPartOnRayWithIgnoreList(workspace, ray, ignoreList)
  869. if hit then
  870. local hum = damageUtil:findHumanoid(hit, 2)
  871. if hum then
  872. if not workspace.FilteringEnabled then
  873. tagHumanoid(hum)
  874. end
  875. if not dmgMap[hit.Name] or not hit.Name then
  876. displayBloodEffect:FireServer(hum, weaponConfig.gunType == "shotgun" or (not dmgMap[hit.Name] and not damageUtil:tryDamageHumanoid(hum, dmgMap.Torso)) or "Torso")
  877. if (dmgMap[hit.Name] and hit.Name) or not dmgMap[hit.Name] then
  878. do
  879. displayBloodEffect:FireServer(hum, not dmgMap[hit.Name] and not damageUtil:tryDamageHumanoid(hum, dmgMap.Torso) or "Torso", dmgMap.Torso / BULLET_DAMAGE.Torso)
  880. damageUtil.hitHums = {}
  881. createHitEffect:FireServer(cfn(hPos, hPos + hNorm), "Player")
  882. breakAll = true
  883. do break end
  884. if hit.CanCollide and hit.Transparency < 1 then
  885. createHitEffect:FireServer(cfn(hPos, hPos + hNorm), hit.Material)
  886. breakAll = true
  887. break
  888. end
  889. ignoreList[#ignoreList + 1] = hit
  890. innerCount = innerCount + 1
  891. end
  892. end
  893. end
  894. end
  895. end
  896. until not hit or innerCount >= 8
  897. if breakAll then
  898. break
  899. end
  900. grav = grav + baseGrav
  901. wind = wind + baseWind
  902. lastStep = currStep
  903. numSteps = numSteps + 1
  904. wait(BULLET_STEP)
  905. end
  906. until MAX_STEPS < numSteps
  907. end
  908.  
  909. if weaponConfig.gunType == "shotgun" then
  910. shotgun.fireShot = function(start, pos)
  911. if shotgun.loadedShot == 0 then
  912. for i = 1, 8 do
  913. cresume(ccreate(fireBullet), start, pos, shotgun.damageMaps[1], 0.02)
  914. end
  915. else
  916. do
  917. if shotgun.loadedShot == 1 then
  918. for i = 1, 4 do
  919. cresume(ccreate(fireBullet), start, pos, shotgun.damageMaps[1], 0.02)
  920. end
  921. cresume(ccreate(fireBullet), start, pos, BULLET_DAMAGE, 0.02)
  922. else
  923. if shotgun.loadedShot == 2 then
  924. for i = 1, 12 do
  925. cresume(ccreate(fireBullet), start, pos, shotgun.damageMaps[2], 0.018)
  926. end
  927. else
  928. do
  929. if shotgun.loadedShot == 3 then
  930. cresume(ccreate(fireBullet), start, pos, BULLET_DAMAGE, 0.01)
  931. end
  932. end
  933. end
  934. end
  935. end
  936. end
  937. end
  938.  
  939. end
  940. local shootMusket = function()
  941. musketLoaded = false
  942. musketCocked = false
  943. if not aimingDownSights then
  944. playAnim:Fire(weaponConfig.animNames.shoot)
  945. else
  946. playAnim:Fire(weaponConfig.animNames.shootADS or "musketShootADS")
  947. end
  948. playFireEffects:FireServer()
  949. wait(0.1)
  950. local hit, pos = calcMouseHit()
  951. if weaponConfig.gunType == "shotgun" then
  952. shotgun.fireShot(shootPart.Position, pos)
  953. else
  954. cresume(ccreate(fireBullet), shootPart.Position, pos, BULLET_DAMAGE, SPREAD)
  955. end
  956. displayRecoil = true
  957. mouseChanged = true
  958. animPlaying = true
  959. wait(0.4)
  960. displayRecoil = false
  961. animPlaying = false
  962. end
  963.  
  964. local onStab = function(hit)
  965. if not damageUtil.canHit then
  966. return
  967. end
  968. local hum = damageUtil:findHumanoid(hit, 2)
  969. if hum then
  970. local dmgScale = (getTime() - lastSwingTime) / MAX_TIME
  971. if dmgScale <= 1 or not 1 then
  972. local dmg = MIN_DAMAGE + (MAX_DAMAGE - MIN_DAMAGE) * dmgScale
  973. local hrp = hum.Parent:FindFirstChild("HumanoidRootPart")
  974. local hIsBlocking = hum.Parent:FindFirstChild("IsBlocking")
  975. -- DECOMPILER ERROR at PC62: Unhandled construct in 'MakeBoolean' P1
  976.  
  977. if hrp and hIsBlocking and (not hIsBlocking.Value or hrp.CFrame.lookVector:Dot(hrp.Position - pHRP.Position.unit) > COS_BA) then
  978. if not workspace.FilteringEnabled then
  979. tagHumanoid(hum)
  980. end
  981. if damageUtil:tryDamageHumanoid(hum, dmg) then
  982. local scl = dmg / BULLET_DAMAGE.Torso
  983. displayBloodEffect:FireServer(hum, BULLET_DAMAGE[hit.Name] and hit.Name or "Torso", scl)
  984. end
  985. end
  986. do
  987. if not workspace.FilteringEnabled then
  988. tagHumanoid(hum)
  989. end
  990. do
  991. if damageUtil:tryDamageHumanoid(hum, dmg) then
  992. local scl = dmg / BULLET_DAMAGE.Torso
  993. displayBloodEffect:FireServer(hum, BULLET_DAMAGE[hit.Name] and hit.Name or "Torso", scl)
  994. end
  995. playSound:FireServer("Flesh")
  996. end
  997. end
  998. end
  999. end
  1000. end
  1001.  
  1002. local doStabDamage = function()
  1003. local dir = shootPart.CFrame.upVector
  1004. local vStart = blade.Position - 5 * dir
  1005. local vDir = 5.5 * dir
  1006. local ray = newRay(blade.Position - 5 * dir, 5.5 * dir)
  1007. local hit, pos = findPartOnRayWithIgnoreList(workspace, ray, {pChar, toolModel})
  1008. local p = Instance.new("Part")
  1009. p.Anchored = true
  1010. p.CanCollide = false
  1011. p.Size = Vector3.new(0.2, 0.2, vDir.magnitude)
  1012. p.CFrame = CFrame.new((vStart + vStart + vDir) / 2, vStart)
  1013. p.Parent = workspace
  1014. game.Debris:AddItem(p, 5)
  1015. if hit then
  1016. local hum = damageUtil:findHumanoid(hit, 2)
  1017. if hum then
  1018. local dmgScale = (getTime() - lastSwingTime) / MAX_TIME
  1019. if dmgScale <= 1 or not 1 then
  1020. local dmg = MIN_DAMAGE + (MAX_DAMAGE - MIN_DAMAGE) * dmgScale
  1021. local hrp = hum.Parent:FindFirstChild("HumanoidRootPart")
  1022. local hIsBlocking = hum.Parent:FindFirstChild("IsBlocking")
  1023. -- DECOMPILER ERROR at PC111: Unhandled construct in 'MakeBoolean' P1
  1024.  
  1025. if hrp and hIsBlocking and (not hIsBlocking.Value or hrp.CFrame.lookVector:Dot(hrp.Position - pHRP.Position.unit) > COS_BA) then
  1026. if not workspace.FilteringEnabled then
  1027. tagHumanoid(hum)
  1028. end
  1029. if damageUtil:tryDamageHumanoid(hum, dmg) then
  1030. local scl = dmg / BULLET_DAMAGE.Torso
  1031. displayBloodEffect:FireServer(hum, BULLET_DAMAGE[hit.Name] and hit.Name or "Torso", scl)
  1032. end
  1033. end
  1034. do
  1035. if not workspace.FilteringEnabled then
  1036. tagHumanoid(hum)
  1037. end
  1038. do
  1039. if damageUtil:tryDamageHumanoid(hum, dmg) then
  1040. local scl = dmg / BULLET_DAMAGE.Torso
  1041. displayBloodEffect:FireServer(hum, BULLET_DAMAGE[hit.Name] and hit.Name or "Torso", scl)
  1042. end
  1043. playSound:FireServer("Flesh")
  1044. end
  1045. end
  1046. end
  1047. end
  1048. end
  1049. end
  1050.  
  1051. local stabMusketRelease = function()
  1052. if not isStabbing and not animPlaying then
  1053. return
  1054. end
  1055. local timeDiff = MIN_TIME - (getTime() - lastSwingTime)
  1056. if timeDiff > 0 then
  1057. wait(timeDiff)
  1058. end
  1059. isStabbing = false
  1060. playAnim:Fire(weaponConfig.animNames.stabForward)
  1061. playSound:FireServer("Stab")
  1062. damageUtil:enableHit()
  1063. wait(0.15)
  1064. damageUtil:disableHit()
  1065. wait(0.2)
  1066. animPlaying = false
  1067. end
  1068.  
  1069. local stabMusketHold = function()
  1070. if animPlaying or isStabbing then
  1071. return
  1072. end
  1073. if getTime() - lastSwingTime < MIN_TIME then
  1074. lastSwingTime = getTime()
  1075. return
  1076. end
  1077. animPlaying = true
  1078. isStabbing = true
  1079. lastSwingTime = getTime()
  1080. playAnim:Fire(weaponConfig.animNames.stabBack)
  1081. wait(MAX_TIME)
  1082. if isEquipped and animPlaying and isStabbing and MAX_TIME <= getTime() - lastSwingTime then
  1083. stabMusketRelease()
  1084. end
  1085. end
  1086.  
  1087. local reloadMusket = function()
  1088. if vAmmo.Value <= 0 then
  1089. return
  1090. end
  1091. cresume(ccreate(poseAnims.reload))
  1092. musketCocked = false
  1093. playCartridgeEffect:FireServer()
  1094. for i,soundTime in ipairs(weaponConfig.reloadAudio) do
  1095. wait(soundTime[2])
  1096. if not isEquipped or currentPose ~= "reload" then
  1097. return
  1098. end
  1099. playSound:FireServer(soundTime[1])
  1100. if i == #weaponConfig.reloadAudio - 1 and currentPose == "reload" then
  1101. musketLoaded = true
  1102. setValue:FireServer(vAmmo, vAmmo.Value - 1)
  1103. if weaponConfig.gunType == "shotgun" then
  1104. shotgun.loadedShot = shotgun.shotType
  1105. end
  1106. end
  1107. end
  1108. end
  1109.  
  1110. local toggleCrouch = function()
  1111. isCrouching = not isCrouching
  1112. if isCrouching then
  1113. WALK_SPEED = CROUCH_SPEED
  1114. toggleLegJoints:FireServer(true)
  1115. bindJoint:Fire(playerJoints[3])
  1116. bindJoint:Fire(playerJoints[4])
  1117. loopAnim:Fire(weaponConfig.animNames.crouchDown)
  1118. if currentPose ~= "reload" then
  1119. pHum.WalkSpeed = CROUCH_SPEED
  1120. else
  1121. pHum.WalkSpeed = CROUCH_SPEED < RELOAD_SPEED and CROUCH_SPEED or RELOAD_SPEED
  1122. end
  1123. pHum.HipHeight = -0.8
  1124. wait()
  1125. if isCrouching and isWalking then
  1126. loopAnim:Fire(weaponConfig.animNames.crouchWalk)
  1127. end
  1128. else
  1129. WALK_SPEED = TRUE_WALK_SPEED
  1130. toggleLegJoints:FireServer(false)
  1131. loopAnim:Fire(weaponConfig.animNames.crouchUp)
  1132. pHum.HipHeight = 0
  1133. if currentPose == "makeReady" then
  1134. pHum.WalkSpeed = SHOOT_SPEED
  1135. else
  1136. if not skirmishMode or not WALK_SPEED then
  1137. pHum.WalkSpeed = currentPose ~= "presentArms" or SHOOT_SPEED
  1138. if currentPose == "reload" then
  1139. pHum.WalkSpeed = RELOAD_SPEED
  1140. else
  1141. if currentPose == "trailArms" or currentPose == "rightShoulderShift" then
  1142. pHum.WalkSpeed = RUN_SPEED
  1143. else
  1144. pHum.WalkSpeed = WALK_SPEED
  1145. end
  1146. end
  1147. loopAnim:Fire(nil)
  1148. end
  1149. end
  1150. end
  1151. end
  1152.  
  1153. local toggleSkirmishMode = function()
  1154. skirmishMode = not skirmishMode
  1155. if skirmishMode then
  1156. if isWalking then
  1157. poseAnims.skirmishHoldSwitch()
  1158. else
  1159. poseAnims.skirmishPresent()
  1160. end
  1161. else
  1162. if isWalking then
  1163. poseAnims.skirmishReturn()
  1164. else
  1165. poseAnims.presentDown()
  1166. end
  1167. end
  1168. end
  1169.  
  1170. local aimDownSights = function()
  1171. if aimingDownSights then
  1172. return
  1173. end
  1174. aimingDownSights = true
  1175. userInputService.MouseDeltaSensitivity = 0.6
  1176. SPREAD = 0.8 * TRUE_SPREAD
  1177. currentPose = "presentArms"
  1178. for _,v in pairs(retGui:GetChildren()) do
  1179. v.Transparency = 1
  1180. end
  1181. pHum.WalkSpeed = SHOOT_SPEED
  1182. playAnim:Fire(weaponConfig.animNames.aimDownSights or "musketADS")
  1183. end
  1184.  
  1185. local returnFromAim = function()
  1186. if not aimingDownSights then
  1187. return
  1188. end
  1189. aimingDownSights = false
  1190. userInputService.MouseDeltaSensitivity = 1
  1191. SPREAD = TRUE_SPREAD
  1192. pHum.WalkSpeed = WALK_SPEED
  1193. for _,v in pairs(retGui:GetChildren()) do
  1194. v.Transparency = 0
  1195. end
  1196. if isWalking then
  1197. poseAnims.skirmishHold()
  1198. else
  1199. poseAnims.skirmishPresentDirect()
  1200. end
  1201. end
  1202.  
  1203. local onInputBeganLine = function(input)
  1204. -- DECOMPILER ERROR at PC19: Unhandled construct in 'MakeBoolean' P1
  1205.  
  1206. if input.UserInputType == Enum.UserInputType.Keyboard and input.KeyCode == Enum.KeyCode.R and not animPlaying and not musketLoaded then
  1207. reloadMusket()
  1208. end
  1209. if input.KeyCode == Enum.KeyCode.B and hasBayonet and not animPlaying and currentPose == "leftHold" then
  1210. poseAnims.toggleBayonet()
  1211. end
  1212. 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
  1213. poseAnims.stabGrip()
  1214. end
  1215. if input.KeyCode == Enum.KeyCode.C and CAN_CROUCH then
  1216. toggleCrouch()
  1217. end
  1218. if input.KeyCode == Enum.KeyCode.F then
  1219. if currentPose == "presentArms" then
  1220. poseAnims.presentDown()
  1221. else
  1222. if currentPose == "makeReady" or currentPose == "leftHold" or currentPose == "rightHold" then
  1223. poseAnims.presentArms()
  1224. end
  1225. end
  1226. else
  1227. if input.KeyCode == Enum.KeyCode.Y and SKIRMISH_ON and not animPlaying and currentPose == "leftHold" then
  1228. toggleSkirmishMode()
  1229. end
  1230. end
  1231. if input.KeyCode == Enum.KeyCode.Z then
  1232. swapReticle()
  1233. else
  1234. -- DECOMPILER ERROR at PC154: Unhandled construct in 'MakeBoolean' P1
  1235.  
  1236. if input.KeyCode == Enum.KeyCode.Q and weaponConfig.gunType == "shotgun" and currentPose ~= "reload" then
  1237. shotgun.shotType = shotgun.shotType - 1
  1238. if shotgun.shotType < 0 then
  1239. shotgun.shotType = shotgun.maxShot
  1240. end
  1241. shotLabel.Text = shotgun.getLabelText()
  1242. end
  1243. end
  1244. -- DECOMPILER ERROR at PC186: Unhandled construct in 'MakeBoolean' P1
  1245.  
  1246. if input.KeyCode == Enum.KeyCode.E and weaponConfig.gunType == "shotgun" and currentPose ~= "reload" then
  1247. shotgun.shotType = shotgun.shotType + 1
  1248. if shotgun.maxShot < shotgun.shotType then
  1249. shotgun.shotType = 0
  1250. end
  1251. shotLabel.Text = shotgun.getLabelText()
  1252. end
  1253. if input.KeyCode == Enum.KeyCode.M then
  1254. print("[whupdup] " .. VERSION)
  1255. else
  1256. tryDrillPose(input.KeyCode)
  1257. end
  1258. if input.UserInputType == Enum.UserInputType.MouseButton1 and not animPlaying then
  1259. if currentPose == "presentArms" then
  1260. if musketCocked then
  1261. if musketLoaded then
  1262. shootMusket()
  1263. else
  1264. poseAnims.shootEmpty()
  1265. end
  1266. else
  1267. poseAnims.presentBack()
  1268. end
  1269. else
  1270. if currentPose == "makeReady" or currentPose == "leftHold" then
  1271. poseAnims.makeReady()
  1272. else
  1273. if currentPose == "bayonetDown" then
  1274. stabMusketHold()
  1275. end
  1276. end
  1277. end
  1278. end
  1279. if input.UserInputType == Enum.UserInputType.MouseButton2 then
  1280. if workspace.CurrentCamera.CFrame.p - pHead.Position.magnitude < 0.6 + 0.016 * pHum.WalkSpeed then
  1281. if currentPose == "makeReady" or currentPose == "leftHold" or currentPose == "rightHold" then
  1282. poseAnims.presentArms()
  1283. else
  1284. if currentPose == "presentArms" then
  1285. poseAnims.presentDown()
  1286. else
  1287. if not animPlaying and currentPose == "bayonetDown" then
  1288. setValue:FireServer(vIsBlocking, true)
  1289. poseAnims.block()
  1290. end
  1291. end
  1292. end
  1293. else
  1294. if not animPlaying and currentPose == "bayonetDown" then
  1295. setValue:FireServer(vIsBlocking, true)
  1296. poseAnims.block()
  1297. end
  1298. end
  1299. else
  1300. if input.UserInputType == Enum.UserInputType.MouseButton3 then
  1301. invertReticle()
  1302. end
  1303. end
  1304. end
  1305.  
  1306. local onInputBeganSkirmish = function(input)
  1307. -- DECOMPILER ERROR at PC19: Unhandled construct in 'MakeBoolean' P1
  1308.  
  1309. if input.UserInputType == Enum.UserInputType.Keyboard and input.KeyCode == Enum.KeyCode.R and not animPlaying and not musketLoaded then
  1310. reloadMusket()
  1311. end
  1312. if input.KeyCode == Enum.KeyCode.C and CAN_CROUCH then
  1313. toggleCrouch()
  1314. end
  1315. 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
  1316. poseAnims.stabGrip()
  1317. end
  1318. if input.KeyCode == Enum.KeyCode.Y and not animPlaying and (currentPose == "leftHold" or currentPose == "presentArms") then
  1319. toggleSkirmishMode()
  1320. end
  1321. -- DECOMPILER ERROR at PC103: Unhandled construct in 'MakeBoolean' P1
  1322.  
  1323. if input.KeyCode == Enum.KeyCode.Q and weaponConfig.gunType == "shotgun" and currentPose ~= "reload" then
  1324. shotgun.shotType = shotgun.shotType - 1
  1325. if shotgun.shotType < 0 then
  1326. shotgun.shotType = shotgun.maxShot
  1327. end
  1328. shotLabel.Text = shotgun.getLabelText()
  1329. end
  1330. if input.KeyCode == Enum.KeyCode.E and weaponConfig.gunType == "shotgun" and currentPose ~= "reload" then
  1331. shotgun.shotType = shotgun.shotType + 1
  1332. if shotgun.maxShot < shotgun.shotType then
  1333. shotgun.shotType = 0
  1334. end
  1335. shotLabel.Text = shotgun.getLabelText()
  1336. end
  1337. if input.UserInputType == Enum.UserInputType.MouseButton1 then
  1338. if currentPose == "bayonetDown" then
  1339. stabMusketHold()
  1340. else
  1341. if (currentPose == "leftHold" or currentPose == "presentArms") and musketCocked and (currentPose == "presentArms" or aimingDownSights) then
  1342. if musketLoaded then
  1343. shootMusket()
  1344. else
  1345. poseAnims.shootEmpty()
  1346. end
  1347. end
  1348. end
  1349. if currentPose == "presentArms" and not aimingDownSights then
  1350. poseAnims.presentBack()
  1351. end
  1352. else
  1353. if input.UserInputType == Enum.UserInputType.MouseButton2 then
  1354. if not animPlaying and currentPose == "bayonetDown" then
  1355. setValue:FireServer(vIsBlocking, true)
  1356. poseAnims.block()
  1357. else
  1358. if workspace.CurrentCamera.CFrame.p - pHead.Position.magnitude < 0.6 + 0.016 * pHum.WalkSpeed and (currentPose == "leftHold" or currentPose == "presentArms") then
  1359. aimDownSights()
  1360. end
  1361. end
  1362. else
  1363. if input.UserInputType == Enum.UserInputType.MouseButton3 then
  1364. invertReticle()
  1365. end
  1366. end
  1367. end
  1368. end
  1369.  
  1370. local onInputEndedLine = function(input)
  1371. if input.UserInputType == Enum.UserInputType.MouseButton1 and animPlaying and isStabbing and currentPose == "bayonetDown" then
  1372. stabMusketRelease()
  1373. end
  1374. if input.UserInputType == Enum.UserInputType.MouseButton2 and not animPlaying and currentPose == "block" then
  1375. setValue:FireServer(vIsBlocking, false)
  1376. currentPose = "bayonetDown"
  1377. playAnim:Fire(weaponConfig.animNames.bayonetDownDirect)
  1378. end
  1379. end
  1380.  
  1381. local onInputEndedSkirmish = function(input)
  1382. if input.UserInputType == Enum.UserInputType.MouseButton1 and animPlaying and isStabbing and currentPose == "bayonetDown" then
  1383. stabMusketRelease()
  1384. end
  1385. if input.UserInputType == Enum.UserInputType.MouseButton2 then
  1386. if not animPlaying and currentPose == "block" then
  1387. setValue:FireServer(vIsBlocking, false)
  1388. currentPose = "bayonetDown"
  1389. playAnim:Fire(weaponConfig.animNames.bayonetDownDirect)
  1390. else
  1391. returnFromAim()
  1392. end
  1393. end
  1394. end
  1395.  
  1396. userInputService.InputBegan:connect(function(input, proc)
  1397. if isEquipped and not proc then
  1398. if skirmishMode then
  1399. onInputBeganSkirmish(input)
  1400. else
  1401. onInputBeganLine(input)
  1402. end
  1403. end
  1404. end)
  1405. userInputService.InputChanged:connect(function(input, proc)
  1406. if isEquipped and input.UserInputType == Enum.UserInputType.MouseMovement then
  1407. retGui.Position = UDim2.new(0, input.Position.x, 0, input.Position.y)
  1408. if SHOW_TEAMMATE then
  1409. if not isRetInverted or not Color3.new(0, 0, 0) then
  1410. mainRet.BackgroundColor3 = Color3.new(1, 1, 1)
  1411. if not isRetInverted or not Color3.new(1, 1, 1) then
  1412. mainRet.BorderColor3 = Color3.new(0, 0, 0)
  1413. do
  1414. if mouse.Target then
  1415. local plr = game.Players:GetPlayerFromCharacter(mouse.Target.Parent)
  1416. if plr and plr.TeamColor == player.TeamColor then
  1417. mainRet.BackgroundColor3 = Color3.new(0, 1, 0)
  1418. mainRet.BorderColor3 = Color3.new(0, 1, 0)
  1419. end
  1420. end
  1421. mouseChanged = true
  1422. end
  1423. end
  1424. end
  1425. end
  1426. end
  1427. end)
  1428. userInputService.InputEnded:connect(function(input, proc)
  1429. if isEquipped and not proc then
  1430. if skirmishMode then
  1431. onInputEndedSkirmish(input)
  1432. else
  1433. onInputEndedLine(input)
  1434. end
  1435. end
  1436. end)
  1437. tool.Selected:connect(function()
  1438. isEquipped = true
  1439. userInputService.MouseIconEnabled = false
  1440. fakeLA.Parent = fakeArms
  1441. fakeRA.Parent = fakeArms
  1442. laW.Parent = fakeLA
  1443. laW.Part0 = pLeftArm
  1444. raW.Parent = fakeRA
  1445. raW.Part0 = pRightArm
  1446. gunGui.Parent = player.PlayerGui
  1447. wait(0.02)
  1448. for i = 1, #playerJoints do
  1449. if playerJoints[i]:FindFirstChild("Default") then
  1450. do
  1451. bindJoint:Fire(playerJoints[i], playerJoints[i].Default.Value)
  1452. -- DECOMPILER ERROR at PC50: LeaveBlock: unexpected jumping out IF_THEN_STMT
  1453.  
  1454. -- DECOMPILER ERROR at PC50: LeaveBlock: unexpected jumping out IF_STMT
  1455.  
  1456. end
  1457. end
  1458. end
  1459. bindJoint:Fire(holdJoint, holdDefault)
  1460. bindJoint:Fire(hammerJoint, hammerDefault)
  1461. bindJoint:Fire(rodJoint, rodDefault)
  1462. bindJoint:Fire(frizzenJoint, cfn())
  1463. bindJoint:Fire(cartJoint, cfn())
  1464. if hasBayonet then
  1465. bindJoint:Fire(bayonetJoint, cfn())
  1466. end
  1467. setModifier:Fire(true)
  1468. setModifier:Fire(cfn(), true)
  1469. if not musketLoaded or not weaponConfig.animNames.leftHoldFrizzen then
  1470. playAnim:Fire(weaponConfig.animNames.leftHold)
  1471. if skirmishMode then
  1472. if isWalking then
  1473. poseAnims.skirmishHoldSwitch()
  1474. else
  1475. poseAnims.skirmishPresent()
  1476. end
  1477. end
  1478. end
  1479. end)
  1480. tool.Deselected:connect(function()
  1481. isEquipped = false
  1482. musketServer.Unequip:FireServer()
  1483. if currentPose == "reload" then
  1484. reloadCancelled = true
  1485. end
  1486. userInputService.MouseIconEnabled = true
  1487. userInputService.MouseDeltaSensitivity = 1
  1488. fakeLA.Parent = nil
  1489. fakeRA.Parent = nil
  1490. WALK_SPEED = TRUE_WALK_SPEED
  1491. pHum.WalkSpeed = WALK_SPEED
  1492. pHum.HipHeight = 0
  1493. SPREAD = TRUE_SPREAD
  1494. currentPose = "leftHold"
  1495. animPlaying = false
  1496. isCrouching = false
  1497. isStabbing = false
  1498. displayRecoil = false
  1499. aimingDownSights = false
  1500. setModifier:Fire(cfn(), true)
  1501. playAnim:Fire("baseAnim")
  1502. gunGui.Parent = tool
  1503. pHum.AutoRotate = true
  1504. for _,v in pairs(retGui:GetChildren()) do
  1505. v.Transparency = 0
  1506. end
  1507. end)
  1508. vAmmo.Changed:connect(function()
  1509. bulletLabel.Text = vAmmo.Value .. "/" .. vAmmo.MaxValue
  1510. end)
  1511. stabDetector.Touched:connect(onSta)
  1512. stabDetector2.Touched:connect(onSta)
  1513. pHum.Died:connect(function()
  1514. isEquipped = false
  1515. userInputService.MouseIconEnabled = true
  1516. userInputService.MouseDeltaSensitivity = 1
  1517. fakeArms:Destroy()
  1518. end)
  1519. pHum.Running:connect(function(speed)
  1520. local pv = pHRP.Velocity
  1521. isWalking = pv.x * pv.x + pv.z * pv.z > 0.5
  1522. if isCrouching and (not isWalking or not weaponConfig.animNames.crouchWalk) then
  1523. do
  1524. loopAnim:Fire(weaponConfig.animNames.crouchIdle)
  1525. -- DECOMPILER ERROR at PC48: Unhandled construct in 'MakeBoolean' P1
  1526.  
  1527. if isEquipped and skirmishMode and not aimingDownSights and isWalking and currentPose == "presentArms" then
  1528. poseAnims.skirmishHold()
  1529. end
  1530. if currentPose == "leftHold" then
  1531. poseAnims.skirmishPresentDirect()
  1532. end
  1533. -- DECOMPILER ERROR: 6 unprocessed JMP targets
  1534. end
  1535. end
  1536. end)
  1537. local camDist = nil
  1538. game:GetService("RunService").Heartbeat:connect(function()
  1539. if isEquipped then
  1540. camDist = workspace.CurrentCamera.CFrame.p - pHead.Position.magnitude
  1541. if currentPose == "presentArms" and 0.6 + 0.016 * pHum.WalkSpeed < camDist and not pHum.Sit then
  1542. pHum.AutoRotate = false
  1543. local hit, pos = calcMouseHit()
  1544. pHRP.CFrame = cfn(pHRP.Position, v3n(pos.x, pHRP.Position.y, pos.z))
  1545. else
  1546. do
  1547. pHum.AutoRotate = true
  1548. if camDist < 0.6 + 0.07 * pHum.WalkSpeed then
  1549. fakeLA.Transparency = 0
  1550. fakeRA.Transparency = 0
  1551. else
  1552. fakeLA.Transparency = 1
  1553. fakeRA.Transparency = 1
  1554. end
  1555. if mouseChanged and (currentPose == "presentArms" or currentPose == "bayonetDown") then
  1556. mouseChanged = false
  1557. local hit, pos = calcMouseHit()
  1558. local pos = pHRP.CFrame * cfn(0, 1.5, 0):inverse() * pos
  1559. local ang = atan2(pos.y, -pos.z)
  1560. -- DECOMPILER ERROR at PC105: Unhandled construct in 'MakeBoolean' P1
  1561.  
  1562. if currentPose == "presentArms" and ang > -0.95 and ang < 0.999 then
  1563. setModifier:Fire(cfa(ang, 0, 0))
  1564. end
  1565. end
  1566. if currentPose == "bayonetDown" and ang > -0.4 and ang < 0.7 then
  1567. setModifier:Fire(cfa(ang, 0, 0))
  1568. end
  1569. end
  1570. end
  1571. end
  1572. end)
  1573. game:GetService("RunService).RenderStepped:connect(function()
  1574. if isEquipped and displayRecoil then
  1575. workspace.CurrentCamera.CFrame = workspace.CurrentCamera.CFrame * CFrame.Angles(0.007 * math.sin(25 * getTime()), 0.004 * math.cos(25 * getTime()), 0)
  1576. end
  1577. end)
  1578. end
  1579. -- DECOMPILER ERROR: 15 unprocessed JMP targets
  1580. end
  1581. end
  1582. end
  1583. end
  1584. end
  1585. end
  1586. end
  1587. end
  1588. end
  1589. end
  1590. end
  1591. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement