Advertisement
Hebablazin

ScahrH

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