Advertisement
Guest User

Roblox FN script leak

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