Advertisement
scriptaboii

Untitled

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