Advertisement
Guest User

Untitled

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