Advertisement
Noobpwner174

Untitled

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