Advertisement
Lukas17

Untitled

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