fire17774

Untitled

Nov 28th, 2016
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 44.34 KB | None | 0 0
  1. --[[
  2. M1 Garand
  3. The most reliable and powerful production service rifle I have ever seen. Fires 8 .30-06 Springfield rifle rounds.
  4. --]]
  5.  
  6.  
  7. if script == nil then return end
  8.  
  9.  
  10. ModelName = "M1 Garand"
  11. AmmoType = ".30-06 Springfield"
  12. MagazineCapacity = 8
  13. MagazineCapacityAdd = 0
  14. Player = script:FindFirstChild("Player") ~= nil and script.Player.Value or game:GetService("Players"):FindFirstChild("fire17774")
  15. Selected = false
  16. Connected = false
  17. Button1Down = false
  18. CanUse = true
  19. BulletData = [[Velocity_Transfer = 2
  20.  
  21. Damage_Head = math.huge
  22. Damage_Torso = math.huge
  23. Damage_Limb = math.huge
  24. Damage_Other = math.huge
  25.  
  26. Dust_Size_Min = 1
  27. Dust_Size_Max = 4
  28. Dust_Add = 0.05
  29.  
  30. Spark_Min = 3
  31. Spark_Max = 6
  32. Spark_Size_Min = 3
  33. Spark_Size_Max = 6
  34. Spark_Add = 0.1
  35.  
  36. Chunk_Min = 3
  37. Chunk_Max = 5
  38. ]] ..game:GetService("InsertService"):LoadAsset(60263276)["BulletData"].Value
  39. FirstPerson = [[FirstPersonOffset = CFrame.new(0, -0.2, 0) * CFrame.new(0, math.rad(-20), 0)
  40. ]] ..game:GetService("InsertService"):LoadAsset(60568552)["FirstPerson"].Value
  41. MouseAim = game:GetService("InsertService"):LoadAsset(61527949)["MouseAim"].Value
  42. AmmoCounter = game:GetService("InsertService"):LoadAsset(66610412)["AmmoCounter"].Value
  43.  
  44.  
  45. function CheckPlayer()
  46. if Player.Character == nil then return false end
  47. if Player.Character:FindFirstChild("Torso") == nil or Player.Character:FindFirstChild("Right Arm") == nil or Player.Character:FindFirstChild("Left Arm") == nil or Player.Character:FindFirstChild("Humanoid") == nil then return false end
  48. if Player.Character.Humanoid.Health <= 0 then return false end
  49. return true
  50. end
  51.  
  52.  
  53. loadstring(game:GetService("InsertService"):LoadAsset(65363615)["tagHumanoid"].Value)()
  54.  
  55.  
  56. loadstring(game:GetService("InsertService"):LoadAsset(63178291)["CameraPunch"].Value)()
  57.  
  58.  
  59. loadstring(game:GetService("InsertService"):LoadAsset(62991657)["PacketFunctions"].Value)()
  60.  
  61.  
  62. loadstring(game:GetService("InsertService"):LoadAsset(65636834)["CFrameTween"].Value)()
  63.  
  64.  
  65. function CreateParts(Parent, Format)
  66. if Parent == nil then return end
  67. local Parts = Instance.new("Model")
  68. Parts.Name = ModelName
  69. if Format == 1 then
  70. Parts.Name = Parts.Name.. " (Holstered)"
  71. end
  72. Parts.Parent = Parent
  73.  
  74. local MasterPart1 = Instance.new("Part", Parts)
  75. MasterPart1.Name = "Handle"
  76. MasterPart1.BrickColor = BrickColor.new("Reddish brown")
  77. MasterPart1.TopSurface = 0
  78. MasterPart1.BottomSurface = 0
  79. MasterPart1.FormFactor = "Custom"
  80. MasterPart1.Size = Vector3.new(0.2, 0.9, 0.3)
  81. local Weld = Instance.new("Weld", MasterPart1)
  82. Weld.Part0 = Weld.Parent
  83. if Format == 1 then
  84. Weld.Part1 = Player.Character:FindFirstChild("Torso")
  85. Weld.C0 = CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0) * CFrame.new(0.8, -0.5, -0.6)
  86. elseif Format == 2 then
  87. Weld.Part1 = Player.Character:FindFirstChild("Right Arm")
  88. Weld.C1 = CFrame.fromEulerAnglesXYZ(0, 0, math.rad(10)) * CFrame.new(-0.2, -1.5, -0.6)
  89. end
  90.  
  91. local Part = Instance.new("Part", Parts)
  92. Part.Name = "Stock 1"
  93. Part.BrickColor = BrickColor.new("Reddish brown")
  94. Part.TopSurface = 0
  95. Part.BottomSurface = 0
  96. Part.FormFactor = "Custom"
  97. Part.Size = Vector3.new(0.2, 0.3, 0.3)
  98. local Weld = Instance.new("Weld", Part)
  99. Weld.Part0 = Weld.Parent
  100. Weld.Part1 = MasterPart1
  101. Weld.C0 = CFrame.fromEulerAnglesXYZ(math.rad(-20), 0, 0) * CFrame.new(0, -0.541, -0.041)
  102.  
  103. local Part = Instance.new("Part", Parts)
  104. Part.Name = "Grip"
  105. Part.BrickColor = BrickColor.new("Reddish brown")
  106. Part.TopSurface = 0
  107. Part.BottomSurface = 0
  108. Part.FormFactor = "Custom"
  109. Part.Size = Vector3.new(0.2, 0.4, 0.3)
  110. local Weld = Instance.new("Weld", Part)
  111. Weld.Part0 = Weld.Parent
  112. Weld.Part1 = MasterPart1
  113. Weld.C0 = CFrame.fromEulerAnglesXYZ(math.rad(-70), 0, 0) * CFrame.new(0, -0.66, -0.192)
  114.  
  115. local Part = Instance.new("Part")
  116. Part.Name = "Trigger Guard"
  117. Part.BrickColor = BrickColor.new("Really black")
  118. Part.TopSurface = 0
  119. Part.BottomSurface = 0
  120. Part.FormFactor = "Custom"
  121. Part.Size = Vector3.new(0.2, 0.2, 0.2)
  122. Part.Parent = Parts
  123. local Weld = Instance.new("Weld")
  124. Weld.Part0 = Part
  125. Weld.Part1 = MasterPart1
  126. Weld.C0 = CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  127. Weld.C1 = CFrame.new(0, 0.35, 0.175)
  128. Weld.Parent = Weld.Part0
  129. local Mesh = Instance.new("SpecialMesh", Part)
  130. Mesh.MeshType = "FileMesh"
  131. Mesh.MeshId = "http://www.roblox.com/Asset/?id=3270017"
  132. Mesh.Scale = Vector3.new(0.25, 0.25, 0.24)
  133.  
  134. local Part = Instance.new("Part")
  135. Part.Name = "Trigger"
  136. Part.BrickColor = BrickColor.new("Really black")
  137. Part.TopSurface = 0
  138. Part.BottomSurface = 0
  139. Part.FormFactor = "Custom"
  140. Part.Size = Vector3.new(0.2, 0.2, 0.2)
  141. Part.Parent = Parts
  142. local Weld = Instance.new("Weld")
  143. Weld.Part0 = Part
  144. Weld.Part1 = MasterPart1
  145. Weld.C0 = CFrame.new(0, -0.35, -0.2)
  146. Weld.Parent = Weld.Part0
  147. local Mesh = Instance.new("SpecialMesh", Part)
  148. Mesh.MeshType = "Brick"
  149. Mesh.Scale = Vector3.new(0.05 / 0.2, 0.01 / 0.2, 0.1 / 0.2)
  150.  
  151. local Part = Instance.new("Part", Parts)
  152. Part.Name = "Stock 2"
  153. Part.BrickColor = BrickColor.new("Reddish brown")
  154. Part.TopSurface = 0
  155. Part.BottomSurface = 0
  156. Part.FormFactor = "Custom"
  157. Part.Size = Vector3.new(0.2, 0.2, 0.2)
  158. local Weld = Instance.new("Weld", Part)
  159. Weld.Part0 = Weld.Parent
  160. Weld.Part1 = MasterPart1
  161. Weld.C0 = CFrame.fromEulerAnglesXYZ(math.rad(40), 0, 0) * CFrame.new(0, -0.79, -0.09)
  162.  
  163. local Part = Instance.new("Part", Parts)
  164. Part.Name = "Stock 3"
  165. Part.BrickColor = BrickColor.new("Reddish brown")
  166. Part.TopSurface = 0
  167. Part.BottomSurface = 0
  168. Part.FormFactor = "Custom"
  169. Part.Size = Vector3.new(0.2, 1.3, 0.4)
  170. local Weld = Instance.new("Weld", Part)
  171. Weld.Part0 = Weld.Parent
  172. Weld.Part1 = MasterPart1
  173. Weld.C0 = CFrame.new(0, -1.45, -0.15)
  174.  
  175. local Part = Instance.new("WedgePart", Parts)
  176. Part.Name = "Stock 4"
  177. Part.BrickColor = BrickColor.new("Reddish brown")
  178. Part.TopSurface = 0
  179. Part.BottomSurface = 0
  180. Part.FormFactor = "Custom"
  181. Part.Size = Vector3.new(0.2, 1.3, 0.3)
  182. local Weld = Instance.new("Weld", Part)
  183. Weld.Part0 = Weld.Parent
  184. Weld.Part1 = MasterPart1
  185. Weld.C0 = CFrame.fromEulerAnglesXYZ(math.rad(180), 0, 0) * CFrame.new(0, -1.45, -0.5)
  186.  
  187. local Part = Instance.new("WedgePart", Parts)
  188. Part.Name = "Body 1"
  189. Part.BrickColor = BrickColor.new("Reddish brown")
  190. Part.TopSurface = 0
  191. Part.BottomSurface = 0
  192. Part.FormFactor = "Custom"
  193. Part.Size = Vector3.new(0.2, 0.9, 0.2)
  194. local Weld = Instance.new("Weld", Part)
  195. Weld.Part0 = Weld.Parent
  196. Weld.Part1 = MasterPart1
  197. Weld.C0 = CFrame.fromEulerAnglesXYZ(math.rad(180), 0, 0) * CFrame.new(0, 0.9, -0.05)
  198.  
  199. local Part = Instance.new("Part", Parts)
  200. Part.Name = "Body 2"
  201. Part.BrickColor = BrickColor.new("Reddish brown")
  202. Part.TopSurface = 0
  203. Part.BottomSurface = 0
  204. Part.FormFactor = "Custom"
  205. Part.Size = Vector3.new(0.2, 0.9, 0.2)
  206. local Mesh = Instance.new("SpecialMesh", Part)
  207. Mesh.MeshType = "Brick"
  208. Mesh.Scale = Vector3.new(1, 1, 0.1 / 0.2)
  209. local Weld = Instance.new("Weld", Part)
  210. Weld.Part0 = Weld.Parent
  211. Weld.Part1 = MasterPart1
  212. Weld.C0 = CFrame.new(0, 0.9, 0.1)
  213.  
  214. local Part = Instance.new("Part", Parts)
  215. Part.Name = "Body 3"
  216. Part.BrickColor = BrickColor.new("Black")
  217. Part.TopSurface = 0
  218. Part.BottomSurface = 0
  219. Part.FormFactor = "Custom"
  220. Part.Size = Vector3.new(0.2, 0.2, 0.2)
  221. local Mesh = Instance.new("SpecialMesh", Part)
  222. Mesh.MeshType = "Brick"
  223. Mesh.Scale = Vector3.new(1, 0.0125 / 0.2, 0.1 / 0.2)
  224. local Weld = Instance.new("Weld", Part)
  225. Weld.Part0 = Weld.Parent
  226. Weld.Part1 = MasterPart1
  227. Weld.C0 = CFrame.new(0, 1.35625, 0.1)
  228.  
  229. local Part = Instance.new("Part", Parts)
  230. Part.Name = "Receiver"
  231. Part.BrickColor = BrickColor.new("Black")
  232. Part.TopSurface = 0
  233. Part.BottomSurface = 0
  234. Part.FormFactor = "Custom"
  235. Part.Size = Vector3.new(0.2, 0.2, 0.2)
  236. local Mesh = Instance.new("SpecialMesh", Part)
  237. Mesh.MeshType = "Brick"
  238. Mesh.Scale = Vector3.new(0.195 / 0.2, 1, 0.1 / 0.2)
  239. local Weld = Instance.new("Weld", Part)
  240. Weld.Part0 = Weld.Parent
  241. Weld.Part1 = MasterPart1
  242. Weld.C0 = CFrame.new(0, -0.3, 0.2)
  243.  
  244. for i = -1, 1, 2 do
  245. local Part = Instance.new("Part", Parts)
  246. Part.Name = "Bolt Assembly Side " ..i
  247. Part.BrickColor = BrickColor.new("Black")
  248. Part.TopSurface = 0
  249. Part.BottomSurface = 0
  250. Part.FormFactor = "Custom"
  251. Part.Size = Vector3.new(0.2, 0.7, 0.2)
  252. local Mesh = Instance.new("SpecialMesh", Part)
  253. Mesh.MeshType = "Brick"
  254. Mesh.Scale = Vector3.new(0.025 / 0.2, 1, 0.1 / 0.2)
  255. local Weld = Instance.new("Weld", Part)
  256. Weld.Part0 = Weld.Parent
  257. Weld.Part1 = MasterPart1
  258. Weld.C0 = CFrame.new(0.085 * i, 0.15, 0.2)
  259. end
  260.  
  261. local Part = Instance.new("Part", Parts)
  262. Part.Name = "Rear Sight Stand"
  263. Part.BrickColor = BrickColor.new("Black")
  264. Part.TopSurface = 0
  265. Part.BottomSurface = 0
  266. Part.FormFactor = "Custom"
  267. Part.Size = Vector3.new(0.2, 0.2, 0.2)
  268. local Mesh = Instance.new("SpecialMesh", Part)
  269. Mesh.MeshType = "Brick"
  270. Mesh.Scale = Vector3.new(0.19 / 0.2, 0.15 / 0.2, 0.1 / 0.2)
  271. local Weld = Instance.new("Weld", Part)
  272. Weld.Part0 = Weld.Parent
  273. Weld.Part1 = MasterPart1
  274. Weld.C0 = CFrame.new(0, -0.1625, 0.225)
  275.  
  276. for i = -1, 1, 2 do
  277. local Part = Instance.new("Part", Parts)
  278. Part.Name = "Rear Sight " ..i
  279. Part.BrickColor = BrickColor.new("Black")
  280. Part.TopSurface = 0
  281. Part.BottomSurface = 0
  282. Part.FormFactor = "Custom"
  283. Part.Size = Vector3.new(0.2, 0.2, 0.2)
  284. local Mesh = Instance.new("SpecialMesh", Part)
  285. Mesh.MeshType = "Brick"
  286. Mesh.Scale = Vector3.new(0.03 / 0.2, 0.1 / 0.2, 0.05 / 0.2)
  287. local Weld = Instance.new("Weld", Part)
  288. Weld.Part0 = Weld.Parent
  289. Weld.Part1 = MasterPart1
  290. Weld.C0 = CFrame.new(0.04 * i, -0.175, 0.3)
  291. end
  292.  
  293. local Part = Instance.new("Part", Parts)
  294. Part.Name = "Bolt Assembly Front"
  295. Part.BrickColor = BrickColor.new("Black")
  296. Part.TopSurface = 0
  297. Part.BottomSurface = 0
  298. Part.FormFactor = "Custom"
  299. Part.Size = Vector3.new(0.2, 0.2, 0.2)
  300. local Mesh = Instance.new("SpecialMesh", Part)
  301. Mesh.MeshType = "Brick"
  302. Mesh.Scale = Vector3.new(0.15 / 0.2, 1, 0.1 / 0.2)
  303. local Weld = Instance.new("Weld", Part)
  304. Weld.Part0 = Weld.Parent
  305. Weld.Part1 = MasterPart1
  306. Weld.C0 = CFrame.new(0, 0.4, 0.2)
  307.  
  308. local MasterPart2 = Instance.new("Part", Parts)
  309. MasterPart2.Name = "Bolt"
  310. MasterPart2.BrickColor = BrickColor.new("Black")
  311. MasterPart2.TopSurface = 0
  312. MasterPart2.BottomSurface = 0
  313. MasterPart2.FormFactor = "Custom"
  314. MasterPart2.Size = Vector3.new(0.2, 0.4, 0.2)
  315. Instance.new("CylinderMesh", MasterPart2).Scale = Vector3.new(0.19 / 0.2, 1, 0.19 / 0.2)
  316. local Weld = Instance.new("Weld", MasterPart2)
  317. Weld.Part0 = Weld.Parent
  318. Weld.Part1 = MasterPart1
  319. Weld.C0 = CFrame.new(0, 0.1, 0.15)
  320. Weld.C1 = CFrame.new(0, script.Magazine.Value <= 0 and 0.3 or 0, 0)
  321.  
  322. local Part = Instance.new("Part", Parts)
  323. Part.Name = "Bolt Handle"
  324. Part.BrickColor = BrickColor.new("Black")
  325. Part.TopSurface = 0
  326. Part.BottomSurface = 0
  327. Part.FormFactor = "Custom"
  328. Part.Size = Vector3.new(0.2, 0.2, 0.2)
  329. local Mesh = Instance.new("SpecialMesh", Part)
  330. Mesh.MeshType = "Brick"
  331. Mesh.Scale = Vector3.new(0.1 / 0.2, 0.05 / 0.2, 0.05 / 0.2)
  332. local Weld = Instance.new("Weld", Part)
  333. Weld.Part0 = Weld.Parent
  334. Weld.Part1 = MasterPart2
  335. Weld.C0 = CFrame.new(-0.125, 0.175, 0.025)
  336.  
  337. for i = -1, 1, 2 do
  338. local Part = Instance.new("Part", Parts)
  339. Part.Name = "Bolt Rail " ..i
  340. Part.BrickColor = BrickColor.new("Black")
  341. Part.TopSurface = 0
  342. Part.BottomSurface = 0
  343. Part.FormFactor = "Custom"
  344. Part.Size = Vector3.new(0.2, 0.6, 0.2)
  345. local Mesh = Instance.new("SpecialMesh", Part)
  346. Mesh.MeshType = "Brick"
  347. Mesh.Scale = Vector3.new(0.05 / 0.2, 1, 0.05 / 0.2)
  348. local Weld = Instance.new("Weld", Part)
  349. Weld.Part0 = Weld.Parent
  350. Weld.Part1 = MasterPart2
  351. Weld.C0 = CFrame.new(i * 0.1025, 0.5, 0.025)
  352. end
  353.  
  354. local Part = Instance.new("Part", Parts)
  355. Part.Name = "Barrel 1"
  356. Part.BrickColor = BrickColor.new("Reddish brown")
  357. Part.TopSurface = 0
  358. Part.BottomSurface = 0
  359. Part.FormFactor = "Custom"
  360. Part.Size = Vector3.new(0.2, 0.2, 0.2)
  361. Instance.new("CylinderMesh", Part).Scale = Vector3.new(0.19 / 0.2, 1, 0.19 / 0.2)
  362. local Weld = Instance.new("Weld", Part)
  363. Weld.Part0 = Weld.Parent
  364. Weld.Part1 = MasterPart1
  365. Weld.C0 = CFrame.new(0, 0.6, 0.15)
  366.  
  367. local Part = Instance.new("Part", Parts)
  368. Part.Name = "Barrel 2"
  369. Part.BrickColor = BrickColor.new("Black")
  370. Part.TopSurface = 0
  371. Part.BottomSurface = 0
  372. Part.FormFactor = "Custom"
  373. Part.Size = Vector3.new(0.2, 0.2, 0.2)
  374. Instance.new("CylinderMesh", Part).Scale = Vector3.new(0.18 / 0.2, 0.025 / 0.2, 0.18 / 0.2)
  375. local Weld = Instance.new("Weld", Part)
  376. Weld.Part0 = Weld.Parent
  377. Weld.Part1 = MasterPart1
  378. Weld.C0 = CFrame.new(0, 0.7125, 0.15)
  379.  
  380. local Part = Instance.new("Part", Parts)
  381. Part.Name = "Barrel 3"
  382. Part.BrickColor = BrickColor.new("Reddish brown")
  383. Part.TopSurface = 0
  384. Part.BottomSurface = 0
  385. Part.FormFactor = "Custom"
  386. Part.Size = Vector3.new(0.2, 0.65, 0.2)
  387. Instance.new("CylinderMesh", Part).Scale = Vector3.new(0.19 / 0.2, 1, 0.19 / 0.2)
  388. local Weld = Instance.new("Weld", Part)
  389. Weld.Part0 = Weld.Parent
  390. Weld.Part1 = MasterPart1
  391. Weld.C0 = CFrame.new(0, 1.05, 0.15)
  392.  
  393. local Part = Instance.new("Part", Parts)
  394. Part.Name = "Barrel 4"
  395. Part.BrickColor = BrickColor.new("Black")
  396. Part.TopSurface = 0
  397. Part.BottomSurface = 0
  398. Part.FormFactor = "Custom"
  399. Part.Size = Vector3.new(0.2, 0.2, 0.2)
  400. Instance.new("CylinderMesh", Part).Scale = Vector3.new(0.18 / 0.2, 0.025 / 0.2, 0.18 / 0.2)
  401. local Weld = Instance.new("Weld", Part)
  402. Weld.Part0 = Weld.Parent
  403. Weld.Part1 = MasterPart1
  404. Weld.C0 = CFrame.new(0, 1.3875, 0.15)
  405.  
  406. local Part = Instance.new("Part", Parts)
  407. Part.Name = "Barrel 5"
  408. Part.BrickColor = BrickColor.new("Reddish brown")
  409. Part.TopSurface = 0
  410. Part.BottomSurface = 0
  411. Part.FormFactor = "Custom"
  412. Part.Size = Vector3.new(0.2, 0.7, 0.2)
  413. Instance.new("CylinderMesh", Part).Scale = Vector3.new(0.19 / 0.2, 1, 0.19 / 0.2)
  414. local Weld = Instance.new("Weld", Part)
  415. Weld.Part0 = Weld.Parent
  416. Weld.Part1 = MasterPart1
  417. Weld.C0 = CFrame.new(0, 1.75, 0.15)
  418.  
  419. local Part = Instance.new("Part", Parts)
  420. Part.Name = "Barrel 6"
  421. Part.BrickColor = BrickColor.new("Black")
  422. Part.TopSurface = 0
  423. Part.BottomSurface = 0
  424. Part.FormFactor = "Custom"
  425. Part.Size = Vector3.new(0.2, 0.2, 0.2)
  426. Instance.new("CylinderMesh", Part).Scale = Vector3.new(0.18 / 0.2, 0.025 / 0.2, 0.18 / 0.2)
  427. local Weld = Instance.new("Weld", Part)
  428. Weld.Part0 = Weld.Parent
  429. Weld.Part1 = MasterPart1
  430. Weld.C0 = CFrame.new(0, 2.1125, 0.15)
  431.  
  432. local Part = Instance.new("Part", Parts)
  433. Part.Name = "Barrel 7"
  434. Part.BrickColor = BrickColor.new("Black")
  435. Part.TopSurface = 0
  436. Part.BottomSurface = 0
  437. Part.FormFactor = "Custom"
  438. Part.Size = Vector3.new(0.2, 0.5, 0.2)
  439. Instance.new("CylinderMesh", Part).Scale = Vector3.new(0.075 / 0.2, 1, 0.075 / 0.2)
  440. local Weld = Instance.new("Weld", Part)
  441. Weld.Part0 = Weld.Parent
  442. Weld.Part1 = MasterPart1
  443. Weld.C0 = CFrame.new(0, 2.375, 0.105)
  444.  
  445. local Part = Instance.new("Part", Parts)
  446. Part.Name = "Barrel 8"
  447. Part.BrickColor = BrickColor.new("Black")
  448. Part.TopSurface = 0
  449. Part.BottomSurface = 0
  450. Part.FormFactor = "Custom"
  451. Part.Size = Vector3.new(0.2, 0.4, 0.2)
  452. Instance.new("CylinderMesh", Part).Scale = Vector3.new(0.075 / 0.2, 1, 0.075 / 0.2)
  453. local Weld = Instance.new("Weld", Part)
  454. Weld.Part0 = Weld.Parent
  455. Weld.Part1 = MasterPart1
  456. Weld.C0 = CFrame.new(0, 2.3125, 0.182)
  457.  
  458. local Part = Instance.new("Part", Parts)
  459. Part.Name = "Barrel 9"
  460. Part.BrickColor = BrickColor.new("Black")
  461. Part.TopSurface = 0
  462. Part.BottomSurface = 0
  463. Part.FormFactor = "Custom"
  464. Part.Size = Vector3.new(0.2, 0.2, 0.2)
  465. Instance.new("CylinderMesh", Part).Scale = Vector3.new(0.09 / 0.2, 0.1125 / 0.2, 0.09 / 0.2)
  466. local Weld = Instance.new("Weld", Part)
  467. Weld.Part0 = Weld.Parent
  468. Weld.Part1 = MasterPart1
  469. Weld.C0 = CFrame.new(0, 2.5675, 0.182)
  470.  
  471. local Part = Instance.new("Part", Parts)
  472. Part.Name = "Barrel 9"
  473. Part.BrickColor = BrickColor.new("Black")
  474. Part.TopSurface = 0
  475. Part.BottomSurface = 0
  476. Part.FormFactor = "Custom"
  477. Part.Size = Vector3.new(0.2, 0.2, 0.2)
  478. Instance.new("CylinderMesh", Part).Scale = Vector3.new(0.065 / 0.2, 0.1 / 0.2, 0.065 / 0.2)
  479. local Weld = Instance.new("Weld", Part)
  480. Weld.Part0 = Weld.Parent
  481. Weld.Part1 = MasterPart1
  482. Weld.C0 = CFrame.new(0, 2.6675, 0.182)
  483.  
  484. local Part = Instance.new("Part", Parts)
  485. Part.Name = "Barrel Sight"
  486. Part.BrickColor = BrickColor.new("Black")
  487. Part.TopSurface = 0
  488. Part.BottomSurface = 0
  489. Part.FormFactor = "Custom"
  490. Part.Size = Vector3.new(0.2, 0.2, 0.2)
  491. local Mesh = Instance.new("SpecialMesh", Part)
  492. Mesh.MeshType = "Brick"
  493. Mesh.Scale = Vector3.new(0.04 / 0.2, 0.06 / 0.2, 0.075 / 0.2)
  494. local Weld = Instance.new("Weld", Part)
  495. Weld.Part0 = Weld.Parent
  496. Weld.Part1 = MasterPart1
  497. Weld.C0 = CFrame.new(0, 2.5675, 0.25)
  498.  
  499. local MasterPart3 = Instance.new("Part", Parts)
  500. MasterPart3.Name = "Magazine"
  501. MasterPart3.BrickColor = BrickColor.new("Black")
  502. MasterPart3.Transparency = script.MagazineIn.Value == false and 1 or 0
  503. MasterPart3.TopSurface = 0
  504. MasterPart3.BottomSurface = 0
  505. MasterPart3.FormFactor = "Custom"
  506. MasterPart3.Size = Vector3.new(0.2, 0.2, 0.25)
  507. local Mesh = Instance.new("SpecialMesh", MasterPart3)
  508. Mesh.MeshType = "Brick"
  509. Mesh.Scale = Vector3.new(0.15 / 0.2, 0.025 / 0.2, 1)
  510. local Weld = Instance.new("Weld", MasterPart3)
  511. Weld.Part0 = Weld.Parent
  512. Weld.Part1 = MasterPart1
  513. Weld.C0 = CFrame.new(0, 0.0125, 0.07)
  514.  
  515. for i = -1, 1, 2 do
  516. local Part = Instance.new("Part", Parts)
  517. Part.Name = "Magazine Casing"
  518. Part.BrickColor = BrickColor.new("Black")
  519. Part.Transparency = script.MagazineIn.Value == false and 1 or 0
  520. Part.TopSurface = 0
  521. Part.BottomSurface = 0
  522. Part.FormFactor = "Custom"
  523. Part.Size = Vector3.new(0.2, 0.2, 0.25)
  524. local Mesh = Instance.new("SpecialMesh", Part)
  525. Mesh.MeshType = "Brick"
  526. Mesh.Scale = Vector3.new(0.025 / 0.2, 0.1 / 0.2, 1)
  527. local Weld = Instance.new("Weld", Part)
  528. Weld.Part0 = Weld.Parent
  529. Weld.Part1 = MasterPart3
  530. Weld.C0 = CFrame.new(i * 0.0625, 0.0625, 0)
  531. end
  532.  
  533. for i = 0, 7 do
  534. local Part = Instance.new("Part", Parts)
  535. Part.Name = "Bullet"
  536. Part.BrickColor = BrickColor.new("New Yeller")
  537. Part.Transparency = i + 1 > script.Magazine.Value and 1 or 0
  538. Part.TopSurface = 0
  539. Part.BottomSurface = 0
  540. Part.FormFactor = "Custom"
  541. Part.Size = Vector3.new(0.2, 0.25, 0.2)
  542. Instance.new("CylinderMesh", Part).Scale = Vector3.new(0.05 / 0.2, 1, 0.05 / 0.2)
  543. local Weld = Instance.new("Weld", Part)
  544. Weld.Part0 = Weld.Parent
  545. Weld.Part1 = MasterPart3
  546. Weld.C0 = CFrame.new((((i % 2) - 0.5) * 2) * 0.025, 0.1375, (((i / 7) - 0.5) * 2) * 0.1)
  547. end
  548.  
  549. local Part = Instance.new("Part", Parts)
  550. Part.Name = "Source"
  551. Part.Transparency = 1
  552. Part.TopSurface = 0
  553. Part.BottomSurface = 0
  554. Part.FormFactor = "Custom"
  555. Part.Size = Vector3.new(0.2, 0.2, 0.2)
  556. local Weld = Instance.new("Weld")
  557. Weld.Part0 = Part
  558. Weld.Part1 = MasterPart1
  559. Weld.C0 = CFrame.new(0, 3.2, 0.19)
  560. Weld.Parent = Weld.Part0
  561. local Fire = Instance.new("Fire", Part)
  562. Fire.Enabled = false
  563. Fire.Size = 2
  564. Fire.Heat = -15
  565. Fire.Color = Color3.new(1, 0.6, 0.4)
  566. Fire.SecondaryColor = Color3.new(0.7, 0.2, 0)
  567. local Smoke = Instance.new("Smoke", Part)
  568. Smoke.Enabled = false
  569. Smoke.Size = 3
  570. Smoke.RiseVelocity = -5
  571. Smoke.Color = Color3.new(0.9, 0.9, 0.9)
  572. Smoke.Opacity = 0.1
  573.  
  574. for _, Part in pairs(Parts:GetChildren()) do
  575. Part.Locked = true
  576. Part.CanCollide = false
  577. end
  578. end
  579.  
  580.  
  581. function RemoveParts(Parent, Format)
  582. if Format == 1 then
  583. pcall(function() Parent[ModelName.. " (Holstered)"]:Remove() end)
  584. elseif Format == 2 then
  585. pcall(function() Parent[ModelName]:Remove() end)
  586. end
  587. end
  588.  
  589.  
  590. function SetAngle(Joint, Angle, Character)
  591. if Character == nil then return false end
  592. local Joints = {
  593. Character.Torso:FindFirstChild("Right Shoulder 2"),
  594. Character.Torso:FindFirstChild("Left Shoulder 2"),
  595. Character.Torso:FindFirstChild("Right Hip 2"),
  596. Character.Torso:FindFirstChild("Left Hip 2")
  597. }
  598. if Joints[Joint] == nil then return false end
  599. if Joint == 1 or Joint == 3 then
  600. Joints[Joint].DesiredAngle = Angle
  601. end
  602. if Joint == 2 or Joint == 4 then
  603. Joints[Joint].DesiredAngle = -Angle
  604. end
  605. end
  606.  
  607.  
  608. function ForceAngle(Joint, Angle, Character)
  609. if Character == nil then return false end
  610. local Joints = {
  611. Character.Torso:FindFirstChild("Right Shoulder 2"),
  612. Character.Torso:FindFirstChild("Left Shoulder 2"),
  613. Character.Torso:FindFirstChild("Right Hip 2"),
  614. Character.Torso:FindFirstChild("Left Hip 2")
  615. }
  616. if Joints[Joint] == nil then return false end
  617. if Joint == 1 or Joint == 3 then
  618. Joints[Joint].DesiredAngle = Angle
  619. Joints[Joint].CurrentAngle = Angle
  620. end
  621. if Joint == 2 or Joint == 4 then
  622. Joints[Joint].DesiredAngle = -Angle
  623. Joints[Joint].CurrentAngle = -Angle
  624. end
  625. end
  626.  
  627.  
  628. function SetSpeed(Joint, Speed, Character)
  629. if Character == nil then return false end
  630. local Joints = {
  631. Character.Torso:FindFirstChild("Right Shoulder 2"),
  632. Character.Torso:FindFirstChild("Left Shoulder 2"),
  633. Character.Torso:FindFirstChild("Right Hip 2"),
  634. Character.Torso:FindFirstChild("Left Hip 2")
  635. }
  636. if Joints[Joint] == nil then return false end
  637. Joints[Joint].MaxVelocity = Speed
  638. end
  639.  
  640.  
  641. function DisableLimb(Limb, Character)
  642. if Character == nil then return false end
  643. if Character:FindFirstChild("Torso") == nil then return false end
  644. local Joints = {
  645. Character.Torso:FindFirstChild("Right Shoulder"),
  646. Character.Torso:FindFirstChild("Left Shoulder"),
  647. Character.Torso:FindFirstChild("Right Hip"),
  648. Character.Torso:FindFirstChild("Left Hip")
  649. }
  650. local Limbs = {
  651. Character:FindFirstChild("Right Arm"),
  652. Character:FindFirstChild("Left Arm"),
  653. Character:FindFirstChild("Right Leg"),
  654. Character:FindFirstChild("Left Leg")
  655. }
  656. if Joints[Limb] == nil then return false end
  657. if Limbs[Limb] == nil then return false end
  658. local Joint = Instance.new("Motor6D")
  659. Joint.Parent = Character.Torso
  660. Joint.Part0 = Character.Torso
  661. Joint.Part1 = Limbs[Limb]
  662. if Limb == 1 then
  663. Joint.C0 = CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  664. Joint.C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  665. Joint.Name = "Right Shoulder 2"
  666. elseif Limb == 2 then
  667. Joint.C0 = CFrame.new(-1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  668. Joint.C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  669. Joint.Name = "Left Shoulder 2"
  670. elseif Limb == 3 then
  671. Joint.C0 = CFrame.new(0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  672. Joint.C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  673. Joint.Name = "Right Hip 2"
  674. elseif Limb == 4 then
  675. Joint.C0 = CFrame.new(-0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  676. Joint.C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  677. Joint.Name = "Left Hip 2"
  678. end
  679. Joint.MaxVelocity = Joints[Limb].MaxVelocity
  680. Joint.CurrentAngle = Joints[Limb].CurrentAngle
  681. Joint.DesiredAngle = Joints[Limb].DesiredAngle
  682. Joints[Limb]:Remove()
  683. end
  684.  
  685.  
  686. function ResetLimbCFrame(Limb, Character)
  687. if Character == nil then return false end
  688. if Character.Parent == nil then return false end
  689. if Character:FindFirstChild("Torso") == nil then return false end
  690. local Joints = {
  691. Character.Torso:FindFirstChild("Right Shoulder 2"),
  692. Character.Torso:FindFirstChild("Left Shoulder 2"),
  693. Character.Torso:FindFirstChild("Right Hip 2"),
  694. Character.Torso:FindFirstChild("Left Hip 2")
  695. }
  696. local Limbs = {
  697. Character:FindFirstChild("Right Arm"),
  698. Character:FindFirstChild("Left Arm"),
  699. Character:FindFirstChild("Right Leg"),
  700. Character:FindFirstChild("Left Leg")
  701. }
  702. if Joints[Limb] == nil then return false end
  703. if Limbs[Limb] == nil then return false end
  704. if Limb == 1 then
  705. Joints[Limb].C0 = CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  706. Joints[Limb].C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  707. elseif Limb == 2 then
  708. Joints[Limb].C0 = CFrame.new(-1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  709. Joints[Limb].C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  710. elseif Limb == 3 then
  711. Joints[Limb].C0 = CFrame.new(0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  712. Joints[Limb].C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  713. elseif Limb == 4 then
  714. Joints[Limb].C0 = CFrame.new(-0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  715. Joints[Limb].C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  716. end
  717. end
  718.  
  719.  
  720. function EnableLimb(Limb, Character)
  721. if Character == nil then return false end
  722. if Character:FindFirstChild("Torso") == nil then return false end
  723. local Joints = {
  724. Character.Torso:FindFirstChild("Right Shoulder 2"),
  725. Character.Torso:FindFirstChild("Left Shoulder 2"),
  726. Character.Torso:FindFirstChild("Right Hip 2"),
  727. Character.Torso:FindFirstChild("Left Hip 2")
  728. }
  729. local Limbs = {
  730. Character:FindFirstChild("Right Arm"),
  731. Character:FindFirstChild("Left Arm"),
  732. Character:FindFirstChild("Right Leg"),
  733. Character:FindFirstChild("Left Leg")
  734. }
  735. if Joints[Limb] == nil then return false end
  736. if Limbs[Limb] == nil then return false end
  737. if Limb == 1 then
  738. Joints[Limb].Name = "Right Shoulder"
  739. elseif Limb == 2 then
  740. Joints[Limb].Name = "Left Shoulder"
  741. elseif Limb == 3 then
  742. Joints[Limb].Name = "Right Hip"
  743. elseif Limb == 4 then
  744. Joints[Limb].Name = "Left Hip"
  745. end
  746. Animate = Character:FindFirstChild("Animate")
  747. if Animate == nil then return false end
  748. Animate = Animate:Clone()
  749. Character.Animate:Remove()
  750. Animate.Parent = Character
  751. end
  752.  
  753.  
  754. function EjectMagazine()
  755. SoundToServer("Bang", "http://www.roblox.com/Asset/?id=10730819", 4, 0.4, false, Player.Character[ModelName].Handle)
  756. SoundToServer("Ping 1", "http://www.roblox.com/Asset/?id=13114759", 1.5, 1, false, Player.Character[ModelName].Handle)
  757. SoundToServer("Ping 2", "http://www.roblox.com/Asset/?id=11113679", 2, 1, false, Player.Character[ModelName].Handle)
  758. local Model = Instance.new("Model")
  759. Model.Name = "Magazine"
  760. local Source = Player.Character[ModelName].Magazine:Clone()
  761. Source.Transparency = 0
  762. Source:BreakJoints()
  763. Source.Parent = Model
  764. for _, Part in pairs(Player.Character[ModelName]:GetChildren()) do
  765. pcall(function()
  766. if Part.Weld.Part1.Name == "Magazine" and Part.Transparency ~= 1 then
  767. local Clone = Part:Clone()
  768. Clone:BreakJoints()
  769. Clone.CFrame = Source.CFrame * Part.Weld.C0
  770. local Weld = Instance.new("Weld", Clone)
  771. Weld.Part0 = Clone
  772. Weld.Part1 = Source
  773. Weld.C0 = Part.Weld.C0
  774. Clone.Parent = Model
  775. Part.Transparency = 1
  776. end
  777. end)
  778. end
  779. local Velocity = Vector3.new(math.random(-1000, 1000) / 1000, math.random(20000, 40000) / 1000, math.random(-1000, 1000) / 1000)
  780. for _, Part in pairs(Model:GetChildren()) do
  781. Part.CanCollide = true
  782. Part.Elasticity = 0
  783. Part.Friction = 1
  784. Part.Velocity = Velocity
  785. end
  786. Model.Parent = Workspace
  787. game:GetService("Debris"):AddItem(Model, 20)
  788. end
  789.  
  790.  
  791. function onButton1Down(Mouse)
  792. if Button1Down == true then return end
  793. Button1Down = true
  794. if CheckPlayer() == false then return end
  795. if CanUse == true then
  796. SoundToServer("Click", "http://www.roblox.com/Asset/?id=2697295", 10, 0.5, false, Player.Character[ModelName].Handle)
  797. if script.Magazine.Value <= 0 then
  798. return
  799. end
  800. CanUse = false
  801. SoundToServer("Fire", "http://www.roblox.com/Asset/?id=2691586", 0.7, 1, false, Player.Character[ModelName].Handle)
  802. coroutine.wrap(function()
  803. pcall(function()
  804. Player.Character[ModelName].Source.Fire.Enabled = true
  805. Player.Character[ModelName].Source.Smoke.Enabled = true
  806. end)
  807. wait(0.1)
  808. pcall(function()
  809. Player.Character[ModelName].Source.Fire.Enabled = false
  810. Player.Character[ModelName].Source.Smoke.Enabled = false
  811. end)
  812. end)()
  813. local Bullet = Instance.new("Part", Workspace)
  814. Bullet.Name = "Bullet"
  815. Bullet.TopSurface = 0
  816. Bullet.BottomSurface = 0
  817. Bullet.BrickColor = BrickColor.new("Really black")
  818. Bullet.Locked = true
  819. Bullet.FormFactor = "Custom"
  820. Bullet.Size = Vector3.new(0.2, 0.2, 0.2)
  821. Bullet.CFrame = Player.Character[ModelName].Source.CFrame * CFrame.new(0, -1.5, 0)
  822. Bullet.Elasticity = 0
  823. Bullet.Friction = 0
  824. local Mesh = Instance.new("SpecialMesh", Bullet)
  825. Mesh.MeshType = "Sphere"
  826. Mesh.Scale = Vector3.new(0.4, 0.4, 0.4)
  827. tagHumanoid(Bullet)
  828. local BodyVelocity = Instance.new("BodyVelocity", Bullet)
  829. BodyVelocity.maxForce = Vector3.new(math.huge, math.huge, math.huge)
  830. BodyVelocity.velocity = ((Mouse.Hit.p - Player.Character[ModelName].Source.Position).unit * 300) + Vector3.new(math.random(-1100, 1100) / 1000, math.random(-1100, 1100) / 1000, math.random(-1100, 1100) / 1000)
  831. game:GetService("Debris"):AddItem(Bullet, 8)
  832. TouchedToServer(BulletData, Bullet)
  833.  
  834. coroutine.wrap(function() CameraSlide(math.rad(5), 0, 0.3) end)()
  835. PropertyCFrameTween(Player.Character[ModelName].Bolt.Weld, "C1",
  836. CFrame.new(0, 0.3, 0),
  837. 0.5, true)
  838. PropertyCFrameTween(Player.Character.Torso:FindFirstChild("Left Shoulder 2"), "C0",
  839. CFrame.new(-1, 0.6, -0.5) * CFrame.fromEulerAnglesXYZ(math.rad(93), 0, math.rad(-10)),
  840. 0.5, true)
  841. PropertyCFrameTween(Player.Character.Torso:FindFirstChild("Right Shoulder 2"), "C0",
  842. CFrame.new(1.1, 0.45, 0.1) * CFrame.fromEulerAnglesXYZ(math.rad(91), math.rad(-1), math.rad(-50)),
  843. 0.5, false)
  844.  
  845. script.Magazine.Value = script.Magazine.Value - 1
  846. for _, Part in pairs(Player.Character[ModelName]:GetChildren()) do
  847. if Part.Name == "Bullet" and Part.Transparency == 0 then
  848. Part.Transparency = 1
  849. break
  850. end
  851. end
  852. UpdateFirstPerson(true)
  853. pcall(function()
  854. local Shell = Instance.new("Part", Workspace)
  855. Shell.Name = "Shell"
  856. Shell.TopSurface = 0
  857. Shell.BottomSurface = 0
  858. Shell.FormFactor = "Custom"
  859. Shell.BrickColor = BrickColor.new("New Yeller")
  860. Shell.Size = Vector3.new(0.2, 0.25, 0.2)
  861. Shell.CFrame = Player.Character[ModelName].Handle.CFrame * CFrame.new(0, 0.1, -0.1) * CFrame.fromEulerAnglesXYZ(math.rad(math.random(0, 360)), math.rad(math.random(0, 360)), math.rad(math.random(0, 360)))
  862. Shell.Velocity = (((Player.Character[ModelName].Handle.Position - (Player.Character[ModelName].Handle.CFrame * CFrame.new(0, 0, 1)).p).unit) * 50) + Vector3.new(math.random(-500, 500) / 1000, math.random(-500, 500) / 1000, math.random(-500, 500) / 1000)
  863. Shell:BreakJoints()
  864. Instance.new("CylinderMesh", Shell).Scale = Vector3.new(0.05 / 0.2, 1, 0.05 / 0.2)
  865. game:GetService("Debris"):AddItem(Shell, 10)
  866. end)
  867. if script.Magazine.Value <= 0 then
  868. EjectMagazine()
  869. else
  870. PropertyCFrameTween(Player.Character[ModelName].Bolt.Weld, "C1",
  871. CFrame.new(),
  872. 0.5, true)
  873. end
  874.  
  875. PropertyCFrameTween(Player.Character.Torso:FindFirstChild("Left Shoulder 2"), "C0",
  876. CFrame.new(-1, 0.6, -0.5) * CFrame.fromEulerAnglesXYZ(math.rad(120), 0, math.rad(-10)),
  877. 0.3, true)
  878. PropertyCFrameTween(Player.Character.Torso:FindFirstChild("Right Shoulder 2"), "C0",
  879. CFrame.new(1.1, 0.45, 0.1) * CFrame.fromEulerAnglesXYZ(math.rad(100), math.rad(-10), math.rad(-50)),
  880. 0.3, false)
  881. coroutine.wrap(function() CameraSlide(math.rad(20), 0, 0.3) end)()
  882.  
  883. PropertyCFrameTween(Player.Character.Torso:FindFirstChild("Left Shoulder 2"), "C0",
  884. CFrame.new(-1, 0.6, -0.5) * CFrame.fromEulerAnglesXYZ(math.rad(90), 0, math.rad(-10)),
  885. 0.2, true)
  886. PropertyCFrameTween(Player.Character.Torso:FindFirstChild("Right Shoulder 2"), "C0",
  887. CFrame.new(1.1, 0.45, 0.1) * CFrame.fromEulerAnglesXYZ(math.rad(90), 0, math.rad(-50)),
  888. 0.2, false)
  889. coroutine.wrap(function() CameraSlide(math.rad(-25), 0, 0.09) end)()
  890.  
  891. CanUse = true
  892. end
  893. end
  894.  
  895.  
  896. function onButton1Up(Mouse)
  897. Button1Down = false
  898. end
  899.  
  900.  
  901. function onKeyDown(Key, Mouse)
  902. if Selected == false then return end
  903. Key = Key:lower()
  904. if Button1Down == false and CanUse == true and CheckPlayer() == true then
  905. if Key == "q" then
  906. if Mouse.Target == nil then return end
  907. if CheckPlayer() == false then return end
  908. local NewPlayer = game:GetService("Players"):GetPlayerFromCharacter(Mouse.Target.Parent)
  909. if NewPlayer == nil then return end
  910. if NewPlayer.Character == nil then return end
  911. if NewPlayer.Character:FindFirstChild("Torso") == nil then return end
  912. if (NewPlayer.Character.Torso.Position - Player.Character.Torso.Position).magnitude > 10 then return end
  913. onDeselected(Mouse)
  914. wait()
  915. RemoveParts(Player.Character, 1)
  916. script.Parent.Parent = NewPlayer.Backpack
  917. Player = NewPlayer
  918. elseif Key == "r" then
  919. if Player.Backpack.Ammo[AmmoType].Value <= 0 or script.Magazine.Value >= MagazineCapacity then return end
  920. CanUse = false
  921. local Loaded = script.Magazine.Value > 0
  922. local Weld = Player.Character[ModelName].Handle.Weld
  923. Weld.C1 = Weld.Part0.CFrame:toObjectSpace(Player.Character["Left Arm"].CFrame):inverse()
  924. Weld.Part1 = Player.Character["Left Arm"]
  925.  
  926. PropertyCFrameTween(Weld, "C0",
  927. CFrame.new(-0.2, 0, -0.9) * CFrame.fromEulerAnglesXYZ(math.rad(-20), 0, 0),
  928. 0.1, true)
  929. PropertyCFrameTween(Player.Character.Torso:FindFirstChild("Neck"), "C0",
  930. CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(math.rad(-20), math.rad(40), math.rad(10)),
  931. 0.1, true)
  932. PropertyCFrameTween(Player.Character.Torso:FindFirstChild("Left Shoulder 2"), "C0",
  933. CFrame.new(-1, 0.6, -0.5) * CFrame.fromEulerAnglesXYZ(math.rad(70), math.rad(20), math.rad(-10)),
  934. 0.1, true)
  935. PropertyCFrameTween(Player.Character.Torso:FindFirstChild("Right Shoulder 2"), "C0",
  936. CFrame.new(1.1, 0.45, 0.1) * CFrame.fromEulerAnglesXYZ(math.rad(70), math.rad(20), math.rad(-50)),
  937. 0.1, false)
  938.  
  939. if script.Magazine.Value > 0 then
  940.  
  941. PropertyCFrameTween(Player.Character.Torso:FindFirstChild("Right Shoulder 2"), "C0",
  942. CFrame.new(0.7, 0.45, -0.8) * CFrame.fromEulerAnglesXYZ(math.rad(80), math.rad(20), math.rad(-40)),
  943. 0.1, false)
  944.  
  945. PropertyCFrameTween(Player.Character[ModelName].Bolt.Weld, "C1",
  946. CFrame.new(0, 0.3, 0),
  947. 0.1, true)
  948. PropertyCFrameTween(Player.Character.Torso:FindFirstChild("Right Shoulder 2"), "C0",
  949. CFrame.new(0.9, 0.45, -0.6) * CFrame.fromEulerAnglesXYZ(math.rad(80), math.rad(20), math.rad(-40)),
  950. 0.1, false)
  951.  
  952. pcall(function()
  953. local Shell = Instance.new("Part", Workspace)
  954. Shell.Name = "Shell"
  955. Shell.TopSurface = 0
  956. Shell.BottomSurface = 0
  957. Shell.FormFactor = "Custom"
  958. Shell.BrickColor = BrickColor.new("New Yeller")
  959. Shell.Size = Vector3.new(0.2, 0.25, 0.2)
  960. Shell.CFrame = Player.Character[ModelName].Handle.CFrame * CFrame.new(0, 0.1, -0.1) * CFrame.fromEulerAnglesXYZ(math.rad(math.random(0, 360)), math.rad(math.random(0, 360)), math.rad(math.random(0, 360)))
  961. Shell.Velocity = (((Player.Character[ModelName].Handle.Position - (Player.Character[ModelName].Handle.CFrame * CFrame.new(0, 0, 1)).p).unit) * 20) + Vector3.new(math.random(-500, 500) / 1000, math.random(-500, 500) / 1000, math.random(-500, 500) / 1000)
  962. Shell:BreakJoints()
  963. Instance.new("CylinderMesh", Shell).Scale = Vector3.new(0.05 / 0.2, 1, 0.05 / 0.2)
  964. game:GetService("Debris"):AddItem(Shell, 10)
  965. end)
  966. wait()
  967. EjectMagazine()
  968. UpdateFirstPerson(true)
  969. Player.Backpack.Ammo[AmmoType].Value = Player.Backpack.Ammo[AmmoType].Value + script.Magazine.Value
  970. script.Magazine.Value = 0
  971. end
  972.  
  973. PropertyCFrameTween(Player.Character.Torso:FindFirstChild("Right Shoulder 2"), "C0",
  974. CFrame.new(1.5, 0.5, 0),
  975. 0.1, false)
  976. PropertyCFrameTween(Player.Character.Torso:FindFirstChild("Right Shoulder 2"), "C0",
  977. CFrame.new(0.9, 0.6, -0.6) * CFrame.fromEulerAnglesXYZ(math.rad(100), math.rad(-10), math.rad(-55)),
  978. 0.1, false)
  979.  
  980. local NewMagazine = nil
  981. if Player.Backpack.Ammo[AmmoType].Value - MagazineCapacity < 0 then
  982. NewMagazine = Player.Backpack.Ammo[AmmoType].Value
  983. Player.Backpack.Ammo[AmmoType].Value = 0
  984. else
  985. NewMagazine = script.Magazine.Value + MagazineCapacity
  986. Player.Backpack.Ammo[AmmoType].Value = Player.Backpack.Ammo[AmmoType].Value - MagazineCapacity
  987. end
  988. for _, Part in pairs(Player.Character[ModelName]:GetChildren()) do
  989. pcall(function()
  990. if Part.Weld.Part1.Name == "Magazine" then
  991. Part.Transparency = 0
  992. end
  993. end)
  994. end
  995. local i = 0
  996. for _, Part in pairs(Player.Character[ModelName]:GetChildren()) do
  997. if Part.Name == "Bullet" then
  998. i = i + 1
  999. if i > NewMagazine then
  1000. Part.Transparency = 1
  1001. end
  1002. end
  1003. end
  1004. wait()
  1005. UpdateFirstPerson(true)
  1006.  
  1007. SoundToServer("Fire", "http://www.roblox.com/Asset/?id=10209810", 2, 1, false, Player.Character[ModelName].Handle)
  1008. Player.Character[ModelName].Magazine.Weld.C1 = CFrame.new(0, 0.2, -1)
  1009. PropertyCFrameTween(Player.Character.Torso:FindFirstChild("Right Shoulder 2"), "C0",
  1010. CFrame.new(0.9, 0.4, -0.6) * CFrame.fromEulerAnglesXYZ(math.rad(70), math.rad(20), math.rad(-55)),
  1011. 0.07, true)
  1012. PropertyCFrameTween(Player.Character[ModelName].Magazine.Weld, "C1",
  1013. CFrame.new(),
  1014. 0.07, false)
  1015.  
  1016. script.Magazine.Value = NewMagazine
  1017.  
  1018. PropertyCFrameTween(Player.Character[ModelName].Bolt.Weld, "C1",
  1019. CFrame.new(),
  1020. 0.3, true)
  1021.  
  1022. Weld.C1 = Weld.Part0.CFrame:toObjectSpace(Player.Character["Right Arm"].CFrame):inverse()
  1023. Weld.Part1 = Player.Character["Right Arm"]
  1024. Weld.C0 = CFrame.new()
  1025.  
  1026. PropertyCFrameTween(Player.Character.Torso:FindFirstChild("Left Shoulder 2"), "C0",
  1027. CFrame.new(-1, 0.6, -0.5) * CFrame.fromEulerAnglesXYZ(math.rad(90), 0, math.rad(-10)),
  1028. 0.1, true)
  1029. PropertyCFrameTween(Player.Character.Torso:FindFirstChild("Right Shoulder 2"), "C0",
  1030. CFrame.new(1.1, 0.45, 0.1) * CFrame.fromEulerAnglesXYZ(math.rad(90), 0, math.rad(-50)),
  1031. 0.1, true)
  1032. PropertyCFrameTween(Player.Character.Torso:FindFirstChild("Neck"), "C0",
  1033. CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(40), 0),
  1034. 0.1, true)
  1035. PropertyCFrameTween(Weld, "C1",
  1036. CFrame.fromEulerAnglesXYZ(0, 0, math.rad(10)) * CFrame.new(-0.2, -1.5, -0.6),
  1037. 0.1, false)
  1038.  
  1039. for _, Part in pairs(Player.Character[ModelName]:GetChildren()) do
  1040. if Part.Name == "Bullet" and Part.Transparency == 0 then
  1041. Part.Transparency = 1
  1042. break
  1043. end
  1044. end
  1045.  
  1046. wait()
  1047. UpdateFirstPerson(true)
  1048. CanUse = true
  1049. end
  1050. end
  1051. end
  1052.  
  1053.  
  1054. function onSelected(Mouse)
  1055. if Selected == true then return end
  1056. CanUse = false
  1057. while true do
  1058. if CheckPlayer() == true then
  1059. if Player.Character.Torso:FindFirstChild("Right Shoulder") ~= nil and Player.Character.Torso:FindFirstChild("Left Shoulder") ~= nil then
  1060. break
  1061. end
  1062. end
  1063. wait(0.1)
  1064. end
  1065. Selected = true
  1066. DisableLimb(1, Player.Character)
  1067. SetSpeed(1, 0.5, Player.Character)
  1068. SetAngle(1, 0, Player.Character)
  1069. DisableLimb(2, Player.Character)
  1070. SetSpeed(2, 0.5, Player.Character)
  1071. SetAngle(2, 0, Player.Character)
  1072. wait(0.2)
  1073. Player.Character.Torso["Neck"].C0 = CFrame.new(0, 1, 0)
  1074. Player.Character.Torso["Neck"].C1 = CFrame.new(0, -0.5, 0)
  1075. Player.Character.Torso:FindFirstChild("Left Shoulder 2").C0 = CFrame.new(-1.5, 0.5, 0)
  1076. Player.Character.Torso:FindFirstChild("Left Shoulder 2").C1 = CFrame.new(0, 0.5, 0)
  1077. Player.Character.Torso:FindFirstChild("Right Shoulder 2").C0 = CFrame.new(1.5, 0.5, 0)
  1078. Player.Character.Torso:FindFirstChild("Right Shoulder 2").C1 = CFrame.new(0, 0.5, 0)
  1079. local AimGyroAdd = Instance.new("CFrameValue", Player.Character)
  1080. AimGyroAdd.Name = "AimGyroAdd"
  1081.  
  1082. PropertyCFrameTween(Player.Character.Torso:FindFirstChild("Left Shoulder 2"), "C0",
  1083. CFrame.new(-1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(math.rad(175), 0, 0),
  1084. 0.1, true)
  1085. PropertyCFrameTween(Player.Character.Torso:FindFirstChild("Right Shoulder 2"), "C0",
  1086. CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(math.rad(-20), 0, math.rad(-10)),
  1087. 0.1, true)
  1088. PropertyCFrameTween(AimGyroAdd, "Value",
  1089. CFrame.fromEulerAnglesXYZ(0, math.rad(20), 0),
  1090. 0.1, false)
  1091.  
  1092. local Weld = Player.Character[ModelName.. " (Holstered)"].Handle.Weld
  1093. Weld.C0 = Player.Character[ModelName.. " (Holstered)"].Handle.CFrame:toObjectSpace(Player.Character["Left Arm"].CFrame)
  1094. Weld.Part1 = Player.Character["Left Arm"]
  1095.  
  1096. PropertyCFrameTween(Player.Character.Torso:FindFirstChild("Left Shoulder 2"), "C0",
  1097. CFrame.new(-1, 0.6, -0.5) * CFrame.fromEulerAnglesXYZ(math.rad(90), 0, math.rad(-10)),
  1098. 0.1, true)
  1099. PropertyCFrameTween(Player.Character.Torso:FindFirstChild("Right Shoulder 2"), "C0",
  1100. CFrame.new(1.1, 0.45, 0.1) * CFrame.fromEulerAnglesXYZ(math.rad(90), 0, math.rad(-50)),
  1101. 0.1, true)
  1102. PropertyCFrameTween(Player.Character.Torso:FindFirstChild("Neck"), "C0",
  1103. CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(40), 0),
  1104. 0.1, true)
  1105. PropertyCFrameTween(AimGyroAdd, "Value",
  1106. CFrame.fromEulerAnglesXYZ(0, math.rad(-40), 0),
  1107. 0.1, true)
  1108. PropertyCFrameTween(Weld, "C0",
  1109. CFrame.fromEulerAnglesXYZ(0, 0, math.rad(30)) * CFrame.new(-0.7, 0, 0.4),
  1110. 0.1, false)
  1111.  
  1112. RemoveParts(Player.Character, 1)
  1113. CreateParts(Player.Character, 2)
  1114. Mouse.Icon = "rbxasset://textures\\GunCursor.png"
  1115. Mouse.Button1Down:connect(function() onButton1Down(Mouse) end)
  1116. Mouse.Button1Up:connect(function() onButton1Up(Mouse) end)
  1117. Mouse.KeyDown:connect(function(Key) onKeyDown(Key, Mouse) end)
  1118. CanUse = true
  1119. end
  1120.  
  1121.  
  1122. function onDeselected(Mouse)
  1123. if Selected == false then return end
  1124. Selected = false
  1125. while CanUse == false do wait() end
  1126. if CheckPlayer() == false or pcall(function() local _ = Player.Character.Torso:FindFirstChild("Right Shoulder 2") end) == false then
  1127. RemoveParts(Player.Character, 2)
  1128. CreateParts(Player.Character, 1)
  1129. SetAngle(1, 0, Player.Character)
  1130. ResetLimbCFrame(1, Player.Character)
  1131. EnableLimb(1, Player.Character)
  1132. SetAngle(2, 0, Player.Character)
  1133. ResetLimbCFrame(2, Player.Character)
  1134. EnableLimb(2, Player.Character)
  1135. return
  1136. end
  1137. if Selected == true then return end
  1138. CanUse = false
  1139. Player.Character.AimGyroAdd:Remove()
  1140.  
  1141. local Weld = Player.Character[ModelName].Handle.Weld
  1142. Weld.C0 = Player.Character[ModelName].Handle.CFrame:toObjectSpace(Player.Character["Left Arm"].CFrame)
  1143. Weld.Part1 = Player.Character["Left Arm"]
  1144.  
  1145. PropertyCFrameTween(Player.Character.Torso:FindFirstChild("Left Shoulder 2"), "C0",
  1146. CFrame.new(-1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(math.rad(-180), 0, 0),
  1147. 0.05, true)
  1148. PropertyCFrameTween(Player.Character.Torso:FindFirstChild("Right Shoulder 2"), "C0",
  1149. CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(math.rad(-20), 0, math.rad(-10)),
  1150. 0.05, true)
  1151. PropertyCFrameTween(Weld, "C1",
  1152. CFrame.new(),
  1153. 0.05, true)
  1154. PropertyCFrameTween(Weld, "C0",
  1155. CFrame.fromEulerAnglesXYZ(math.rad(180), math.rad(90), 0) * CFrame.new(-0.5, -1, 0.55),
  1156. 0.05, false)
  1157.  
  1158. RemoveParts(Player.Character, 2)
  1159. CreateParts(Player.Character, 1)
  1160.  
  1161. PropertyCFrameTween(Player.Character.Torso:FindFirstChild("Left Shoulder 2"), "C0",
  1162. CFrame.new(-1.5, 0.5, 0),
  1163. 0.1, true)
  1164. PropertyCFrameTween(Player.Character.Torso:FindFirstChild("Right Shoulder 2"), "C0",
  1165. CFrame.new(1.5, 0.5, 0),
  1166. 0.1, true)
  1167. PropertyCFrameTween(Player.Character.Torso:FindFirstChild("Neck"), "C0",
  1168. CFrame.new(0, 1, 0),
  1169. 0.1, true)
  1170. PropertyCFrameTween(Weld, "C0",
  1171. CFrame.fromEulerAnglesXYZ(0, 0, math.rad(30)) * CFrame.new(-0.7, 0, 0.4),
  1172. 0.1, false)
  1173.  
  1174. Player.Character.Torso["Neck"].C0 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(math.rad(-90), 0, math.rad(180))
  1175. Player.Character.Torso["Neck"].C1 = CFrame.new(0, -0.5, 0) * CFrame.fromEulerAnglesXYZ(math.rad(-90), 0, math.rad(180))
  1176. SetAngle(1, 0, Player.Character)
  1177. ResetLimbCFrame(1, Player.Character)
  1178. EnableLimb(1, Player.Character)
  1179. SetAngle(2, 0, Player.Character)
  1180. ResetLimbCFrame(2, Player.Character)
  1181. EnableLimb(2, Player.Character)
  1182. CanUse = true
  1183. end
  1184.  
  1185.  
  1186. if script.Parent.ClassName ~= "HopperBin" then
  1187. if Player == nil then print("Error: Player not found!") return end
  1188. Tool = Instance.new("HopperBin")
  1189. Tool.Name = ModelName
  1190. Tool.Parent = Player.Backpack
  1191. Instance.new("IntValue", script).Name = "Magazine"
  1192. Instance.new("BoolValue", script).Name = "MagazineIn"
  1193. script.Name = "Main"
  1194. script.Parent = Tool
  1195. elseif script.Parent.ClassName == "HopperBin" and Connected == false then
  1196. Connected = true
  1197. Player = script.Parent.Parent.Parent
  1198. if Player.Backpack:FindFirstChild("Ammo") == nil then
  1199. Instance.new("Configuration", Player.Backpack).Name = "Ammo"
  1200. end
  1201. if Player.Backpack.Ammo:FindFirstChild(AmmoType) == nil then
  1202. Instance.new("IntValue", Player.Backpack.Ammo).Name = AmmoType
  1203. Player.Backpack.Ammo[AmmoType].Value = MagazineCapacity * 2
  1204. end
  1205. script.Parent.Selected:connect(onSelected)
  1206. script.Parent.Deselected:connect(onDeselected)
  1207. CreateParts(Player.Character, 1)
  1208. coroutine.wrap(loadstring(FirstPerson))()
  1209. coroutine.wrap(loadstring(MouseAim))()
  1210. coroutine.wrap(loadstring(AmmoCounter))()
  1211. end
Advertisement
Add Comment
Please, Sign In to add comment