Kittdy2

Untitled

Jan 20th, 2019
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 24.29 KB | None | 0 0
  1. --[[
  2. Flame Thrower
  3. Throws flames. 50-unit tank.
  4. --]]
  5.  
  6.  
  7. if script == nil then return end
  8.  
  9.  
  10. ModelName = "Flame Thrower"
  11. AmmoType = "Liquid Petroleum"
  12. MagazineCapacity = 50
  13. MagazineCapacityAdd = 0
  14. Player = script:FindFirstChild("Player") ~= nil and script.Player.Value or game:GetService("Players"):FindFirstChild("DarkShadow6")
  15. Selected = false
  16. Connected = false
  17. Button1Down = false
  18. CanUse = true
  19. FirstPerson = game:GetService("InsertService"):LoadAsset(60568552)["FirstPerson"].Value
  20. MouseAim = game:GetService("InsertService"):LoadAsset(61527949)["MouseAim"].Value
  21. AmmoCounter = game:GetService("InsertService"):LoadAsset(66610412)["AmmoCounter"].Value
  22.  
  23.  
  24. function CheckPlayer()
  25. if Player.Character == nil then return false end
  26. if Player.Character:FindFirstChild("Torso") == nil or Player.Character:FindFirstChild("Right Arm") == nil or Player.Character:FindFirstChild("Left Arm") == nil or Player.Character:FindFirstChild("Humanoid") == nil then return false end
  27. if Player.Character.Humanoid.Health <= 0 then return false end
  28. return true
  29. end
  30.  
  31.  
  32. loadstring(game:GetService("InsertService"):LoadAsset(65363615)["tagHumanoid"].Value)()
  33.  
  34.  
  35. loadstring(game:GetService("InsertService"):LoadAsset(63178291)["CameraPunch"].Value)()
  36.  
  37.  
  38. loadstring(game:GetService("InsertService"):LoadAsset(62991657)["PacketFunctions"].Value)()
  39.  
  40.  
  41. function CreateParts(Parent, Format)
  42. if Parent == nil then return end
  43. local Parts = Instance.new("Model")
  44. Parts.Name = ModelName
  45. if Format == 1 then
  46. Parts.Name = Parts.Name.. " (Holstered)"
  47. end
  48. Parts.Parent = Parent
  49.  
  50. local MasterPart = Instance.new("Part")
  51. MasterPart.Name = "Handle"
  52. MasterPart.BrickColor = BrickColor.new("Medium stone grey")
  53. MasterPart.TopSurface = 0
  54. MasterPart.BottomSurface = 0
  55. MasterPart.FormFactor = "Custom"
  56. MasterPart.Size = Vector3.new(0.6, 1.9, 0.6)
  57. MasterPart.Parent = Parts
  58. Instance.new("CylinderMesh", MasterPart).Bevel = 0.05
  59. local Weld = Instance.new("Weld")
  60. Weld.Part0 = MasterPart
  61. if Format == 1 then
  62. Weld.Part1 = Player.Character:FindFirstChild("Torso")
  63. Weld.C0 = CFrame.new(-1, -0.25, 0.05) * CFrame.fromEulerAnglesXYZ(math.rad(-40),0, 0)
  64. elseif Format == 2 then
  65. Weld.Part1 = Player.Character:FindFirstChild("Right Arm")
  66. Weld.C0 = CFrame.new(0, 1.4, 0.8)
  67. end
  68. Weld.Parent = Weld.Part0
  69.  
  70. local Part = Instance.new("Part")
  71. Part.Name = "Grip"
  72. Part.BrickColor = BrickColor.new("Realy black")
  73. Part.TopSurface = 0
  74. Part.BottomSurface = 0
  75. Part.FormFactor = "Custom"
  76. Part.Size = Vector3.new(0.3, 0.5, 1)
  77. Part.Parent = Parts
  78. local Weld = Instance.new("Weld")
  79. Weld.Part0 = Part
  80. Weld.Part1 = MasterPart
  81. Weld.C0 = CFrame.new(0, -0.25, -0.6)
  82. Weld.Parent = Part
  83.  
  84. local Part = Instance.new("Part")
  85. Part.Name = "Tank Holder"
  86. Part.BrickColor = BrickColor.new("Really black")
  87. Part.TopSurface = 0
  88. Part.BottomSurface = 0
  89. Part.FormFactor = "Custom"
  90. Part.Size = Vector3.new(0.2, 0.2, 0.2)
  91. Part.Parent = Parts
  92. Instance.new("CylinderMesh", Part)
  93. local Weld = Instance.new("Weld")
  94. Weld.Part0 = Part
  95. Weld.Part1 = MasterPart
  96. Weld.C0 = CFrame.fromEulerAnglesXYZ(math.rad(90), 0, 0) * CFrame.new(0, 0.85, -0.3)
  97. Weld.Parent = Part
  98.  
  99. local Part = Instance.new("Part")
  100. Part.Name = "Tank"
  101. Part.BrickColor = BrickColor.new("Really red")
  102. Part.TopSurface = 0
  103. Part.BottomSurface = 0
  104. Part.FormFactor = "Custom"
  105. Part.Size = Vector3.new(0.75, 1, 0.75)
  106. Part.Parent = Parts
  107. Instance.new("CylinderMesh", Part).Bevel = 0.1
  108. local Weld = Instance.new("Weld")
  109. Weld.Part0 = Part
  110. Weld.Part1 = MasterPart
  111. Weld.C0 = CFrame.fromEulerAnglesXYZ(math.rad(90), 0, 0) * CFrame.new(0, 0.85, -0.9)
  112. Weld.Parent = Part
  113.  
  114. local Part = Instance.new("Part")
  115. Part.Name = "Flame Barrel 1"
  116. Part.BrickColor = BrickColor.new("Really black")
  117. Part.TopSurface = 0
  118. Part.BottomSurface = 0
  119. Part.FormFactor = "Custom"
  120. Part.Size = Vector3.new(0.2, 1.3, 0.2)
  121. Part.Parent = Parts
  122. Instance.new("CylinderMesh", Part).Scale = Vector3.new(0.2, 1, 0.2)
  123. local Weld = Instance.new("Weld")
  124. Weld.Part0 = Part
  125. Weld.Part1 = MasterPart
  126. Weld.C0 = CFrame.new(0, 1.55, -0.2)
  127. Weld.Parent = Part
  128.  
  129. local Part = Instance.new("Part")
  130. Part.Name = "Flame Barrel Joint"
  131. Part.BrickColor = BrickColor.new("Really black")
  132. Part.TopSurface = 0
  133. Part.BottomSurface = 0
  134. Part.FormFactor = "Custom"
  135. Part.Size = Vector3.new(0.2, 0.2, 0.2)
  136. Part.Parent = Parts
  137. local Mesh = Instance.new("SpecialMesh", Part)
  138. Mesh.MeshType = "Sphere"
  139. Mesh.Scale = Vector3.new(0.2, 0.2, 0.2)
  140. local Weld = Instance.new("Weld")
  141. Weld.Part0 = Part
  142. Weld.Part1 = MasterPart
  143. Weld.C0 = CFrame.new(0, 2.2, -0.2)
  144. Weld.Parent = Part
  145.  
  146. local Part = Instance.new("Part")
  147. Part.Name = "Flame Barrel 2"
  148. Part.BrickColor = BrickColor.new("Really black")
  149. Part.TopSurface = 0
  150. Part.BottomSurface = 0
  151. Part.FormFactor = "Custom"
  152. Part.Size = Vector3.new(0.2, 1, 0.2)
  153. Part.Parent = Parts
  154. Instance.new("CylinderMesh", Part).Scale = Vector3.new(0.2, 0.3, 0.2)
  155. local Weld = Instance.new("Weld")
  156. Weld.Part0 = Part
  157. Weld.Part1 = MasterPart
  158. Weld.C0 = CFrame.fromEulerAnglesXYZ(math.rad(90), 0, 0) * CFrame.new(0, 2.2, -0.05)
  159. Weld.Parent = Part
  160.  
  161. local Part = Instance.new("Part")
  162. Part.Name = "Barrel Holder"
  163. Part.BrickColor = BrickColor.new("Really black")
  164. Part.TopSurface = 0
  165. Part.BottomSurface = 0
  166. Part.FormFactor = "Custom"
  167. Part.Size = Vector3.new(0.2, 1, 0.4)
  168. Part.Parent = Parts
  169. Instance.new("BlockMesh", Part).Scale = Vector3.new(0.1, 1, 1)
  170. local Weld = Instance.new("Weld")
  171. Weld.Part0 = Part
  172. Weld.Part1 = MasterPart
  173. Weld.C0 = CFrame.new(0, 1.4, 0)
  174. Weld.Parent = Part
  175.  
  176. local Part = Instance.new("Part")
  177. Part.Name = "Fuel Barrel"
  178. Part.BrickColor = BrickColor.new("Black")
  179. Part.TopSurface = 0
  180. Part.BottomSurface = 0
  181. Part.FormFactor = "Custom"
  182. Part.Size = Vector3.new(0.25, 1, 0.25)
  183. Part.Parent = Parts
  184. Instance.new("CylinderMesh", Part)
  185. local Weld = Instance.new("Weld")
  186. Weld.Part0 = Part
  187. Weld.Part1 = MasterPart
  188. Weld.C0 = CFrame.new(0, 1.4, 0.15)
  189. Weld.Parent = Part
  190.  
  191. local Part = Instance.new("Part")
  192. Part.Name = "Source"
  193. Part.FormFactor = "Custom"
  194. Part.Size = Vector3.new(0.3, 0.2, 0.3)
  195. Part.BrickColor = BrickColor.new("Black")
  196. Part.TopSurface = 0
  197. Part.BottomSurface = 0
  198. Part.Parent = Parts
  199. Instance.new("CylinderMesh", Part)
  200. local Weld = Instance.new("Weld")
  201. Weld.Part0 = Part
  202. Weld.Part1 = MasterPart
  203. Weld.C0 = CFrame.new(0, 2, 0.15)
  204. Weld.Parent = Part
  205. local Smoke = Instance.new("Smoke", Part)
  206. Smoke.Enabled = false
  207. Smoke.Size = 20
  208. Smoke.RiseVelocity = -15
  209. Smoke.Color = Color3.new(0.7, 0.7, 0.7)
  210. Smoke.Opacity = 0.15
  211.  
  212. for _, Part in pairs(Parts:GetChildren()) do
  213. Part.Locked = true
  214. Part.CanCollide = false
  215. end
  216. end
  217.  
  218.  
  219. function RemoveParts(Parent, Format)
  220. if Format == 1 then
  221. pcall(function() Parent[ModelName.. " (Holstered)"]:Remove() end)
  222. elseif Format == 2 then
  223. pcall(function() Parent[ModelName]:Remove() end)
  224. end
  225. end
  226.  
  227.  
  228. function SetAngle(Joint, Angle, Character)
  229. if Character == nil then return false end
  230. local Joints = {
  231. Character.Torso:FindFirstChild("Right Shoulder 2"),
  232. Character.Torso:FindFirstChild("Left Shoulder 2"),
  233. Character.Torso:FindFirstChild("Right Hip 2"),
  234. Character.Torso:FindFirstChild("Left Hip 2")
  235. }
  236. if Joints[Joint] == nil then return false end
  237. if Joint == 1 or Joint == 3 then
  238. Joints[Joint].DesiredAngle = Angle
  239. end
  240. if Joint == 2 or Joint == 4 then
  241. Joints[Joint].DesiredAngle = -Angle
  242. end
  243. end
  244.  
  245.  
  246. function ForceAngle(Joint, Angle, Character)
  247. if Character == nil then return false end
  248. local Joints = {
  249. Character.Torso:FindFirstChild("Right Shoulder 2"),
  250. Character.Torso:FindFirstChild("Left Shoulder 2"),
  251. Character.Torso:FindFirstChild("Right Hip 2"),
  252. Character.Torso:FindFirstChild("Left Hip 2")
  253. }
  254. if Joints[Joint] == nil then return false end
  255. if Joint == 1 or Joint == 3 then
  256. Joints[Joint].DesiredAngle = Angle
  257. Joints[Joint].CurrentAngle = Angle
  258. end
  259. if Joint == 2 or Joint == 4 then
  260. Joints[Joint].DesiredAngle = -Angle
  261. Joints[Joint].CurrentAngle = -Angle
  262. end
  263. end
  264.  
  265.  
  266. function SetSpeed(Joint, Speed, Character)
  267. if Character == nil then return false end
  268. local Joints = {
  269. Character.Torso:FindFirstChild("Right Shoulder 2"),
  270. Character.Torso:FindFirstChild("Left Shoulder 2"),
  271. Character.Torso:FindFirstChild("Right Hip 2"),
  272. Character.Torso:FindFirstChild("Left Hip 2")
  273. }
  274. if Joints[Joint] == nil then return false end
  275. Joints[Joint].MaxVelocity = Speed
  276. end
  277.  
  278.  
  279. function DisableLimb(Limb, Character)
  280. if Character == nil then return false end
  281. if Character:FindFirstChild("Torso") == nil then return false end
  282. local Joints = {
  283. Character.Torso:FindFirstChild("Right Shoulder"),
  284. Character.Torso:FindFirstChild("Left Shoulder"),
  285. Character.Torso:FindFirstChild("Right Hip"),
  286. Character.Torso:FindFirstChild("Left Hip")
  287. }
  288. local Limbs = {
  289. Character:FindFirstChild("Right Arm"),
  290. Character:FindFirstChild("Left Arm"),
  291. Character:FindFirstChild("Right Leg"),
  292. Character:FindFirstChild("Left Leg")
  293. }
  294. if Joints[Limb] == nil then return false end
  295. if Limbs[Limb] == nil then return false end
  296. local Joint = Instance.new("Motor6D")
  297. Joint.Parent = Character.Torso
  298. Joint.Part0 = Character.Torso
  299. Joint.Part1 = Limbs[Limb]
  300. if Limb == 1 then
  301. Joint.C0 = CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  302. Joint.C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  303. Joint.Name = "Right Shoulder 2"
  304. elseif Limb == 2 then
  305. Joint.C0 = CFrame.new(-1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  306. Joint.C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  307. Joint.Name = "Left Shoulder 2"
  308. elseif Limb == 3 then
  309. Joint.C0 = CFrame.new(0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  310. Joint.C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  311. Joint.Name = "Right Hip 2"
  312. elseif Limb == 4 then
  313. Joint.C0 = CFrame.new(-0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  314. Joint.C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  315. Joint.Name = "Left Hip 2"
  316. end
  317. Joint.MaxVelocity = Joints[Limb].MaxVelocity
  318. Joint.CurrentAngle = Joints[Limb].CurrentAngle
  319. Joint.DesiredAngle = Joints[Limb].DesiredAngle
  320. Joints[Limb]:Remove()
  321. end
  322.  
  323.  
  324. function ResetLimbCFrame(Limb, Character)
  325. if Character == nil then return false end
  326. if Character.Parent == nil then return false end
  327. if Character:FindFirstChild("Torso") == nil then return false end
  328. local Joints = {
  329. Character.Torso:FindFirstChild("Right Shoulder 2"),
  330. Character.Torso:FindFirstChild("Left Shoulder 2"),
  331. Character.Torso:FindFirstChild("Right Hip 2"),
  332. Character.Torso:FindFirstChild("Left Hip 2")
  333. }
  334. local Limbs = {
  335. Character:FindFirstChild("Right Arm"),
  336. Character:FindFirstChild("Left Arm"),
  337. Character:FindFirstChild("Right Leg"),
  338. Character:FindFirstChild("Left Leg")
  339. }
  340. if Joints[Limb] == nil then return false end
  341. if Limbs[Limb] == nil then return false end
  342. if Limb == 1 then
  343. Joints[Limb].C0 = CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  344. Joints[Limb].C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  345. elseif Limb == 2 then
  346. Joints[Limb].C0 = CFrame.new(-1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  347. Joints[Limb].C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  348. elseif Limb == 3 then
  349. Joints[Limb].C0 = CFrame.new(0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  350. Joints[Limb].C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  351. elseif Limb == 4 then
  352. Joints[Limb].C0 = CFrame.new(-0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  353. Joints[Limb].C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  354. end
  355. end
  356.  
  357.  
  358. function EnableLimb(Limb, Character)
  359. if Character == nil then return false end
  360. if Character:FindFirstChild("Torso") == nil then return false end
  361. local Joints = {
  362. Character.Torso:FindFirstChild("Right Shoulder 2"),
  363. Character.Torso:FindFirstChild("Left Shoulder 2"),
  364. Character.Torso:FindFirstChild("Right Hip 2"),
  365. Character.Torso:FindFirstChild("Left Hip 2")
  366. }
  367. local Limbs = {
  368. Character:FindFirstChild("Right Arm"),
  369. Character:FindFirstChild("Left Arm"),
  370. Character:FindFirstChild("Right Leg"),
  371. Character:FindFirstChild("Left Leg")
  372. }
  373. if Joints[Limb] == nil then return false end
  374. if Limbs[Limb] == nil then return false end
  375. if Limb == 1 then
  376. Joints[Limb].Name = "Right Shoulder"
  377. elseif Limb == 2 then
  378. Joints[Limb].Name = "Left Shoulder"
  379. elseif Limb == 3 then
  380. Joints[Limb].Name = "Right Hip"
  381. elseif Limb == 4 then
  382. Joints[Limb].Name = "Left Hip"
  383. end
  384. Animate = Character:FindFirstChild("Animate")
  385. if Animate == nil then return false end
  386. Animate = Animate:Clone()
  387. Character.Animate:Remove()
  388. Animate.Parent = Character
  389. end
  390.  
  391.  
  392. function onButton1Down(Mouse)
  393. if Button1Down == true then return end
  394. Button1Down = true
  395. if CheckPlayer() == false then return end
  396. if CanUse == true then
  397. SoundToServer("Click", "http://www.roblox.com/Asset/?id=2697295", 15, 0.25, false, Player.Character[ModelName].Handle)
  398. CanUse = false
  399. pcall(function() Player.Character[ModelName].Source.Smoke.Enabled = true end)
  400. while Button1Down == true do
  401. if script.Magazine.Value <= 0 then
  402. break
  403. end
  404. SoundToServer("Whoosh", "rbxasset://sounds/Rocket whoosh 01.wav", 3, 0.5, false, Player.Character[ModelName].Handle)
  405. script.Magazine.Value = script.Magazine.Value - 1
  406. local Flame = Instance.new("Part", Workspace)
  407. Flame.Name = "Flame"
  408. Flame.TopSurface = 0
  409. Flame.BottomSurface = 0
  410. Flame.BrickColor = BrickColor.new((function()
  411. local Color = math.random(1, 5)
  412. if Color == 1 then
  413. return "Really red"
  414. elseif Color == 2 then
  415. return "Bright red"
  416. elseif Color == 3 then
  417. return "White"
  418. elseif Color == 4 then
  419. return "Black"
  420. elseif Color == 5 then
  421. return "New Yeller"
  422. end
  423. end)())
  424. Flame.Locked = true
  425. Flame.CanCollide = false
  426. Flame.FormFactor = "Custom"
  427. Flame.Size = Vector3.new(2, 2, 2)
  428. Flame.CFrame = Player.Character[ModelName].Source.CFrame * CFrame.new(0, -3, 0)
  429. Flame.Elasticity = 0
  430. Flame.Friction = 0
  431. Instance.new("Configuration", Flame).Name = "RealFire"
  432. local Mesh = Instance.new("SpecialMesh", Flame)
  433. Mesh.MeshType = "Sphere"
  434. Mesh.Scale = Vector3.new()
  435. local creator = Instance.new("ObjectValue", Flame)
  436. creator.Name = "creator"
  437. creator.Value = Player
  438. local BodyVelocity = Instance.new("BodyVelocity", Flame)
  439. BodyVelocity.maxForce = Vector3.new(math.huge, math.huge, math.huge)
  440. BodyVelocity.velocity = ((Mouse.Hit.p - Player.Character[ModelName].Source.Position).unit * math.random(50, 125)) + (Vector3.new(math.random(-8000, 8000) / 1000, math.random(-2000, 1500) / 1000, math.random(-8000, 8000) / 1000))
  441. coroutine.wrap(function()
  442. for i = 0, 1, 0.05 do
  443. Flame.Transparency = i
  444. wait()
  445. end
  446. Flame:Remove()
  447. end)()
  448. coroutine.wrap(function()
  449. while Flame.Parent ~= nil do
  450. Flame.Mesh.Scale = Flame.Mesh.Scale + Vector3.new(0.4, 0.4, 0.4)
  451. wait()
  452. end
  453. end)()
  454. coroutine.wrap(function()
  455. TouchedToServer([[
  456. if Hit.Name == "Flame" or Hit.Anchored == true then return end
  457. game:GetService("InsertService"):LoadAsset(61110829)["RealFire"].Parent = Hit
  458. ]], Flame)
  459. wait(math.random(1000, 5000) / 1000)
  460. for i = Flame.Transparency, 1, 0.1 do
  461. Flame.Transparency = i
  462. wait()
  463. end
  464. Flame:Remove()
  465. end)()
  466. Flame:BreakJoints()
  467. CameraPunch(math.rad(math.random(-100, 1000) / 1000), math.rad(math.random(-1000, 1000) / 1000))
  468. wait(0.05)
  469. end
  470. pcall(function() Player.Character[ModelName].Source.Smoke.Enabled = false end)
  471. CanUse = true
  472. end
  473. end
  474.  
  475.  
  476. function onButton1Up(Mouse)
  477. Button1Down = false
  478. end
  479.  
  480.  
  481. function onKeyDown(Key, Mouse)
  482. if Selected == false then return end
  483. Key = Key:lower()
  484. if Button1Down == false and CanUse == true and CheckPlayer() == true then
  485. if Key == "q" then
  486. if Mouse.Target == nil then return end
  487. if CheckPlayer() == false then return end
  488. local NewPlayer = game:GetService("Players"):GetPlayerFromCharacter(Mouse.Target.Parent)
  489. if NewPlayer == nil then return end
  490. if NewPlayer.Character == nil then return end
  491. if NewPlayer.Character:FindFirstChild("Torso") == nil then return end
  492. if (NewPlayer.Character.Torso.Position - Player.Character.Torso.Position).magnitude > 10 then return end
  493. onDeselected(Mouse)
  494. wait()
  495. RemoveParts(Player.Character, 1)
  496. script.Parent.Parent = NewPlayer.Backpack
  497. Player = NewPlayer
  498. elseif Key == "r" then
  499. if script.Magazine.Value >= MagazineCapacity or Player.Backpack.Ammo[AmmoType].Value <= 0 then return end
  500. CanUse = false
  501. DisableLimb(2, Player.Character)
  502. SetSpeed(2, 0.15, Player.Character)
  503. SetAngle(2, math.rad(90), Player.Character)
  504. UpdateFirstPerson(true)
  505. for i = 0, 1, 0.05 do
  506. pcall(function()
  507. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new(1.5 - (0.5 * i), 0.5 + (0.05 * i), 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90 + (50 * i)), 0)
  508. Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new(-1.5 + (0.25 * i), 0.5 - (0.1 * i), 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90 - (4 * i)), 0)
  509. end)
  510. wait()
  511. end
  512. pcall(function()
  513. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new(1, 0.55, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(140), 0)
  514. Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new(-1.25, 0.4, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-92), 0)
  515. end)
  516. SoundToServer("Tank Removed", "http://www.roblox.com/Asset/?id=10209813", 1, 1, false, Player.Character[ModelName].Handle)
  517. Player.Backpack.Ammo[AmmoType].Value = Player.Backpack.Ammo[AmmoType].Value + script.Magazine.Value
  518. script.Magazine.Value = 0
  519. local Clone = nil
  520. local Weld = nil
  521. pcall(function()
  522. Clone = Player.Character[ModelName].Tank:Clone()
  523. Clone.Parent = Workspace
  524. Weld = Instance.new("Weld", Clone)
  525. Weld.Part0 = Weld.Parent
  526. Weld.Part1 = Player.Character:FindFirstChild("Left Arm")
  527. Weld.C0 = CFrame.fromEulerAnglesXYZ(math.rad(90), 0, 0) * CFrame.new(0, 1.3, 0)
  528. Player.Character[ModelName].Tank.Transparency = 1
  529. end)
  530. SetAngle(2, math.rad(40), Player.Character)
  531. CameraSlide(math.rad(-2), 0, 0.1)
  532. pcall(function() Weld:Remove() end)
  533. pcall(function()
  534. Clone.CanCollide = true
  535. game:GetService("Debris"):AddItem(Clone, 25)
  536. end)
  537. SetAngle(2, math.rad(90), Player.Character)
  538. CameraSlide(math.rad(2), 0, 0.1)
  539. SetAngle(2, 0, Player.Character)
  540. for i = 1, 0, -0.05 do
  541. pcall(function() Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new(-1.5 + (0.25 * i), 0.5 - (0.1 * i), 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90 - (4 * i)), 0) end)
  542. CameraPunch(math.rad(-1), 0)
  543. wait()
  544. end
  545. pcall(function()
  546. local Tank = Player.Character[ModelName].Tank:Clone()
  547. Tank.Name = "New Tank"
  548. Tank.Transparency = 0
  549. Tank.Parent = Player.Character[ModelName]
  550. local Weld = Instance.new("Weld", Tank)
  551. Weld.Part0 = Weld.Parent
  552. Weld.Part1 = Player.Character:FindFirstChild("Left Arm")
  553. Weld.C0 = CFrame.fromEulerAnglesXYZ(math.rad(90), 0, 0) * CFrame.new(0, 1.3, 0)
  554. end)
  555. SoundToServer("Tank Replaced", "http://www.roblox.com/Asset/?id=10209801", 1.5, 1, false, Player.Character[ModelName].Handle)
  556. SetAngle(2, math.rad(90), Player.Character)
  557. for i = 0, 1, 0.1 do
  558. pcall(function() Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new(-1.5 + (0.25 * i), 0.5 - (0.1 * i), 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90 - (4 * i)), 0) end)
  559. CameraPunch(math.rad(1), 0)
  560. wait()
  561. end
  562. CameraSlide(math.rad(5), 0, 0.1)
  563. pcall(function()
  564. Player.Character[ModelName].Tank.Transparency = 0
  565. Player.Character[ModelName]["New Tank"]:Remove()
  566. end)
  567. if Player.Backpack.Ammo[AmmoType].Value - MagazineCapacity < 0 then
  568. script.Magazine.Value = Player.Backpack.Ammo[AmmoType].Value
  569. Player.Backpack.Ammo[AmmoType].Value = 0
  570. else
  571. script.Magazine.Value = MagazineCapacity
  572. Player.Backpack.Ammo[AmmoType].Value = Player.Backpack.Ammo[AmmoType].Value - MagazineCapacity
  573. end
  574. SetAngle(2, 0, Player.Character)
  575. for i = 1, 0, -0.075 do
  576. pcall(function()
  577. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new(1.5 - (0.5 * i), 0.5 + (0.05 * i), 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90 + (50 * i)), 0)
  578. Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new(-1.5 + (0.25 * i), 0.5 - (0.1 * i), 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90 - (4 * i)), 0)
  579. end)
  580. wait()
  581. end
  582. ResetLimbCFrame(1, Player.Character)
  583. ResetLimbCFrame(2, Player.Character)
  584. EnableLimb(1, Player.Character)
  585. EnableLimb(2, Player.Character)
  586. DisableLimb(1, Player.Character)
  587. UpdateFirstPerson(true)
  588. wait(0.5)
  589. CanUse = true
  590. elseif Key == "g" then
  591. CanUse = false
  592. SoundToServer("Slash", "rbxasset://sounds/swordslash.wav", 2, 1, false, Player.Character.Torso)
  593. SetSpeed(1, 0.3, Player.Character)
  594. SetAngle(1, math.rad(150), Player.Character)
  595. CameraSlide(math.rad(15), 0, 0.2)
  596. SetSpeed(1, 0.5, Player.Character)
  597. SetAngle(1, math.rad(10), Player.Character)
  598. local HasHit = false
  599. local _, HitConnection = pcall(function() return Player.Character[ModelName].Handle.Touched:connect(function(Hit)
  600. if HasHit == true or Hit:IsDescendantOf(Player.Character) then return end
  601. HasHit = true
  602. SoundToServer("Bash", "http://www.roblox.com/Asset/?id=46153268", 1, 0.25, false, Player.Character.Torso)
  603. local Humanoid = Hit.Parent:FindFirstChild("Humanoid") or Hit.Parent.Parent:FindFirstChild("Humanoid")
  604. if Humanoid ~= nil then
  605. tagHumanoid(Humanoid)
  606. Humanoid:TakeDamage(9)
  607. wait()
  608. pcall(function() untagHumanoid(Humanoid) end)
  609. end
  610. end) end)
  611. CameraSlide(math.rad(-20), 0, 0.15)
  612. pcall(function() HitConnection:disconnect() end)
  613. SetSpeed(1, 0.15, Player.Character)
  614. SetAngle(1, math.rad(90), Player.Character)
  615. CameraSlide(math.rad(5), 0, 0.25)
  616. CanUse = true
  617. end
  618. end
  619. end
  620.  
  621.  
  622. function onSelected(Mouse)
  623. if Selected == true or CanUse == false then return end
  624. CanUse = false
  625. while true do
  626. if CheckPlayer() == true then
  627. if Player.Character.Torso:FindFirstChild("Right Shoulder") ~= nil and Player.Character.Torso:FindFirstChild("Left Shoulder") ~= nil then
  628. break
  629. end
  630. end
  631. wait(0.1)
  632. end
  633. Selected = true
  634. RemoveParts(Player.Character, 1)
  635. CreateParts(Player.Character, 2)
  636. DisableLimb(1, Player.Character)
  637. SetSpeed(1, 0.1, Player.Character)
  638. SetAngle(1, math.rad(90), Player.Character)
  639. wait(0.5)
  640. Mouse.Icon = "rbxasset://textures\\GunCursor.png"
  641. Mouse.Button1Down:connect(function() onButton1Down(Mouse) end)
  642. Mouse.Button1Up:connect(function() onButton1Up(Mouse) end)
  643. Mouse.KeyDown:connect(function(Key) onKeyDown(Key, Mouse) end)
  644. CanUse = true
  645. end
  646.  
  647.  
  648. function onDeselected(Mouse)
  649. if Selected == false or Primed == true then return end
  650. Selected = false
  651. while CanUse == false do wait() end
  652. if Selected == true then return end
  653. CanUse = false
  654. SetSpeed(1, 0.1, Player.Character)
  655. SetAngle(1, 0, Player.Character)
  656. wait(0.5)
  657. RemoveParts(Player.Character, 2)
  658. CreateParts(Player.Character, 1)
  659. ResetLimbCFrame(1, Player.Character)
  660. DisableLimb(1, Player.Character)
  661. EnableLimb(1, Player.Character)
  662. CanUse = true
  663. end
  664.  
  665.  
  666. if script.Parent.ClassName ~= "HopperBin" then
  667. if Player == nil then print("Error: Player not found!") return end
  668. Tool = Instance.new("HopperBin")
  669. Tool.Name = ModelName
  670. Tool.Parent = Player.Backpack
  671. Instance.new("IntValue", script).Name = "Magazine"
  672. script.Name = "Main"
  673. script.Parent = Tool
  674. elseif script.Parent.ClassName == "HopperBin" and Connected == false then
  675. Connected = true
  676. Player = script.Parent.Parent.Parent
  677. if Player.Backpack:FindFirstChild("Ammo") == nil then
  678. Instance.new("Configuration", Player.Backpack).Name = "Ammo"
  679. end
  680. if Player.Backpack.Ammo:FindFirstChild(AmmoType) == nil then
  681. Instance.new("IntValue", Player.Backpack.Ammo).Name = AmmoType
  682. Player.Backpack.Ammo[AmmoType].Value = 200 * 2
  683. end
  684. script.Parent.Selected:connect(onSelected)
  685. script.Parent.Deselected:connect(onDeselected)
  686. CreateParts(Player.Character, 1)
  687. coroutine.wrap(loadstring(FirstPerson))()
  688. coroutine.wrap(loadstring(MouseAim))()
  689. coroutine.wrap(loadstring(AmmoCounter))()
  690. end
Add Comment
Please, Sign In to add comment