Advertisement
D0MiN0_FX

Vinya VSS Vintorez

Nov 26th, 2016
264
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 55.13 KB | None | 0 0
  1. --[[
  2. Script shared by eletronix ]]
  3.  
  4. if script == nil then return end
  5.  
  6.  
  7. Player = Game.Players.LocalPlayer
  8. Char = Player.Character
  9. Anims = Char:FindFirstChild("Animate")
  10. Anims:remove()
  11. Name = "VSS Vintorez"
  12. selected = false
  13. canDual = false
  14. dual = false
  15. Button1Down = false
  16. damage = 50
  17. canFire = true
  18. canFire2 = false
  19. readyTime = 0.2
  20. automatic = false
  21. burst = false
  22. burstCount = 0
  23. burstCountMax = 3
  24. canSilence = false
  25. silenced = false
  26. canZoom = true
  27. zoom = false
  28. switchToSingle = true
  29. switchToBurst = false
  30. switchToAutomatic = true
  31.  
  32.  
  33. ammoGui = Instance.new("ScreenGui")
  34. ammoGui.Name = Name
  35. local frame = Instance.new("Frame")
  36. frame.Name = "Frame"
  37. frame.Size = UDim2.new(0, 165, 0, 60)
  38. frame.Position = UDim2.new(0, 0, 1, -60)
  39. frame.BackgroundColor3 = Color3.new(1, 1, 1)
  40. frame.BorderColor3 = Color3.new(0, 0, 0)
  41. frame.Parent = ammoGui
  42. local label = Instance.new("TextLabel")
  43. label.Name = "Weapon"
  44. label.Text = "Weapon: " ..Name
  45. label.Size = UDim2.new(1, 0, 0, 20)
  46. label.Position = UDim2.new(0, 0, 0, 0)
  47. label.BackgroundColor3 = Color3.new(1, 0, 0)
  48. label.BorderColor3 = Color3.new(0, 0, 0)
  49. label.Parent = frame
  50. local label = Instance.new("TextLabel")
  51. label.Name = "MagazinePrefix"
  52. label.Text = " Magazine:"
  53. label.TextXAlignment = "Left"
  54. label.Size = UDim2.new(1, 0, 0, 20)
  55. label.Position = UDim2.new(0, 0, 0, 20)
  56. label.BackgroundColor3 = Color3.new(1, 1, 1)
  57. label.BorderColor3 = Color3.new(0, 0, 0)
  58. label.Parent = frame
  59. local label = Instance.new("TextLabel")
  60. label.Name = "Magazine"
  61. label.Text = "0/0"
  62. label.TextXAlignment = "Right"
  63. label.Size = UDim2.new(1, 0, 0, 20)
  64. label.Position = UDim2.new(0, -10, 0, 20)
  65. label.BackgroundTransparency = 1
  66. label.BorderSizePixel = 0
  67. label.Parent = frame
  68. local label = Instance.new("TextLabel")
  69. label.Name = "AmmoPrefix"
  70. label.Text = " Ammunition:"
  71. label.TextXAlignment = "Left"
  72. label.Size = UDim2.new(1, 0, 0, 20)
  73. label.Position = UDim2.new(0, 0, 0, 40)
  74. label.BackgroundColor3 = Color3.new(1, 1, 1)
  75. label.BorderColor3 = Color3.new(0, 0, 0)
  76. label.Parent = frame
  77. local label = Instance.new("TextLabel")
  78. label.Name = "Ammo"
  79. label.Text = "0/0"
  80. label.TextXAlignment = "Right"
  81. label.Size = UDim2.new(1, 0, 0, 20)
  82. label.Position = UDim2.new(0, -10, 0, 40)
  83. label.BackgroundTransparency = 1
  84. label.BorderSizePixel = 0
  85. label.Parent = frame
  86.  
  87.  
  88. function updateGui()
  89. if selected == false then return end
  90. if Player:FindFirstChild("PlayerGui") == nil then Instance.new("PlayerGui").Parent = Player end
  91. if Player.PlayerGui:FindFirstChild(Name) == nil then
  92. ammoGui:Clone().Parent = Player.PlayerGui
  93. end
  94. Player.PlayerGui[Name].Frame.Magazine.Text = tostring(magazine.Value).. "/" ..tostring(magazineMax.Value)
  95. Player.PlayerGui[Name].Frame.Ammo.Text = tostring(ammo.Value).. "/" ..tostring(ammoMax.Value)
  96. end
  97.  
  98.  
  99.  
  100. function makeParts(format)
  101. local model = Instance.new("Model")
  102. model.Name = Name
  103. local pm = Instance.new("Part")
  104. pm.Name = "Handle"
  105. pm.FormFactor = "Custom"
  106. pm.Size = Vector3.new(1, 1, 1)
  107. pm.BrickColor = BrickColor.new("Black")
  108. pm.Locked = true
  109. pm.TopSurface = 0
  110. pm.BottomSurface = 0
  111. pm.Parent = model
  112. local m = Instance.new("SpecialMesh")
  113. m.MeshType = "Brick"
  114. m.Scale = Vector3.new(0.3, 0.75, 0.4)
  115. m.Parent = pm
  116. if format ~= nil then
  117. local w = Instance.new("Weld")
  118. w.Part0 = pm
  119. if format == "RightHand" then
  120. w.Part1 = Player.Character:FindFirstChild("Right Arm")
  121. w.C0 = CFrame.new(0, 1.4, 0.5)
  122. w.C1 = CFrame.new()
  123. elseif format == "RightHolster" then
  124. w.Part1 = Player.Character:FindFirstChild("Torso")
  125. w.C0 = CFrame.new(0.65, -0.7, 0.9) * CFrame.fromEulerAnglesXYZ(math.rad(5), math.rad(-90), 0)
  126. w.C1 = CFrame.new()
  127. model.Name = Name.. " (Holstered)"
  128. end
  129. w.Parent = pm
  130. model.Parent = Player.Character
  131. end
  132. --[[
  133. sniper1 http://www.roblox.com/Asset/?id=1868836
  134. equip http://www.roblox.com/Asset/?id=13510737
  135. fire1 http://www.roblox.com/Asset/?id=2760979
  136. fire2 http://www.roblox.com/Asset/?id=13510352
  137. fire3 http://www.roblox.com/Asset/?id=2692806
  138. fire4 http://www.roblox.com/Asset/?id=2691586
  139. fire5 http://www.roblox.com/Asset/?id=2920959
  140. fire6 http://www.roblox.com/Asset/?id=2697431
  141. fire7 http://www.roblox.com/Asset/?id=2920959
  142. reload1 http://www.roblox.com/Asset/?id=2691591
  143. reload2 http://www.roblox.com/Asset/?id=2697432
  144. reload3 http://www.roblox.com/Asset/?id=2920960
  145. reload4 http://www.roblox.com/Asset/?id=2761842
  146. shotgun1 http://www.roblox.com/Asset/?id=2697294
  147. --]]
  148. local s = Instance.new("Sound")
  149. s.Name = "Equip"
  150. s.SoundId = "http://www.roblox.com/Asset/?id=10209881"
  151. s.Volume = 1
  152. s.Pitch = 1
  153. s.Looped = false
  154. s.Parent = pm
  155. local s = Instance.new("Sound")
  156. s.Name = "Fire"
  157. s.SoundId = "http://www.roblox.com/Asset/?id=10209875"
  158. s.Volume = 1
  159. s.Pitch = 1
  160. s.Looped = false
  161. s.Parent = pm
  162. local s = Instance.new("Sound")
  163. s.Name = "Reload"
  164. s.SoundId = "http://www.roblox.com/Asset/?id=2691591"
  165. s.Volume = 1
  166. s.Pitch = 1.25
  167. s.Looped = false
  168. s.Parent = pm
  169. local s = Instance.new("Sound")
  170. s.Name = "Empty"
  171. s.SoundId = "http://www.roblox.com/Asset/?id=2697295"
  172. s.Volume = 1
  173. s.Pitch = 5
  174. s.Looped = false
  175. s.Parent = pm
  176. local s = Instance.new("Sound")
  177. s.Name = "Switch"
  178. s.SoundId = "http://www.roblox.com/Asset/?id=2697295"
  179. s.Volume = 1
  180. s.Pitch = 10
  181. s.Looped = false
  182. s.Parent = pm
  183. local p = Instance.new("Part")
  184. p.Name = "ShellOut"
  185. p.FormFactor = "Custom"
  186. p.Size = Vector3.new(1, 1, 1)
  187. p.Transparency = 1
  188. p.Locked = true
  189. p.CanCollide = false
  190. p.TopSurface = 0
  191. p.BottomSurface = 0
  192. p.Parent = model
  193. local w = Instance.new("Weld")
  194. w.Part0 = p
  195. w.Part1 = pm
  196. w.C0 = CFrame.new(0, 0, 1) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  197. w.C1 = CFrame.new()
  198. w.Parent = p
  199. local p = Instance.new("Part")
  200. p.Name = "Grip"
  201. p.FormFactor = "Custom"
  202. p.Size = Vector3.new(1, 1, 1)
  203. p.BrickColor = BrickColor.new("Reddish brown")
  204. p.Material = "Wood"
  205. p.Locked = true
  206. p.TopSurface = 0
  207. p.BottomSurface = 0
  208. p.Parent = model
  209. local m = Instance.new("SpecialMesh")
  210. m.MeshType = "Brick"
  211. m.Scale = Vector3.new(0.29, 0.35, 0.9)
  212. m.Parent = p
  213. local w = Instance.new("Weld")
  214. w.Part0 = p
  215. w.Part1 = pm
  216. w.C0 = CFrame.new(0, -0.25, -0.6) * CFrame.fromEulerAnglesXYZ(math.rad(15), 0, 0)
  217. w.C1 = CFrame.new()
  218. w.Parent = p
  219. local p = Instance.new("Part")
  220. p.Name = "Scope Base"
  221. p.FormFactor = "Custom"
  222. p.Size = Vector3.new(1, 1, 1)
  223. p.BrickColor = BrickColor.new("Black")
  224. p.Locked = true
  225. p.TopSurface = 0
  226. p.BottomSurface = 0
  227. p.Parent = model
  228. local m = Instance.new("SpecialMesh")
  229. m.MeshType = "Brick"
  230. m.Scale = Vector3.new(0.1, 0.3, 0.1)
  231. m.Parent = p
  232. local w = Instance.new("Weld")
  233. w.Part0 = p
  234. w.Part1 = pm
  235. w.C0 = CFrame.new(0, 0, 0.25)
  236. w.C1 = CFrame.new()
  237. w.Parent = p
  238. local p = Instance.new("Part")
  239. p.Name = "Scope End 1"
  240. p.FormFactor = "Custom"
  241. p.Size = Vector3.new(1, 1, 1)
  242. p.BrickColor = BrickColor.new("Black")
  243. p.Locked = true
  244. p.TopSurface = 0
  245. p.BottomSurface = 0
  246. p.Parent = model
  247. local m = Instance.new("CylinderMesh")
  248. m.Scale = Vector3.new(0.275, 0.375, 0.275)
  249. m.Parent = p
  250. local w = Instance.new("Weld")
  251. w.Part0 = p
  252. w.Part1 = pm
  253. w.C0 = CFrame.new(0, -0.4, 0.375)
  254. w.C1 = CFrame.new()
  255. w.Parent = p
  256. local p = Instance.new("Part")
  257. p.Name = "Scope End 2"
  258. p.FormFactor = "Custom"
  259. p.Size = Vector3.new(1, 1, 1)
  260. p.BrickColor = BrickColor.new("Institutional white")
  261. p.Locked = true
  262. p.TopSurface = 0
  263. p.BottomSurface = 0
  264. p.Parent = model
  265. local m = Instance.new("CylinderMesh")
  266. m.Scale = Vector3.new(0.275, 0.025, 0.275)
  267. m.Parent = p
  268. local w = Instance.new("Weld")
  269. w.Part0 = p
  270. w.Part1 = pm
  271. w.C0 = CFrame.new(0, -0.6, 0.375)
  272. w.C1 = CFrame.new()
  273. w.Parent = p
  274. local p = Instance.new("Part")
  275. p.Name = "Scope Center 1"
  276. p.FormFactor = "Custom"
  277. p.Size = Vector3.new(1, 1, 1)
  278. p.BrickColor = BrickColor.new("Black")
  279. p.Locked = true
  280. p.TopSurface = 0
  281. p.BottomSurface = 0
  282. p.Parent = model
  283. local m = Instance.new("CylinderMesh")
  284. m.Scale = Vector3.new(0.15, 0.425, 0.15)
  285. m.Parent = p
  286. local w = Instance.new("Weld")
  287. w.Part0 = p
  288. w.Part1 = pm
  289. w.C0 = CFrame.new(0, 0, 0.375)
  290. w.C1 = CFrame.new()
  291. w.Parent = p
  292. local p = Instance.new("Part")
  293. p.Name = "Scope Front 1"
  294. p.FormFactor = "Custom"
  295. p.Size = Vector3.new(1, 1, 1)
  296. p.BrickColor = BrickColor.new("Black")
  297. p.Locked = true
  298. p.TopSurface = 0
  299. p.BottomSurface = 0
  300. p.Parent = model
  301. local m = Instance.new("CylinderMesh")
  302. m.Scale = Vector3.new(0.2, 0.75, 0.2)
  303. m.Parent = p
  304. local w = Instance.new("Weld")
  305. w.Part0 = p
  306. w.Part1 = pm
  307. w.C0 = CFrame.new(0, 0.575, 0.375)
  308. w.C1 = CFrame.new()
  309. w.Parent = p
  310. local p = Instance.new("Part")
  311. p.Name = "Scope Front 2"
  312. p.FormFactor = "Custom"
  313. p.Size = Vector3.new(1, 1, 1)
  314. p.BrickColor = BrickColor.new("Institutional white")
  315. p.Locked = true
  316. p.TopSurface = 0
  317. p.BottomSurface = 0
  318. p.Parent = model
  319. local m = Instance.new("CylinderMesh")
  320. m.Scale = Vector3.new(0.2, 0.01, 0.2)
  321. m.Parent = p
  322. local w = Instance.new("Weld")
  323. w.Part0 = p
  324. w.Part1 = pm
  325. w.C0 = CFrame.new(0, 0.95, 0.375)
  326. w.C1 = CFrame.new()
  327. w.Parent = p
  328. local p = Instance.new("Part")
  329. p.Name = "Magazine Housing / Grip"
  330. p.FormFactor = "Custom"
  331. p.Size = Vector3.new(1, 1, 1)
  332. p.BrickColor = BrickColor.new("Black")
  333. p.Locked = true
  334. p.TopSurface = 0
  335. p.BottomSurface = 0
  336. p.Parent = model
  337. local m = Instance.new("SpecialMesh")
  338. m.MeshType = "Brick"
  339. m.Scale = Vector3.new(0.3, 1, 0.3)
  340. m.Parent = p
  341. local w = Instance.new("Weld")
  342. w.Part0 = p
  343. w.Part1 = pm
  344. w.C0 = CFrame.new(0, 0.7, -0.32) * CFrame.fromEulerAnglesXYZ(math.rad(-12.5), 0, 0)
  345. w.C1 = CFrame.new()
  346. w.Parent = p
  347. local p = Instance.new("Part")
  348. p.Name = "Magazine"
  349. p.FormFactor = "Custom"
  350. p.Size = Vector3.new(1, 1, 1)
  351. p.BrickColor = BrickColor.new("Black")
  352. p.Locked = true
  353. p.TopSurface = 0
  354. p.BottomSurface = 0
  355. p.Parent = model
  356. local m = Instance.new("SpecialMesh")
  357. m.MeshType = "Brick"
  358. m.Scale = Vector3.new(0.25, 0.4, 0.6)
  359. m.Parent = p
  360. local w = Instance.new("Weld")
  361. w.Part0 = p
  362. w.Part1 = pm
  363. w.C0 = CFrame.new(0, 0.5, -0.6) * CFrame.fromEulerAnglesXYZ(math.rad(-7.5), 0, 0)
  364. w.C1 = CFrame.new()
  365. w.Parent = p
  366. local p = Instance.new("Part")
  367. p.Name = "Trigger Housing 1"
  368. p.FormFactor = "Custom"
  369. p.Size = Vector3.new(1, 1, 1)
  370. p.BrickColor = BrickColor.new("Black")
  371. p.Locked = true
  372. p.TopSurface = 0
  373. p.BottomSurface = 0
  374. p.Parent = model
  375. local m = Instance.new("SpecialMesh")
  376. m.MeshType = "Brick"
  377. m.Scale = Vector3.new(0.1, 0.5, 0.025)
  378. m.Parent = p
  379. local w = Instance.new("Weld")
  380. w.Part0 = p
  381. w.Part1 = pm
  382. w.C0 = CFrame.new(0, 0.075, -0.4)
  383. w.C1 = CFrame.new()
  384. w.Parent = p
  385. local p = Instance.new("Part")
  386. p.Name = "Trigger Housing 2"
  387. p.FormFactor = "Custom"
  388. p.Size = Vector3.new(1, 1, 1)
  389. p.BrickColor = BrickColor.new("Black")
  390. p.Locked = true
  391. p.TopSurface = 0
  392. p.BottomSurface = 0
  393. p.Parent = model
  394. local m = Instance.new("SpecialMesh")
  395. m.MeshType = "Brick"
  396. m.Scale = Vector3.new(0.295, 0.1, 0.38)
  397. m.Parent = p
  398. local w = Instance.new("Weld")
  399. w.Part0 = p
  400. w.Part1 = pm
  401. w.C0 = CFrame.new(0, -0.15, -0.225)
  402. w.C1 = CFrame.new()
  403. w.Parent = p
  404. local p = Instance.new("Part")
  405. p.Name = "Trigger"
  406. p.FormFactor = "Custom"
  407. p.Size = Vector3.new(1, 1, 1)
  408. p.BrickColor = BrickColor.new("Black")
  409. p.Locked = true
  410. p.TopSurface = 0
  411. p.BottomSurface = 0
  412. p.Parent = model
  413. local m = Instance.new("SpecialMesh")
  414. m.MeshType = "Brick"
  415. m.Scale = Vector3.new(0.1, 0.05, 0.15)
  416. m.Parent = p
  417. local w = Instance.new("Weld")
  418. w.Part0 = p
  419. w.Part1 = pm
  420. w.C0 = CFrame.new(0, 0.03, -0.275)
  421. w.C1 = CFrame.new()
  422. w.Parent = p
  423. local p = Instance.new("Part")
  424. p.Name = "Barrel 1"
  425. p.CanCollide = false
  426. p.FormFactor = "Custom"
  427. p.Size = Vector3.new(1, 1, 1)
  428. p.BrickColor = BrickColor.new("Black")
  429. p.Locked = true
  430. p.TopSurface = 0
  431. p.BottomSurface = 0
  432. p.Parent = model
  433. local m = Instance.new("SpecialMesh")
  434. m.MeshType = "Brick"
  435. m.Scale = Vector3.new(0.3, 0.925, 0.4)
  436. m.Parent = p
  437. local w = Instance.new("Weld")
  438. w.Part0 = p
  439. w.Part1 = pm
  440. w.C0 = CFrame.new(0, 0.825, 0)
  441. w.C1 = CFrame.new()
  442. w.Parent = p
  443. local p = Instance.new("Part")
  444. p.Name = "Barrel 2"
  445. p.FormFactor = "Custom"
  446. p.Size = Vector3.new(1, 1, 1)
  447. p.BrickColor = BrickColor.new("Black")
  448. p.CanCollide = false
  449. p.Locked = true
  450. p.TopSurface = 0
  451. p.BottomSurface = 0
  452. p.Parent = model
  453. local m = Instance.new("CylinderMesh")
  454. m.Scale = Vector3.new(0.275, 2, 0.275)
  455. m.Parent = p
  456. local w = Instance.new("Weld")
  457. w.Part0 = p
  458. w.Part1 = pm
  459. w.C0 = CFrame.new(0, 2.25, 0)
  460. w.C1 = CFrame.new()
  461. w.Parent = p
  462. local p = Instance.new("Part")
  463. p.Name = "Barrel Sight 1"
  464. p.FormFactor = "Custom"
  465. p.Size = Vector3.new(1, 1, 1)
  466. p.BrickColor = BrickColor.new("Black")
  467. p.CanCollide = false
  468. p.Locked = true
  469. p.TopSurface = 0
  470. p.BottomSurface = 0
  471. p.Parent = model
  472. local m = Instance.new("SpecialMesh")
  473. m.MeshType = "Brick"
  474. m.Scale = Vector3.new(0.1, 0.3, 0.175)
  475. m.Parent = p
  476. local w = Instance.new("Weld")
  477. w.Part0 = p
  478. w.Part1 = pm
  479. w.C0 = CFrame.new(0, 1.4, 0.1)
  480. w.C1 = CFrame.new()
  481. w.Parent = p
  482. local p = Instance.new("Part")
  483. p.Name = "Barrel Sight 2"
  484. p.FormFactor = "Custom"
  485. p.Size = Vector3.new(1, 1, 1)
  486. p.BrickColor = BrickColor.new("Black")
  487. p.CanCollide = false
  488. p.Locked = true
  489. p.TopSurface = 0
  490. p.BottomSurface = 0
  491. p.Parent = model
  492. local m = Instance.new("SpecialMesh")
  493. m.MeshType = "Brick"
  494. m.Scale = Vector3.new(0.1, 0.1, 0.2)
  495. m.Parent = p
  496. local w = Instance.new("Weld")
  497. w.Part0 = p
  498. w.Part1 = pm
  499. w.C0 = CFrame.new(0, 3.2, 0.1)
  500. w.C1 = CFrame.new()
  501. w.Parent = p
  502. local p = Instance.new("Part")
  503. p.Name = "Muzzle"
  504. p.FormFactor = "Custom"
  505. p.Size = Vector3.new(1, 1, 1)
  506. p.Transparency = 1
  507. p.CanCollide = false
  508. p.Locked = true
  509. p.Parent = model
  510. local w = Instance.new("Weld")
  511. w.Part0 = p
  512. w.Part1 = pm
  513. w.C0 = CFrame.new(0, 3.25, 0)
  514. w.C1 = CFrame.new()
  515. w.Parent = p
  516. local p = Instance.new("Part")
  517. p.Name = "Stock 1"
  518. p.CanCollide = false
  519. p.FormFactor = "Custom"
  520. p.Size = Vector3.new(1, 1, 1)
  521. p.BrickColor = BrickColor.new("Reddish brown")
  522. p.Material = "Wood"
  523. p.Locked = true
  524. p.TopSurface = 0
  525. p.BottomSurface = 0
  526. p.Parent = model
  527. local m = Instance.new("SpecialMesh")
  528. m.MeshType = "Brick"
  529. m.Scale = Vector3.new(0.3, 1.6, 0.125)
  530. m.Parent = p
  531. local w = Instance.new("Weld")
  532. w.Part0 = p
  533. w.Part1 = pm
  534. w.C0 = CFrame.new(0, -1.125, -0.93)
  535. w.C1 = CFrame.new()
  536. w.Parent = p
  537. local p = Instance.new("Part")
  538. p.Name = "Stock 2"
  539. p.CanCollide = false
  540. p.FormFactor = "Custom"
  541. p.Size = Vector3.new(1, 1, 1)
  542. p.BrickColor = BrickColor.new("Reddish brown")
  543. p.Material = "Wood"
  544. p.Locked = true
  545. p.TopSurface = 0
  546. p.BottomSurface = 0
  547. p.Parent = model
  548. local m = Instance.new("SpecialMesh")
  549. m.MeshType = "Brick"
  550. m.Scale = Vector3.new(0.301, 1.6, 0.175)
  551. m.Parent = p
  552. local w = Instance.new("Weld")
  553. w.Part0 = p
  554. w.Part1 = pm
  555. w.C0 = CFrame.new(0, -1.125, -0.1125)
  556. w.C1 = CFrame.new()
  557. w.Parent = p
  558. local p = Instance.new("Part")
  559. p.Name = "Stock 3"
  560. p.CanCollide = false
  561. p.FormFactor = "Custom"
  562. p.Size = Vector3.new(1, 1, 1)
  563. p.BrickColor = BrickColor.new("Reddish brown")
  564. p.Material = "Wood"
  565. p.Locked = true
  566. p.TopSurface = 0
  567. p.BottomSurface = 0
  568. p.Parent = model
  569. local m = Instance.new("SpecialMesh")
  570. m.MeshType = "Brick"
  571. m.Scale = Vector3.new(0.3, 0.2, 0.668)
  572. m.Parent = p
  573. local w = Instance.new("Weld")
  574. w.Part0 = p
  575. w.Part1 = pm
  576. w.C0 = CFrame.new(0, -1.825, -0.5335)
  577. w.C1 = CFrame.new()
  578. w.Parent = p
  579. local p = Instance.new("Part")
  580. p.Name = "Stock 4"
  581. p.CanCollide = false
  582. p.FormFactor = "Custom"
  583. p.Size = Vector3.new(1, 1, 1)
  584. p.BrickColor = BrickColor.new("Reddish brown")
  585. p.Material = "Wood"
  586. p.Locked = true
  587. p.TopSurface = 0
  588. p.BottomSurface = 0
  589. p.Parent = model
  590. local m = Instance.new("SpecialMesh")
  591. m.MeshType = "Brick"
  592. m.Scale = Vector3.new(0.2, 0.2, 0.8)
  593. m.Parent = p
  594. local w = Instance.new("Weld")
  595. w.Part0 = p
  596. w.Part1 = pm
  597. w.C0 = CFrame.new(0, -1.1, -0.735) * CFrame.fromEulerAnglesXYZ(math.rad(10), 0, 0)
  598. w.C1 = CFrame.new()
  599. w.Parent = p
  600. return model
  601. end
  602.  
  603.  
  604. function removeParts(format)
  605. if format == "RightHand" then
  606. pcall(function() Player.Character[Name]:Remove() end)
  607. elseif format == "LeftHand" then
  608. pcall(function() Player.Character[Name.. " (Left)"]:Remove() end)
  609. elseif format == "RightHolster" then
  610. pcall(function() Player.Character[Name.. " (Holstered)"]:Remove() end)
  611. elseif format == "LeftHolster" then
  612. pcall(function() Player.Character[Name.. " (Holstered, Left)"]:Remove() end)
  613. end
  614. end
  615.  
  616.  
  617. function SetAngle(Joint, Angle, Character)
  618. if Character == nil then return false end
  619. local Joints = {
  620. Character.Torso:FindFirstChild("Right Shoulder 2"),
  621. Character.Torso:FindFirstChild("Left Shoulder 2"),
  622. Character.Torso:FindFirstChild("Right Hip 2"),
  623. Character.Torso:FindFirstChild("Left Hip 2")
  624. }
  625. if Joints[Joint] == nil then return false end
  626. if Joint == 1 or Joint == 3 then
  627. Joints[Joint].DesiredAngle = Angle
  628. end
  629. if Joint == 2 or Joint == 4 then
  630. Joints[Joint].DesiredAngle = -Angle
  631. end
  632. end
  633.  
  634.  
  635. function ForceAngle(Joint, Angle, Character)
  636. if Character == nil then return false end
  637. local Joints = {
  638. Character.Torso:FindFirstChild("Right Shoulder 2"),
  639. Character.Torso:FindFirstChild("Left Shoulder 2"),
  640. Character.Torso:FindFirstChild("Right Hip 2"),
  641. Character.Torso:FindFirstChild("Left Hip 2")
  642. }
  643. if Joints[Joint] == nil then return false end
  644. if Joint == 1 or Joint == 3 then
  645. Joints[Joint].DesiredAngle = Angle
  646. Joints[Joint].CurrentAngle = Angle
  647. end
  648. if Joint == 2 or Joint == 4 then
  649. Joints[Joint].DesiredAngle = -Angle
  650. Joints[Joint].CurrentAngle = -Angle
  651. end
  652. end
  653.  
  654.  
  655. function SetSpeed(Joint, Speed, Character)
  656. if Character == nil then return false end
  657. local Joints = {
  658. Character.Torso:FindFirstChild("Right Shoulder 2"),
  659. Character.Torso:FindFirstChild("Left Shoulder 2"),
  660. Character.Torso:FindFirstChild("Right Hip 2"),
  661. Character.Torso:FindFirstChild("Left Hip 2")
  662. }
  663. if Joints[Joint] == nil then return false end
  664. Joints[Joint].MaxVelocity = Speed
  665. end
  666.  
  667.  
  668. function DisableLimb(Limb, Character)
  669. if Character == nil then return false end
  670. if Character:FindFirstChild("Torso") == nil then return false end
  671. local Joints = {
  672. Character.Torso:FindFirstChild("Right Shoulder"),
  673. Character.Torso:FindFirstChild("Left Shoulder"),
  674. Character.Torso:FindFirstChild("Right Hip"),
  675. Character.Torso:FindFirstChild("Left Hip")
  676. }
  677. local Limbs = {
  678. Character:FindFirstChild("Right Arm"),
  679. Character:FindFirstChild("Left Arm"),
  680. Character:FindFirstChild("Right Leg"),
  681. Character:FindFirstChild("Left Leg")
  682. }
  683. if Joints[Limb] == nil then return false end
  684. if Limbs[Limb] == nil then return false end
  685. local Joint = Instance.new("Motor")
  686. Joint.Parent = Character.Torso
  687. Joint.Part0 = Character.Torso
  688. Joint.Part1 = Limbs[Limb]
  689. if Limb == 1 then
  690. Joint.C0 = CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  691. Joint.C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  692. Joint.Name = "Right Shoulder 2"
  693. elseif Limb == 2 then
  694. Joint.C0 = CFrame.new(-1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  695. Joint.C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  696. Joint.Name = "Left Shoulder 2"
  697. elseif Limb == 3 then
  698. Joint.C0 = CFrame.new(0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  699. Joint.C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  700. Joint.Name = "Right Hip 2"
  701. elseif Limb == 4 then
  702. Joint.C0 = CFrame.new(-0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  703. Joint.C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  704. Joint.Name = "Left Hip 2"
  705. end
  706. Joint.MaxVelocity = Joints[Limb].MaxVelocity
  707. Joint.CurrentAngle = Joints[Limb].CurrentAngle
  708. Joint.DesiredAngle = Joints[Limb].DesiredAngle
  709. Joints[Limb]:Remove()
  710. end
  711.  
  712.  
  713. function ResetLimbCFrame(Limb, Character)
  714. if Character == nil then return false end
  715. if Character.Parent == nil then return false end
  716. if Character:FindFirstChild("Torso") == nil then return false end
  717. local Joints = {
  718. Character.Torso:FindFirstChild("Right Shoulder 2"),
  719. Character.Torso:FindFirstChild("Left Shoulder 2"),
  720. Character.Torso:FindFirstChild("Right Hip 2"),
  721. Character.Torso:FindFirstChild("Left Hip 2")
  722. }
  723. local Limbs = {
  724. Character:FindFirstChild("Right Arm"),
  725. Character:FindFirstChild("Left Arm"),
  726. Character:FindFirstChild("Right Leg"),
  727. Character:FindFirstChild("Left Leg")
  728. }
  729. if Joints[Limb] == nil then return false end
  730. if Limbs[Limb] == nil then return false end
  731. if Limb == 1 then
  732. Joints[Limb].C0 = CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  733. Joints[Limb].C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  734. elseif Limb == 2 then
  735. Joints[Limb].C0 = CFrame.new(-1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  736. Joints[Limb].C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  737. elseif Limb == 3 then
  738. Joints[Limb].C0 = CFrame.new(0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  739. Joints[Limb].C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  740. elseif Limb == 4 then
  741. Joints[Limb].C0 = CFrame.new(-0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  742. Joints[Limb].C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  743. end
  744. end
  745.  
  746.  
  747. function EnableLimb(Limb, Character)
  748. if Character == nil then return false end
  749. if Character:FindFirstChild("Torso") == nil then return false end
  750. local Joints = {
  751. Character.Torso:FindFirstChild("Right Shoulder 2"),
  752. Character.Torso:FindFirstChild("Left Shoulder 2"),
  753. Character.Torso:FindFirstChild("Right Hip 2"),
  754. Character.Torso:FindFirstChild("Left Hip 2")
  755. }
  756. local Limbs = {
  757. Character:FindFirstChild("Right Arm"),
  758. Character:FindFirstChild("Left Arm"),
  759. Character:FindFirstChild("Right Leg"),
  760. Character:FindFirstChild("Left Leg")
  761. }
  762. if Joints[Limb] == nil then return false end
  763. if Limbs[Limb] == nil then return false end
  764. if Limb == 1 then
  765. Joints[Limb].Name = "Right Shoulder"
  766. elseif Limb == 2 then
  767. Joints[Limb].Name = "Left Shoulder"
  768. elseif Limb == 3 then
  769. Joints[Limb].Name = "Right Hip"
  770. elseif Limb == 4 then
  771. Joints[Limb].Name = "Left Hip"
  772. end
  773. Animate = Character:FindFirstChild("Animate")
  774. if Animate == nil then return false end
  775. Animate = Animate:Clone()
  776. Character.Animate:Remove()
  777. Animate.Parent = Character
  778. end
  779.  
  780.  
  781. function playAnimation(format, mouse)
  782. if format == "equip" then
  783. EnableLimb(1, Player.Character)
  784. EnableLimb(2, Player.Character)
  785. DisableLimb(2, Player.Character)
  786. SetSpeed(2, 0.1, Player.Character)
  787. ForceAngle(2, 0, Player.Character)
  788. SetAngle(2, math.rad(-50), Player.Character)
  789. wait(0.25)
  790. if Player.Character:FindFirstChild(Name.. " (Holstered)") == nil then makeParts("RightHolster") end
  791. Player.Character[Name.. " (Holstered)"].Handle.Weld:Remove()
  792. local w = Instance.new("Weld")
  793. w.Part0 = Player.Character[Name.. " (Holstered)"].Handle
  794. w.Part1 = Player.Character:FindFirstChild("Left Arm")
  795. w.C0 = CFrame.new(0.5, -0.25, -0.75) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  796. w.C1 = CFrame.new() * CFrame.fromEulerAnglesXYZ(math.rad(50), 0, 0)
  797. w.Parent = Player.Character[Name.. " (Holstered)"].Handle
  798. SetAngle(2, 0, Player.Character)
  799. wait(0.25)
  800. DisableLimb(1, Player.Character)
  801. ForceAngle(1, 0, Player.Character)
  802. delay(0.3, function() Player.Character[Name.. " (Holstered)"].Handle.Equip:Play() end)
  803. for i = 0, 1, 0.05 do
  804. if Player.Character:FindFirstChild("Torso") ~= nil then
  805. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  806. Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
  807. Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new((-0.5 * i) + (1.5 * (1 - i)), 1.2 * i, 0.8 * i) * CFrame.fromEulerAnglesXYZ(math.rad(300 + ((1 - i) * 50)), math.rad(10), math.rad(-90) * i)
  808. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
  809. Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new((-0.9 * i) + (-1.5 * (1 - i)), -0.35 * i, 0.51 * i) * CFrame.fromEulerAnglesXYZ(math.rad(-90 * i), math.rad(-5 * i), 0)
  810. w.C0 = CFrame.new(0.5 - (i * (0.5 * 2)), -0.25 - (i * (-0.25 * 2)), -0.75 - (i * (-0.75 * 2))) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90 + (i * 180)), 0)
  811. w.C1 = CFrame.new() * CFrame.fromEulerAnglesXYZ(math.rad(50 - i * 25), 0, -math.rad(i * 15))
  812. wait()
  813. else return false end
  814. else return false end
  815. end
  816. return playAnimation("hold")
  817. end
  818. if format == "unequip" then
  819. Player.Character[Name].Handle.Weld:Remove()
  820. local w = Instance.new("Weld")
  821. w.Part0 = Player.Character[Name].Handle
  822. w.Part1 = Player.Character:FindFirstChild("Left Arm")
  823. w.C0 = CFrame.new(0.5, -0.25, -0.75) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  824. w.C1 = CFrame.new() * CFrame.fromEulerAnglesXYZ(math.rad(50), 0, 0)
  825. w.Parent = Player.Character[Name].Handle
  826. for i = 1, 0, -0.05 do
  827. if Player.Character:FindFirstChild("Torso") ~= nil then
  828. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  829. Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
  830. Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new((-0.5 * i) + (1.5 * (1 - i)), 1.2 * i, 0.8 * i) * CFrame.fromEulerAnglesXYZ(math.rad(300 + ((1 - i) * 50)), math.rad(10), math.rad(-90) * i)
  831. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
  832. Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new((-0.9 * i) + (-1.5 * (1 - i)), -0.35 * i, 0.51 * i) * CFrame.fromEulerAnglesXYZ(math.rad(-90 * i), math.rad(-5 * i), 0)
  833. w.C0 = CFrame.new(0.5 - (i * (0.5 * 2)), -0.25 - (i * (-0.25 * 2)), -0.75 - (i * (-0.75 * 2))) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90 + (i * 180)), 0)
  834. w.C1 = CFrame.new() * CFrame.fromEulerAnglesXYZ(math.rad(50 - i * 25), 0, -math.rad(i * 15))
  835. wait()
  836. else return false end
  837. else return false end
  838. end
  839. w.C0 = CFrame.new(0.5, -0.25, -0.75) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  840. w.C1 = CFrame.new() * CFrame.fromEulerAnglesXYZ(math.rad(50), 0, 0)
  841. ResetLimbCFrame(1, Player.Character)
  842. ResetLimbCFrame(2, Player.Character)
  843. EnableLimb(1, Player.Character)
  844. EnableLimb(2, Player.Character)
  845. DisableLimb(2, Player.Character)
  846. SetSpeed(2, 0.1, Player.Character)
  847. ForceAngle(2, 0, Player.Character)
  848. SetAngle(2, math.rad(-50), Player.Character)
  849. wait(0.25)
  850. SetAngle(2, 0, Player.Character)
  851. removeParts("RightHand")
  852. makeParts("RightHolster")
  853. wait(0.25)
  854. makeParts("RightHand")
  855. removeParts("RightHolster")
  856. return true
  857. end
  858. if format == "hold" then
  859. if Player.Character:FindFirstChild("Torso") ~= nil then
  860. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  861. Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
  862. Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new(-0.5, 1.2, 0.8) * CFrame.fromEulerAnglesXYZ(math.rad(300), math.rad(10), math.rad(-90))
  863. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
  864. Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(-0.9, -0.35, 0.51) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-5), 0)
  865. else return false end
  866. else return false end
  867. end
  868. if format == "reload" then
  869. Player.Character[Name].Handle.Reload:Play()
  870. Player.Character[Name].Magazine.Transparency = 1
  871. magazineDrop = Player.Character[Name].Magazine:Clone()
  872. magazineDrop.Transparency = 0
  873. magazineDrop.Parent = Workspace
  874. local w = Instance.new("Weld")
  875. w.Part0 = magazineDrop
  876. w.Part1 = Player.Character:FindFirstChild("Left Arm")
  877. w.C0 = CFrame.new(0, 1.1, 0)
  878. w.C1 = CFrame.new() * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  879. w.Parent = magazineDrop
  880. wait(0.2)
  881. for i = 0, 25, 2.5 do
  882. if Player.Character:FindFirstChild("Torso") ~= nil then
  883. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  884. Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
  885. Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new(-0.5 + (i / 60), 1.2 - (i / 20), 0.8 + (i / 35)) * CFrame.fromEulerAnglesXYZ(math.rad(300 - i), math.rad(10 + -i * 3.5), math.rad(-90))
  886. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
  887. Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(-0.9, -0.35, 0.51) * CFrame.fromEulerAnglesXYZ(math.rad(-90 + i), math.rad(-5), 0)
  888. wait()
  889. else return false end
  890. else return false end
  891. end
  892. coroutine.resume(coroutine.create(function(part) wait(4.5) for i = 0, 1, 0.1 do part.Transparency = i wait() end part:Remove() end), magazineDrop)
  893. delay(0.1, function() magazineDrop.CanCollide = true end)
  894. magazineDrop.Weld:Remove()
  895. wait(0.05)
  896. magazineNew = Player.Character[Name].Magazine:Clone()
  897. magazineNew.Name = "New Magazine"
  898. magazineNew.Transparency = 0
  899. magazineNew.Parent = Player.Character[Name]
  900. local w = Instance.new("Weld")
  901. w.Part0 = magazineNew
  902. w.Part1 = Player.Character:FindFirstChild("Left Arm")
  903. w.C0 = CFrame.new(0, 1.1, 0)
  904. w.C1 = CFrame.new() * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  905. w.Parent = magazineNew
  906. for i = 25, 0, -2.5 do
  907. if Player.Character:FindFirstChild("Torso") ~= nil then
  908. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  909. Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
  910. Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new(-0.5 + ((i + 10) / 60), 1.2 - ((i + 10) / 20), 0.8 + (i / 35)) * CFrame.fromEulerAnglesXYZ(math.rad(300 - (i - 10)), math.rad(10 + -i * 3.5), math.rad(-90))
  911. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
  912. Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(-0.9, -0.35, 0.51) * CFrame.fromEulerAnglesXYZ(math.rad(-90 + i), math.rad(-5), 0)
  913. wait()
  914. else return false end
  915. else return false end
  916. end
  917. Player.Character[Name].Magazine.Transparency = 0
  918. Player.Character[Name]["New Magazine"]:Remove()
  919. Player.Character[Name].Handle.Weld:Remove()
  920. local w = Instance.new("Weld")
  921. w.Part0 = Player.Character[Name].Handle
  922. w.Part1 = Player.Character:FindFirstChild("Left Arm")
  923. w.C0 = CFrame.new(-0.9, 0, 0.5) * CFrame.fromEulerAnglesXYZ(math.rad(10), math.rad(90), 0)
  924. w.C1 = CFrame.new() * CFrame.fromEulerAnglesXYZ(math.rad(50), 0, 0)
  925. w.Parent = Player.Character[Name].Handle
  926. wait(0.3)
  927. for i = 0, 1, 0.1 do
  928. if Player.Character:FindFirstChild("Torso") ~= nil then
  929. if Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  930. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
  931. Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(-0.9 + (i / 10), -0.35 + (i * 1.5), 0.51 + (i / 8)) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-5), 0)
  932. wait()
  933. else return false end
  934. else return false end
  935. end
  936. for i = 0, 1, 0.25 do
  937. if Player.Character:FindFirstChild("Torso") ~= nil then
  938. if Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  939. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
  940. Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(-0.8, 1.15 - (i / 5), 0.635) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-5), 0)
  941. wait()
  942. else return false end
  943. else return false end
  944. end
  945. for i = 1, 0, -0.25 do
  946. if Player.Character:FindFirstChild("Torso") ~= nil then
  947. if Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  948. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
  949. Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(-0.8, 1.15 - (i / 5), 0.635) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-5), 0)
  950. wait()
  951. else return false end
  952. else return false end
  953. end
  954. for i = 1, 0, -0.1 do
  955. if Player.Character:FindFirstChild("Torso") ~= nil then
  956. if Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  957. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
  958. Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(-0.9 + (i / 10), -0.35 + (i * 1.5), 0.51 + (i / 8)) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-5), 0)
  959. wait()
  960. else return false end
  961. else return false end
  962. end
  963. removeParts("RightHand")
  964. makeParts("RightHand")
  965. playAnimation("hold")
  966. return true
  967. end
  968. if format == "fire" then
  969. makeShell(Player.Character[Name]:FindFirstChild("ShellOut"))
  970. if Player.Character[Name]:FindFirstChild("Handle") ~= nil then
  971. Player.Character[Name].Handle.Fire:Stop()
  972. Player.Character[Name].Handle.Fire.Volume = math.random(3, 4) / 10
  973. Player.Character[Name].Handle.Fire.Pitch = math.random(69, 71) / 10
  974. Player.Character[Name].Handle.Fire:Play()
  975. coroutine.resume(coroutine.create(function() for i = 0.5, 0, -0.075 do Player.Character[Name].Handle.Fire.Volume = i wait() end Player.Character[Name].Handle.Fire.Volume = 0 end))
  976. CamShake(5, 50000)
  977. else return false end
  978. if Player.Character[Name]:FindFirstChild("Muzzle") ~= nil then
  979. coroutine.resume(coroutine.create(function() Player.Character[Name].Muzzle.Smoke.Enabled = true Player.Character[Name].Muzzle.Fire.Enabled = true wait(0.1) Player.Character[Name].Muzzle.Smoke.Enabled = false Player.Character[Name].Muzzle.Fire.Enabled = false end))
  980. else return false end
  981. for i = 0, 10, 5 do
  982. if Player.Character:FindFirstChild("Torso") ~= nil then
  983. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  984. Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
  985. Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new(-0.5, 1.2, 0.8) * CFrame.fromEulerAnglesXYZ(math.rad(300), math.rad(10 + i), math.rad(-90))
  986. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
  987. Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(-0.9, -0.35, 0.51) * CFrame.fromEulerAnglesXYZ(math.rad(-90 - i), math.rad(-5), 0)
  988. wait()
  989. else return false end
  990. else return false end
  991. end
  992. for i = 10, 0, -5 do
  993. if Player.Character:FindFirstChild("Torso") ~= nil then
  994. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  995. Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
  996. Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new(-0.5, 1.2, 0.8) * CFrame.fromEulerAnglesXYZ(math.rad(300), math.rad(10 + i), math.rad(-90))
  997. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
  998. Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(-0.9, -0.35, 0.51) * CFrame.fromEulerAnglesXYZ(math.rad(-90 - i), math.rad(-5), 0)
  999. wait()
  1000. else return false end
  1001. else return false end
  1002. end
  1003. end
  1004. return true
  1005. end
  1006.  
  1007.  
  1008. function CamShake(time, freq)
  1009. coroutine.resume(coroutine.create(function()
  1010. local cam = Workspace.CurrentCamera
  1011. local time = 10
  1012. local seed = Vector3.new(math.random(100, 200) / freq, math.random(100, 200) / freq, 0)
  1013. if math.random(1, 2) == 1 then seed = Vector3.new(-seed.x, seed.y, 0) end
  1014. if math.random(1, 2) == 1 then seed = Vector3.new(seed.x, -seed.y, 0) end
  1015. cam.CoordinateFrame = (CFrame.new(cam.Focus.p) * (cam.CoordinateFrame - cam.CoordinateFrame.p) * CFrame.fromEulerAnglesXYZ(seed.x * time, seed.y * time, 0)) * CFrame.new(0, 0, (cam.CoordinateFrame.p - cam.Focus.p).magnitude)
  1016. for i = 1, time do
  1017. cam.CoordinateFrame = (CFrame.new(cam.Focus.p) * (cam.CoordinateFrame - cam.CoordinateFrame.p) * CFrame.fromEulerAnglesXYZ(-seed.x, -seed.y, 0)) * CFrame.new(0, 0, (cam.CoordinateFrame.p - cam.Focus.p).magnitude)
  1018. wait()
  1019. end
  1020. end))
  1021. end
  1022.  
  1023.  
  1024. function makeShell(part)
  1025. if part == nil then return false end
  1026. local casing = Instance.new("Part")
  1027. casing.Name = "Shell"
  1028. casing.FormFactor = "Custom"
  1029. casing.Size = Vector3.new(1, 1, 1)
  1030. casing.CFrame = CFrame.new(part.Position) * CFrame.fromEulerAnglesXYZ(math.rad(math.random(0, 360)), math.rad(math.random(0, 360)), math.rad(math.random(0, 360)))
  1031. casing.BrickColor = BrickColor.new("New Yeller")
  1032. local mesh = Instance.new("CylinderMesh")
  1033. mesh.Scale = Vector3.new(0.1, 0.3, 0.1)
  1034. mesh.Parent = casing
  1035. casing.Parent = Workspace
  1036. casing:BreakJoints()
  1037. casing.Velocity = (part.CFrame.lookVector * 50) + Vector3.new(0, 10, 0)
  1038. coroutine.resume(coroutine.create(function() wait(4.5) for i = 0, 1, 0.1 do casing.Transparency = i wait() end casing:Remove() end))
  1039. end
  1040.  
  1041.  
  1042. function Weld(x, y)
  1043. local weld = Instance.new("Weld")
  1044. weld.Part0 = x
  1045. weld.Part1 = y
  1046. CJ = CFrame.new(x.Position)
  1047. C0 = x.CFrame:inverse() * CJ
  1048. C1 = y.CFrame:inverse() * CJ
  1049. weld.C0 = C0
  1050. weld.C1 = C1
  1051. weld.Parent = x
  1052. end
  1053.  
  1054.  
  1055. function tagHumanoid(humanoid)
  1056. local tag = Instance.new("ObjectValue")
  1057. tag.Name = "creator"
  1058. tag.Value = Player
  1059. tag.Parent = humanoid
  1060. local tag = Instance.new("StringValue")
  1061. tag.Name = "creatorType1"
  1062. tag.Value = Name
  1063. tag.Parent = humanoid
  1064. local tag = Instance.new("StringValue")
  1065. tag.Name = "creatorType2"
  1066. tag.Value = "sniped"
  1067. tag.Parent = humanoid
  1068. end
  1069.  
  1070.  
  1071. function untagHumanoid(humanoid)
  1072. if humanoid ~= nil then
  1073. local tag = humanoid:FindFirstChild("creator")
  1074. if tag ~= nil then
  1075. tag:Remove()
  1076. end
  1077. local tag = humanoid:FindFirstChild("creatorType1")
  1078. if tag ~= nil then
  1079. tag:Remove()
  1080. end
  1081. local tag = humanoid:FindFirstChild("creatorType2")
  1082. if tag ~= nil then
  1083. tag:Remove()
  1084. end
  1085. end
  1086. end
  1087.  
  1088.  
  1089. function fire(startPoint, endPoint, hit)
  1090. local trail = Instance.new("Part")
  1091. trail.Name = "Bullet Trail"
  1092. trail.BrickColor = BrickColor.new("New Yeller")
  1093. trail.TopSurface = 0
  1094. trail.BottomSurface = 0
  1095. trail.FormFactor = 0
  1096. trail.Size = Vector3.new(1, 1, 1)
  1097. trail.Transparency = 0.3
  1098. trail.Anchored = true
  1099. trail.CanCollide = false
  1100. trail.CFrame = CFrame.new((startPoint + endPoint) / 2, endPoint)
  1101. trail.Parent = Workspace
  1102. local mesh = Instance.new("SpecialMesh")
  1103. mesh.MeshType = "Brick"
  1104. mesh.Scale = Vector3.new(0.1, 0.1, (startPoint - endPoint).magnitude)
  1105. mesh.Parent = trail
  1106. coroutine.resume(coroutine.create(function(part) for i = 1, 10 do part.Mesh.Scale = Vector3.new(part.Mesh.Scale.x - 0.01, part.Mesh.Scale.y - 0.01, part.Mesh.Scale.z) wait() end part:Remove() end), trail)
  1107. if hit ~= nil then
  1108. if hit.Parent == nil then return end
  1109. if hit.Parent:FindFirstChild("Humanoid") ~= nil then
  1110. tagHumanoid(hit.Parent.Humanoid)
  1111. if hit.Name == "Head" then
  1112. hit.Parent.Humanoid:TakeDamage(damage * 10)
  1113. local s = Instance.new("Sound", hit)
  1114. s.SoundId = "http://www.roblox.com/Asset/?id=1876552"
  1115. s:Play()
  1116. local s = s:Clone(Player.Character.Torso)
  1117. s:Play()
  1118. coroutine.resume(coroutine.create(function()
  1119. while true do
  1120. if hit.Parent == nil then break end
  1121. if hit.Parent.Parent == nil then break end
  1122. hit:BreakJoints()
  1123. wait()
  1124. end
  1125. end))
  1126. elseif hit.Name == "Torso" then
  1127. hit.Parent.Humanoid:TakeDamage(damage * 2)
  1128. else
  1129. hit.Parent.Humanoid:TakeDamage(damage)
  1130. end
  1131. if math.random(1, 10) == 1 then
  1132. hit.Parent.Humanoid.Sit = true
  1133. end
  1134. delay(0.1, function() untagHumanoid(hit.Parent.Humanoid) end)
  1135. end
  1136. if hit.Anchored == false then
  1137. hit.Velocity = hit.Velocity + ((endPoint - startPoint).unit * (damage * 2))
  1138. end
  1139. end
  1140. end
  1141.  
  1142.  
  1143. function onButton1Down(mouse)
  1144. if selected == false then return end
  1145. if Player.Character:FindFirstChild(Name) ~= nil and Button1Down == false and canFire == true and (function() if dual == true then if Player.Character:FindFirstChild(Name.. " (Left)") ~= nil then return true else return false end else return true end end)() == true then
  1146. if Player.Character[Name]:FindFirstChild("Handle") == nil then return end
  1147. if Player.Character[Name]:FindFirstChild("Muzzle") == nil then return end
  1148. if dual == true then if Player.Character[Name.. " (Left)"]:FindFirstChild("Handle") == nil then return end end
  1149. if dual == true then if Player.Character[Name.. " (Left)"]:FindFirstChild("Muzzle") == nil then return end end
  1150. mouse.Icon = "rbxasset://textures\\GunWaitCursor.png"
  1151. Button1Down = true
  1152. canFire = false
  1153. canFire2 = true
  1154. while canFire2 == true do
  1155. local humanoid = Player.Character:FindFirstChild("Humanoid")
  1156. if humanoid == nil then
  1157. canFire2 = false
  1158. break
  1159. end
  1160. if humanoid.Health <= 0 then
  1161. canFire2 = false
  1162. break
  1163. end
  1164. local fireLeft = false
  1165. if automatic == false and burst == false then
  1166. canFire2 = false
  1167. elseif automatic == false and burst == true then
  1168. if burstCount >= burstCountMax then
  1169. canFire2 = false
  1170. burstCount = 0
  1171. break
  1172. end
  1173. burstCount = burstCount + 1
  1174. elseif automatic == true and burst == false then
  1175. fireLeft = true
  1176. end
  1177. if magazine.Value > 0 then
  1178. magazine.Value = magazine.Value - 1
  1179. updateGui()
  1180. fire(Player.Character[Name].Muzzle.Position, mouse.Hit.p, mouse.Target)
  1181. coroutine.resume(coroutine.create(function()
  1182. if dual == true then
  1183. playAnimation("rightFire")
  1184. elseif dual == false then
  1185. playAnimation("fire")
  1186. end
  1187. end))
  1188. else
  1189. Player.Character[Name].Handle.Empty:Play()
  1190. end
  1191. if fireLeft == true and dual == true and automatic == true then
  1192. if magazine.Value > 0 then
  1193. coroutine.resume(coroutine.create(function()
  1194. wait(readyTime / 2)
  1195. magazine.Value = magazine.Value - 1
  1196. updateGui()
  1197. fire(Player.Character[Name.. " (Left)"].Muzzle.Position, mouse.Hit.p, mouse.Target)
  1198. playAnimation("leftFire")
  1199. end))
  1200. else
  1201. coroutine.resume(coroutine.create(function()
  1202. wait(readyTime / 2)
  1203. Player.Character[Name].Handle.Empty:Play()
  1204. end))
  1205. end
  1206. end
  1207. wait(readyTime)
  1208. end
  1209. mouse.Icon = "rbxasset://textures\\GunCursor.png"
  1210. canFire = true
  1211. end
  1212. end
  1213.  
  1214.  
  1215. function onButton1Up(mouse)
  1216. if selected == false then return end
  1217. Button1Down = false
  1218. canFire2 = false
  1219. burstCount = 0
  1220. while canFire == false do wait() end
  1221. if dual == true and automatic == false then
  1222. if Player.Character[Name.. " (Left)"]:FindFirstChild("Handle") == nil then return end
  1223. if Player.Character[Name.. " (Left)"]:FindFirstChild("Muzzle") == nil then return end
  1224. mouse.Icon = "rbxasset://textures\\GunWaitCursor.png"
  1225. canFire = false
  1226. canFire2 = true
  1227. while canFire2 == true do
  1228. local humanoid = Player.Character:FindFirstChild("Humanoid")
  1229. if humanoid == nil then
  1230. canFire2 = false
  1231. break
  1232. end
  1233. if humanoid.Health <= 0 then
  1234. canFire2 = false
  1235. break
  1236. end
  1237. if burst == false then
  1238. canFire2 = false
  1239. elseif burst == true then
  1240. if burstCount >= burstCountMax then
  1241. canFire2 = false
  1242. burstCount = 0
  1243. break
  1244. end
  1245. burstCount = burstCount + 1
  1246. end
  1247. if magazine.Value <= 0 then
  1248. Player.Character[Name].Handle.Empty:Play()
  1249. else
  1250. coroutine.resume(coroutine.create(function()
  1251. playAnimation("leftFire")
  1252. end))
  1253. magazine.Value = magazine.Value - 1
  1254. updateGui()
  1255. fire(Player.Character[Name.. " (Left)"].Muzzle.Position, mouse.Hit.p, mouse.Target)
  1256. end
  1257. wait(readyTime)
  1258. end
  1259. mouse.Icon = "rbxasset://textures\\GunCursor.png"
  1260. canFire = true
  1261. end
  1262. end
  1263.  
  1264.  
  1265. function onKeyDown(key, mouse)
  1266. if selected == false then return end
  1267. key = key:lower()
  1268. if key == "q" and Button1Down == false and canFire == true then
  1269. if mouse.Target == nil then return end
  1270. if game:GetService("Players"):GetPlayerFromCharacter(mouse.Target.Parent) ~= nil then
  1271. if dual == true then onKeyDown("t", mouse) end
  1272. onDeselected(mouse)
  1273. removeParts("RightHolster")
  1274. script.Parent.Parent = game:GetService("Players"):GetPlayerFromCharacter(mouse.Target.Parent).Backpack
  1275. end
  1276. end
  1277. if key == "e" and Button1Down == false and canFire == true and canSilence == true then
  1278. if silenced then
  1279. silenced = false
  1280. if Player.Character:FindFirstChild(Name) == nil then return end
  1281. if Player.Character[Name]:FindFirstChild("Muzzle") == nil then return end
  1282. if Player.Character[Name]:FindFirstChild("Muzzle 2") == nil then return end
  1283. Player.Character[Name].Muzzle.Transparency = 1
  1284. Player.Character[Name].Muzzle.Name = "Silencer"
  1285. Player.Character[Name]["Muzzle 2"].Name = "Muzzle"
  1286. if dual == true then
  1287. if Player.Character[Name.. " (Left)"]:FindFirstChild("Muzzle") == nil then return end
  1288. if Player.Character[Name.. " (Left)"]:FindFirstChild("Muzzle 2") == nil then return end
  1289. Player.Character[Name.. " (Left)"].Muzzle.Transparency = 1
  1290. Player.Character[Name.. " (Left)"].Muzzle.Name = "Silencer"
  1291. Player.Character[Name.. " (Left)"]["Muzzle 2"].Name = "Muzzle"
  1292. end
  1293. else
  1294. silenced = true
  1295. if Player.Character:FindFirstChild(Name) == nil then return end
  1296. if Player.Character[Name]:FindFirstChild("Silencer") == nil then return end
  1297. if Player.Character[Name]:FindFirstChild("Muzzle") == nil then return end
  1298. Player.Character[Name].Silencer.Transparency = 0
  1299. Player.Character[Name].Muzzle.Name = "Muzzle 2"
  1300. Player.Character[Name].Silencer.Name = "Muzzle"
  1301. if dual == true then
  1302. if Player.Character[Name.. " (Left)"]:FindFirstChild("Silencer") == nil then return end
  1303. if Player.Character[Name.. " (Left)"]:FindFirstChild("Muzzle") == nil then return end
  1304. Player.Character[Name.. " (Left)"].Silencer.Transparency = 0
  1305. Player.Character[Name.. " (Left)"].Muzzle.Name = "Muzzle 2"
  1306. Player.Character[Name.. " (Left)"].Silencer.Name = "Muzzle"
  1307. end
  1308. end
  1309. end
  1310. if key == "r" and Button1Down == false and canFire == true then
  1311. if ammo.Value > 0 and magazine.Value ~= magazineMax.Value then
  1312. canFire = false
  1313. burstCount = 0
  1314. mouse.Icon = "rbxasset://textures\\GunWaitCursor.png"
  1315. if magazine.Value > 0 then ammo.Value = ammo.Value + magazine.Value magazine.Value = 0 end
  1316. updateGui()
  1317. if dual == true then
  1318. playAnimation("reloadDual")
  1319. elseif dual == false then
  1320. playAnimation("reload")
  1321. end
  1322. if ammo.Value - magazineMax.Value < 0 then
  1323. magazine.Value = ammo.Value
  1324. ammo.Value = 0
  1325. elseif ammo.Value - magazineMax.Value >= 0 then
  1326. ammo.Value = ammo.Value - magazineMax.Value
  1327. magazine.Value = magazineMax.Value
  1328. end
  1329. updateGui()
  1330. mouse.Icon = "rbxasset://textures\\GunCursor.png"
  1331. canFire = true
  1332. end
  1333. end
  1334. if key == "t" and Button1Down == false and canFire == true and canDual == true then
  1335. canFire = false
  1336. if dual == false then
  1337. local weapon = nil
  1338. for _, p in pairs(Player.Backpack:GetChildren()) do
  1339. if p.Name == Name and p ~= script.Parent then weapon = p break end
  1340. end
  1341. if weapon ~= nil then
  1342. dual = true
  1343. weapon.Name = "Dual"
  1344. weapon.Parent = script
  1345. silenced = false
  1346. removeParts("RightHand")
  1347. makeParts("RightHand")
  1348. removeParts("RightHolster")
  1349. makeParts("LeftHolster")
  1350. playAnimation("leftEquip")
  1351. removeParts("LeftHolster")
  1352. makeParts("LeftHand")
  1353. magazineMax.Value = math.ceil(magazineMax.Value * 2)
  1354. ammoMax.Value = math.ceil(ammoMax.Value * 2)
  1355. magazine.Value = magazine.Value + weapon.Magazine.Value
  1356. ammo.Value = ammo.Value + weapon.Ammo.Value
  1357. updateGui()
  1358. end
  1359. elseif dual == true then
  1360. local weapon = script:FindFirstChild("Dual")
  1361. if weapon ~= nil then
  1362. dual = false
  1363. weapon.Name = Name
  1364. weapon.Parent = Player.Backpack
  1365. silenced = false
  1366. removeParts("RightHand")
  1367. makeParts("RightHand")
  1368. playAnimation("leftUnequip")
  1369. removeParts("LeftHand")
  1370. makeParts("RightHolster")
  1371. playAnimation("hold")
  1372. weapon.Magazine.Value = math.floor(magazine.Value / 2)
  1373. weapon.Ammo.Value = math.floor(ammo.Value / 2)
  1374. magazineMax.Value = math.ceil(magazineMax.Value / 2)
  1375. ammoMax.Value = math.ceil(ammoMax.Value / 2)
  1376. magazine.Value = math.ceil(magazine.Value / 2)
  1377. ammo.Value = math.ceil(ammo.Value / 2)
  1378. updateGui()
  1379. end
  1380. end
  1381. canFire = true
  1382. end
  1383. if key == "y" and canZoom == true then
  1384. if zoom == false then
  1385. zoom = true
  1386. local pos = mouse.Hit.p
  1387. local target = mouse.Target
  1388. local cam = Workspace.CurrentCamera
  1389. focus = Instance.new("Part", Workspace)
  1390. focus.Anchored = true
  1391. focus.CanCollide = false
  1392. focus.Transparency = 1
  1393. focus.TopSurface = 0
  1394. focus.BottomSurface = 0
  1395. focus.FormFactor = "Plate"
  1396. focus.Size = Vector3.new(0, 0, 0)
  1397. focus.CFrame = CFrame.new(pos) * (CFrame.new(Player.Character.Torso.Position, pos) - CFrame.new(Player.Character.Torso.Position, pos).p)
  1398. cam.CameraSubject = focus
  1399. cam.CameraType = "Attach"
  1400. while zoom == true and selected == true do
  1401. local set = false
  1402. if target ~= nil then
  1403. if target.Parent ~= nil then
  1404. if target.Anchored == false then
  1405. focus.CFrame = CFrame.new(target.Position) * (CFrame.new(Player.Character.Torso.Position, target.Position) - CFrame.new(Player.Character.Torso.Position, target.Position).p)
  1406. set = true
  1407. end
  1408. end
  1409. end
  1410. if set == false then
  1411. focus.CFrame = CFrame.new(pos) * (CFrame.new(Player.Character.Torso.Position, pos) - CFrame.new(Player.Character.Torso.Position, pos).p)
  1412. end
  1413. wait()
  1414. end
  1415. if focus ~= nil then focus:Remove() focus = nil end
  1416. local cam = Workspace.CurrentCamera
  1417. cam.CameraSubject = Player.Character:FindFirstChild("Humanoid")
  1418. cam.CameraType = "Custom"
  1419. else
  1420. zoom = false
  1421. end
  1422. end
  1423. if key == "u" and Button1Down == false and canFire == true then
  1424. if automatic == false and burst == false then
  1425. if switchToBurst == true then
  1426. burst = true
  1427. local m = Instance.new("Message", Player)
  1428. m.Text = "Burst"
  1429. pcall(function() Player.Character[Name].Handle.Switch:Play() end)
  1430. delay(2.5, function() m:Remove() end)
  1431. elseif switchToAutomatic == true then
  1432. automatic = true
  1433. local m = Instance.new("Message", Player)
  1434. m.Text = "Automatic"
  1435. pcall(function() Player.Character[Name].Handle.Switch:Play() end)
  1436. delay(2.5, function() m:Remove() end)
  1437. end
  1438. elseif automatic == false and burst == true then
  1439. if switchToAutomatic == true then
  1440. automatic = true
  1441. burst = false
  1442. local m = Instance.new("Message", Player)
  1443. m.Text = "Automatic"
  1444. pcall(function() Player.Character[Name].Handle.Switch:Play() end)
  1445. delay(2.5, function() m:Remove() end)
  1446. elseif switchToSingle == true then
  1447. burst = false
  1448. local m = Instance.new("Message", Player)
  1449. m.Text = "Single"
  1450. pcall(function() Player.Character[Name].Handle.Switch:Play() end)
  1451. delay(2.5, function() m:Remove() end)
  1452. end
  1453. elseif automatic == true and burst == false then
  1454. if switchToSingle == true then
  1455. automatic = false
  1456. local m = Instance.new("Message", Player)
  1457. m.Text = "Single"
  1458. pcall(function() Player.Character[Name].Handle.Switch:Play() end)
  1459. delay(2.5, function() m:Remove() end)
  1460. elseif switchToBurst == true then
  1461. automatic = false
  1462. burst = true
  1463. local m = Instance.new("Message", Player)
  1464. m.Text = "Burst"
  1465. pcall(function() Player.Character[Name].Handle.Switch:Play() end)
  1466. delay(2.5, function() m:Remove() end)
  1467. end
  1468. end
  1469. end
  1470. end
  1471.  
  1472.  
  1473. function onSelected(mouse)
  1474. if selected == true then return end
  1475. selected = true
  1476. canFire = false
  1477. mouse.Icon = "rbxasset://textures\\GunWaitCursor.png"
  1478. while Player.Character:FindFirstChild("WeaponActivated") ~= nil do
  1479. if Player.Character.WeaponActivated.Value == nil then break end
  1480. if Player.Character.WeaponActivated.Value.Parent == nil then break end
  1481. wait()
  1482. end
  1483. updateGui()
  1484. local weapon = Instance.new("ObjectValue")
  1485. weapon.Name = "WeaponActivated"
  1486. weapon.Value = script.Parent
  1487. weapon.Parent = Player.Character
  1488. DisableLimb(1, Player.Character)
  1489. DisableLimb(2, Player.Character)
  1490. ForceAngle(1, 0, Player.Character)
  1491. ForceAngle(2, 0, Player.Character)
  1492. if dual == true then
  1493. coroutine.resume(coroutine.create(function() playAnimation("leftEquip") end))
  1494. playAnimation("rightEquip")
  1495. removeParts("LeftHolster")
  1496. makeParts("LeftHand")
  1497. else
  1498. playAnimation("equip")
  1499. end
  1500. removeParts("RightHolster")
  1501. makeParts("RightHand")
  1502. mouse.Button1Down:connect(function() onButton1Down(mouse) end)
  1503. mouse.Button1Up:connect(function() onButton1Up(mouse) end)
  1504. mouse.KeyDown:connect(function(key) onKeyDown(key, mouse) end)
  1505. mouse.Icon = "rbxasset://textures\\GunCursor.png"
  1506. canFire = true
  1507. end
  1508.  
  1509.  
  1510. function onDeselected(mouse)
  1511. if selected == false then return end
  1512. Button1Down = false
  1513. while canFire == false do
  1514. wait()
  1515. end
  1516. selected = false
  1517. if dual == true then
  1518. if math.random(1, 2) == 1 then
  1519. coroutine.resume(coroutine.create(function() playAnimation("leftUnequip") end))
  1520. wait(math.random(1, 10) / 10)
  1521. playAnimation("rightUnequip")
  1522. else
  1523. coroutine.resume(coroutine.create(function() playAnimation("rightUnequip") end))
  1524. wait(math.random(1, 10) / 10)
  1525. playAnimation("leftUnequip")
  1526. end
  1527. removeParts("LeftHand")
  1528. makeParts("LeftHolster")
  1529. else
  1530. playAnimation("unequip")
  1531. end
  1532. removeParts("RightHand")
  1533. makeParts("RightHolster")
  1534. ForceAngle(1, 0, Player.Character)
  1535. ForceAngle(2, 0, Player.Character)
  1536. ResetLimbCFrame(1, Player.Character)
  1537. ResetLimbCFrame(2, Player.Character)
  1538. EnableLimb(1, Player.Character)
  1539. EnableLimb(2, Player.Character)
  1540. silenced = false
  1541. if Player.PlayerGui:FindFirstChild(Name) ~= nil then Player.PlayerGui[Name]:Remove() end
  1542. if Player.Character:FindFirstChild("WeaponActivated") ~= nil then
  1543. if Player.Character.WeaponActivated.Value == script.Parent then
  1544. Player.Character.WeaponActivated:Remove()
  1545. end
  1546. end
  1547. while Player.Character:FindFirstChild("WeaponActivated") ~= nil do
  1548. if Player.Character.WeaponActivated.Value == nil then break end
  1549. if Player.Character.WeaponActivated.Value.Parent == nil then break end
  1550. wait()
  1551. end
  1552. end
  1553.  
  1554.  
  1555. if script.Parent.ClassName ~= "HopperBin" then
  1556. if Player == nil then print("Error: Player not found!") return end
  1557. Tool = Instance.new("HopperBin")
  1558. Tool.Name = Name
  1559. Tool.Parent = Player.Backpack
  1560. script.Name = "Main"
  1561. script.Parent = Tool
  1562. end wait() if script.Parent.ClassName == "HopperBin" then
  1563. while script.Parent.Parent.ClassName ~= "Backpack" do
  1564. wait()
  1565. end
  1566. if script.Parent:FindFirstChild("MagazineMax") == nil then
  1567. magazineMax = Instance.new("NumberValue")
  1568. magazineMax.Name = "MagazineMax"
  1569. magazineMax.Value = 10
  1570. magazineMax.Parent = script.Parent
  1571. else
  1572. magazineMax = script.Parent.MagazineMax
  1573. end
  1574. if script.Parent:FindFirstChild("Magazine") == nil then
  1575. magazine = Instance.new("NumberValue")
  1576. magazine.Name = "Magazine"
  1577. magazine.Value = 0
  1578. magazine.Parent = script.Parent
  1579. else
  1580. magazine = script.Parent.Magazine
  1581. end
  1582. if script.Parent:FindFirstChild("AmmoMax") == nil then
  1583. ammoMax = Instance.new("NumberValue")
  1584. ammoMax.Name = "AmmoMax"
  1585. ammoMax.Value = 260
  1586. ammoMax.Parent = script.Parent
  1587. else
  1588. ammoMax = script.Parent.AmmoMax
  1589. end
  1590. if script.Parent:FindFirstChild("Ammo") == nil then
  1591. ammo = Instance.new("NumberValue")
  1592. ammo.Name = "Ammo"
  1593. ammo.Value = script.Parent.AmmoMax.Value
  1594. ammo.Parent = script.Parent
  1595. else
  1596. ammo = script.Parent.Ammo
  1597. end
  1598. Player = script.Parent.Parent.Parent
  1599. makeParts("RightHolster")
  1600. script.Parent.Selected:connect(onSelected)
  1601. script.Parent.Deselected:connect(onDeselected)
  1602. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement