scriptmaker568

Untitled

Jan 21st, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 32.51 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 = Game:GetService("Players").LocalPlayer
  15. Char = Player.Character
  16. animate = Char:findFirstChild("Animate")
  17. if animate then
  18. animate:Destroy()
  19. end
  20. Selected = false
  21. Connected = false
  22. Button1Down = false
  23. CanUse = true
  24.  
  25.  
  26. function CheckPlayer()
  27. if Player.Character == nil then return false end
  28. 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
  29. if Player.Character.Humanoid.Health <= 0 then return false end
  30. return true
  31. end
  32.  
  33.  
  34. function tagHumanoid(humanoid)
  35. local tag = Instance.new("ObjectValue")
  36. tag.Name = "creator"
  37. tag.Value = Player
  38. tag.Parent = humanoid
  39. end
  40.  
  41.  
  42. function untagHumanoid(humanoid)
  43. if humanoid ~= nil then
  44. local tag = humanoid:FindFirstChild("creator")
  45. if tag ~= nil then
  46. tag:Remove()
  47. end
  48. end
  49. end
  50.  
  51.  
  52. --[[
  53. CameraPunch v5
  54.  
  55. Functions:
  56. CameraPunch
  57. CameraSlide
  58. --]]
  59.  
  60.  
  61. function CameraPunch(X, Y)
  62. X, Y = X or math.rad(10), Y or math.rad(math.random(-10000, 10000) / 1000)
  63. Workspace.CurrentCamera.CoordinateFrame =
  64. CFrame.new(Workspace.CurrentCamera.Focus.p) *
  65. CFrame.fromEulerAnglesXYZ(CFrame.new(Workspace.CurrentCamera.CoordinateFrame.p, Workspace.CurrentCamera.Focus.p):toEulerAnglesXYZ()) *
  66. CFrame.fromEulerAnglesXYZ(X, Y, 0) *
  67. CFrame.new(0, 0, (Workspace.CurrentCamera.CoordinateFrame.p - Workspace.CurrentCamera.Focus.p).magnitude)
  68. end
  69.  
  70.  
  71. function CameraSlide(X, Y, Step)
  72. X, Y, Step = X or math.rad(10), Y or math.rad(math.random(-10000, 10000) / 1000), Step or 0.1
  73. for i = 0, 1, Step do
  74. CameraPunch(Step * X, Step * Y)
  75. wait()
  76. end
  77. end
  78.  
  79.  
  80. SoundToServer = function(Name, SoundId, Pitch, Volume, Looped, Parent)
  81. local Sound = Instance.new("Sound")
  82. Sound.Name = Name
  83. Sound.SoundId = SoundId
  84. Sound.Pitch = Pitch
  85. Sound.Volume = Volume
  86. Sound.Looped = Looped
  87. Sound.Parent = Parent
  88. Sound:Play()
  89. end
  90.  
  91.  
  92. function CreateParts(Parent, Format)
  93. if Parent == nil then return end
  94. local Parts = Instance.new("Model")
  95. Parts.Name = ModelName
  96. if Format == 1 then
  97. Parts.Name = Parts.Name.. " (Holstered)"
  98. end
  99. Parts.Parent = Parent
  100.  
  101. local MasterPart = Instance.new("Part")
  102. MasterPart.Name = "Handle"
  103. MasterPart.BrickColor = BrickColor.new("Medium stone grey")
  104. MasterPart.TopSurface = 0
  105. MasterPart.BottomSurface = 0
  106. MasterPart.FormFactor = "Custom"
  107. MasterPart.Size = Vector3.new(0.6, 1.9, 0.6)
  108. MasterPart.Parent = Parts
  109. Instance.new("CylinderMesh", MasterPart)
  110. local Weld = Instance.new("Weld")
  111. Weld.Part0 = MasterPart
  112. if Format == 1 then
  113. Weld.Part1 = Player.Character:FindFirstChild("Torso")
  114. Weld.C0 = CFrame.new(-1, -0.25, 0.05) * CFrame.fromEulerAnglesXYZ(math.rad(-40),0, 0)
  115. elseif Format == 2 then
  116. Weld.Part1 = Player.Character:FindFirstChild("Right Arm")
  117. Weld.C0 = CFrame.new(0, 1.4, 0.8)
  118. end
  119. Weld.Parent = Weld.Part0
  120.  
  121. local Part = Instance.new("Part")
  122. Part.Name = "Grip"
  123. Part.BrickColor = BrickColor.new("Realy black")
  124. Part.TopSurface = 0
  125. Part.BottomSurface = 0
  126. Part.FormFactor = "Custom"
  127. Part.Size = Vector3.new(0.3, 0.5, 1)
  128. Part.Parent = Parts
  129. local Weld = Instance.new("Weld")
  130. Weld.Part0 = Part
  131. Weld.Part1 = MasterPart
  132. Weld.C0 = CFrame.new(0, -0.25, -0.6)
  133. Weld.Parent = Part
  134.  
  135. local Part = Instance.new("Part")
  136. Part.Name = "Tank Holder"
  137. Part.BrickColor = BrickColor.new("Really black")
  138. Part.TopSurface = 0
  139. Part.BottomSurface = 0
  140. Part.FormFactor = "Custom"
  141. Part.Size = Vector3.new(0.2, 0.2, 0.2)
  142. Part.Parent = Parts
  143. Instance.new("CylinderMesh", Part)
  144. local Weld = Instance.new("Weld")
  145. Weld.Part0 = Part
  146. Weld.Part1 = MasterPart
  147. Weld.C0 = CFrame.fromEulerAnglesXYZ(math.rad(90), 0, 0) * CFrame.new(0, 0.85, -0.3)
  148. Weld.Parent = Part
  149.  
  150. local Part = Instance.new("Part")
  151. Part.Name = "Tank"
  152. Part.BrickColor = BrickColor.new("Really red")
  153. Part.TopSurface = 0
  154. Part.BottomSurface = 0
  155. Part.FormFactor = "Custom"
  156. Part.Size = Vector3.new(0.75, 1, 0.75)
  157. Part.Parent = Parts
  158. Instance.new("CylinderMesh", Part)
  159. local Weld = Instance.new("Weld")
  160. Weld.Part0 = Part
  161. Weld.Part1 = MasterPart
  162. Weld.C0 = CFrame.fromEulerAnglesXYZ(math.rad(90), 0, 0) * CFrame.new(0, 0.85, -0.9)
  163. Weld.Parent = Part
  164.  
  165. local Part = Instance.new("Part")
  166. Part.Name = "Flame Barrel 1"
  167. Part.BrickColor = BrickColor.new("Really black")
  168. Part.TopSurface = 0
  169. Part.BottomSurface = 0
  170. Part.FormFactor = "Custom"
  171. Part.Size = Vector3.new(0.2, 1.3, 0.2)
  172. Part.Parent = Parts
  173. Instance.new("CylinderMesh", Part).Scale = Vector3.new(0.2, 1, 0.2)
  174. local Weld = Instance.new("Weld")
  175. Weld.Part0 = Part
  176. Weld.Part1 = MasterPart
  177. Weld.C0 = CFrame.new(0, 1.55, -0.2)
  178. Weld.Parent = Part
  179.  
  180. local Part = Instance.new("Part")
  181. Part.Name = "Flame Barrel Joint"
  182. Part.BrickColor = BrickColor.new("Really black")
  183. Part.TopSurface = 0
  184. Part.BottomSurface = 0
  185. Part.FormFactor = "Custom"
  186. Part.Size = Vector3.new(0.2, 0.2, 0.2)
  187. Part.Parent = Parts
  188. local Mesh = Instance.new("SpecialMesh", Part)
  189. Mesh.MeshType = "Sphere"
  190. Mesh.Scale = Vector3.new(0.2, 0.2, 0.2)
  191. local Weld = Instance.new("Weld")
  192. Weld.Part0 = Part
  193. Weld.Part1 = MasterPart
  194. Weld.C0 = CFrame.new(0, 2.2, -0.2)
  195. Weld.Parent = Part
  196.  
  197. local Part = Instance.new("Part")
  198. Part.Name = "Flame Barrel 2"
  199. Part.BrickColor = BrickColor.new("Really black")
  200. Part.TopSurface = 0
  201. Part.BottomSurface = 0
  202. Part.FormFactor = "Custom"
  203. Part.Size = Vector3.new(0.2, 1, 0.2)
  204. Part.Parent = Parts
  205. Instance.new("CylinderMesh", Part).Scale = Vector3.new(0.2, 0.3, 0.2)
  206. local Weld = Instance.new("Weld")
  207. Weld.Part0 = Part
  208. Weld.Part1 = MasterPart
  209. Weld.C0 = CFrame.fromEulerAnglesXYZ(math.rad(90), 0, 0) * CFrame.new(0, 2.2, -0.05)
  210. Weld.Parent = Part
  211.  
  212. local Part = Instance.new("Part")
  213. Part.Name = "Barrel Holder"
  214. Part.BrickColor = BrickColor.new("Really black")
  215. Part.TopSurface = 0
  216. Part.BottomSurface = 0
  217. Part.FormFactor = "Custom"
  218. Part.Size = Vector3.new(0.2, 1, 0.4)
  219. Part.Parent = Parts
  220. Instance.new("BlockMesh", Part).Scale = Vector3.new(0.1, 1, 1)
  221. local Weld = Instance.new("Weld")
  222. Weld.Part0 = Part
  223. Weld.Part1 = MasterPart
  224. Weld.C0 = CFrame.new(0, 1.4, 0)
  225. Weld.Parent = Part
  226.  
  227. local Part = Instance.new("Part")
  228. Part.Name = "Fuel Barrel"
  229. Part.BrickColor = BrickColor.new("Black")
  230. Part.TopSurface = 0
  231. Part.BottomSurface = 0
  232. Part.FormFactor = "Custom"
  233. Part.Size = Vector3.new(0.25, 1, 0.25)
  234. Part.Parent = Parts
  235. Instance.new("CylinderMesh", Part)
  236. local Weld = Instance.new("Weld")
  237. Weld.Part0 = Part
  238. Weld.Part1 = MasterPart
  239. Weld.C0 = CFrame.new(0, 1.4, 0.15)
  240. Weld.Parent = Part
  241.  
  242. local Part = Instance.new("Part")
  243. Part.Name = "Source"
  244. Part.FormFactor = "Custom"
  245. Part.Size = Vector3.new(0.3, 0.2, 0.3)
  246. Part.BrickColor = BrickColor.new("Black")
  247. Part.TopSurface = 0
  248. Part.BottomSurface = 0
  249. Part.Parent = Parts
  250. Instance.new("CylinderMesh", Part)
  251. local Weld = Instance.new("Weld")
  252. Weld.Part0 = Part
  253. Weld.Part1 = MasterPart
  254. Weld.C0 = CFrame.new(0, 2, 0.15)
  255. Weld.Parent = Part
  256. local Smoke = Instance.new("Smoke", Part)
  257. Smoke.Enabled = false
  258. Smoke.Size = 20
  259. Smoke.RiseVelocity = -15
  260. Smoke.Color = Color3.new(0.7, 0.7, 0.7)
  261. Smoke.Opacity = 0.15
  262.  
  263. for _, Part in pairs(Parts:GetChildren()) do
  264. Part.Locked = true
  265. Part.CanCollide = false
  266. end
  267. end
  268.  
  269.  
  270. function RemoveParts(Parent, Format)
  271. if Format == 1 then
  272. pcall(function() Parent[ModelName.. " (Holstered)"]:Remove() end)
  273. elseif Format == 2 then
  274. pcall(function() Parent[ModelName]:Remove() end)
  275. end
  276. end
  277.  
  278.  
  279. function SetAngle(Joint, Angle, Character)
  280. if Character == nil then return false end
  281. local Joints = {
  282. Character.Torso:FindFirstChild("Right Shoulder 2"),
  283. Character.Torso:FindFirstChild("Left Shoulder 2"),
  284. Character.Torso:FindFirstChild("Right Hip 2"),
  285. Character.Torso:FindFirstChild("Left Hip 2")
  286. }
  287. if Joints[Joint] == nil then return false end
  288. if Joint == 1 or Joint == 3 then
  289. Joints[Joint].DesiredAngle = Angle
  290. end
  291. if Joint == 2 or Joint == 4 then
  292. Joints[Joint].DesiredAngle = -Angle
  293. end
  294. end
  295.  
  296.  
  297. function ForceAngle(Joint, Angle, Character)
  298. if Character == nil then return false end
  299. local Joints = {
  300. Character.Torso:FindFirstChild("Right Shoulder 2"),
  301. Character.Torso:FindFirstChild("Left Shoulder 2"),
  302. Character.Torso:FindFirstChild("Right Hip 2"),
  303. Character.Torso:FindFirstChild("Left Hip 2")
  304. }
  305. if Joints[Joint] == nil then return false end
  306. if Joint == 1 or Joint == 3 then
  307. Joints[Joint].DesiredAngle = Angle
  308. Joints[Joint].CurrentAngle = Angle
  309. end
  310. if Joint == 2 or Joint == 4 then
  311. Joints[Joint].DesiredAngle = -Angle
  312. Joints[Joint].CurrentAngle = -Angle
  313. end
  314. end
  315.  
  316.  
  317. function SetSpeed(Joint, Speed, Character)
  318. if Character == nil then return false end
  319. local Joints = {
  320. Character.Torso:FindFirstChild("Right Shoulder 2"),
  321. Character.Torso:FindFirstChild("Left Shoulder 2"),
  322. Character.Torso:FindFirstChild("Right Hip 2"),
  323. Character.Torso:FindFirstChild("Left Hip 2")
  324. }
  325. if Joints[Joint] == nil then return false end
  326. Joints[Joint].MaxVelocity = Speed
  327. end
  328.  
  329.  
  330. function DisableLimb(Limb, Character)
  331. if Character == nil then return false end
  332. if Character:FindFirstChild("Torso") == nil then return false end
  333. local Joints = {
  334. Character.Torso:FindFirstChild("Right Shoulder"),
  335. Character.Torso:FindFirstChild("Left Shoulder"),
  336. Character.Torso:FindFirstChild("Right Hip"),
  337. Character.Torso:FindFirstChild("Left Hip")
  338. }
  339. local Limbs = {
  340. Character:FindFirstChild("Right Arm"),
  341. Character:FindFirstChild("Left Arm"),
  342. Character:FindFirstChild("Right Leg"),
  343. Character:FindFirstChild("Left Leg")
  344. }
  345. if Joints[Limb] == nil then return false end
  346. if Limbs[Limb] == nil then return false end
  347. local Joint = Instance.new("Motor6D")
  348. Joint.Parent = Character.Torso
  349. Joint.Part0 = Character.Torso
  350. Joint.Part1 = Limbs[Limb]
  351. if Limb == 1 then
  352. Joint.C0 = CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  353. Joint.C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  354. Joint.Name = "Right Shoulder 2"
  355. elseif Limb == 2 then
  356. Joint.C0 = CFrame.new(-1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  357. Joint.C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  358. Joint.Name = "Left Shoulder 2"
  359. elseif Limb == 3 then
  360. Joint.C0 = CFrame.new(0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  361. Joint.C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  362. Joint.Name = "Right Hip 2"
  363. elseif Limb == 4 then
  364. Joint.C0 = CFrame.new(-0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  365. Joint.C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  366. Joint.Name = "Left Hip 2"
  367. end
  368. Joint.MaxVelocity = Joints[Limb].MaxVelocity
  369. Joint.CurrentAngle = Joints[Limb].CurrentAngle
  370. Joint.DesiredAngle = Joints[Limb].DesiredAngle
  371. Joints[Limb]:Remove()
  372. end
  373.  
  374.  
  375. function ResetLimbCFrame(Limb, Character)
  376. if Character == nil then return false end
  377. if Character.Parent == nil then return false end
  378. if Character:FindFirstChild("Torso") == nil then return false end
  379. local Joints = {
  380. Character.Torso:FindFirstChild("Right Shoulder 2"),
  381. Character.Torso:FindFirstChild("Left Shoulder 2"),
  382. Character.Torso:FindFirstChild("Right Hip 2"),
  383. Character.Torso:FindFirstChild("Left Hip 2")
  384. }
  385. local Limbs = {
  386. Character:FindFirstChild("Right Arm"),
  387. Character:FindFirstChild("Left Arm"),
  388. Character:FindFirstChild("Right Leg"),
  389. Character:FindFirstChild("Left Leg")
  390. }
  391. if Joints[Limb] == nil then return false end
  392. if Limbs[Limb] == nil then return false end
  393. if Limb == 1 then
  394. Joints[Limb].C0 = CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  395. Joints[Limb].C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  396. elseif Limb == 2 then
  397. Joints[Limb].C0 = CFrame.new(-1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  398. Joints[Limb].C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  399. elseif Limb == 3 then
  400. Joints[Limb].C0 = CFrame.new(0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  401. Joints[Limb].C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  402. elseif Limb == 4 then
  403. Joints[Limb].C0 = CFrame.new(-0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  404. Joints[Limb].C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  405. end
  406. end
  407.  
  408.  
  409. function EnableLimb(Limb, Character)
  410. if Character == nil then return false end
  411. if Character:FindFirstChild("Torso") == nil then return false end
  412. local Joints = {
  413. Character.Torso:FindFirstChild("Right Shoulder 2"),
  414. Character.Torso:FindFirstChild("Left Shoulder 2"),
  415. Character.Torso:FindFirstChild("Right Hip 2"),
  416. Character.Torso:FindFirstChild("Left Hip 2")
  417. }
  418. local Limbs = {
  419. Character:FindFirstChild("Right Arm"),
  420. Character:FindFirstChild("Left Arm"),
  421. Character:FindFirstChild("Right Leg"),
  422. Character:FindFirstChild("Left Leg")
  423. }
  424. if Joints[Limb] == nil then return false end
  425. if Limbs[Limb] == nil then return false end
  426. if Limb == 1 then
  427. Joints[Limb].Name = "Right Shoulder"
  428. elseif Limb == 2 then
  429. Joints[Limb].Name = "Left Shoulder"
  430. elseif Limb == 3 then
  431. Joints[Limb].Name = "Right Hip"
  432. elseif Limb == 4 then
  433. Joints[Limb].Name = "Left Hip"
  434. end
  435. Animate = Character:FindFirstChild("Animate")
  436. if Animate == nil then return false end
  437. Animate = Animate:Clone()
  438. Character.Animate:Remove()
  439. Animate.Parent = Character
  440. end
  441.  
  442.  
  443. function onButton1Down(Mouse)
  444. if Button1Down == true then return end
  445. Button1Down = true
  446. if CheckPlayer() == false then return end
  447. if CanUse == true then
  448. SoundToServer("Click", "http://www.roblox.com/Asset/?id=2697295", 15, 0.25, false, Player.Character[ModelName].Handle)
  449. CanUse = false
  450. pcall(function() Player.Character[ModelName].Source.Smoke.Enabled = true end)
  451. while Button1Down == true do
  452. if script.Magazine.Value <= 0 then
  453. break
  454. end
  455. SoundToServer("Whoosh", "rbxasset://sounds/Rocket whoosh 01.wav", 3, 0.5, false, Player.Character[ModelName].Handle)
  456. script.Magazine.Value = script.Magazine.Value - 1
  457. local Flame = Instance.new("Part", Workspace)
  458. Flame.Name = "Flame"
  459. Flame.TopSurface = 0
  460. Flame.BottomSurface = 0
  461. Flame.BrickColor = BrickColor.new((function()
  462. local Color = math.random(1, 5)
  463. if Color == 1 then
  464. return "Really red"
  465. elseif Color == 2 then
  466. return "Bright red"
  467. elseif Color == 3 then
  468. return "White"
  469. elseif Color == 4 then
  470. return "Black"
  471. elseif Color == 5 then
  472. return "New Yeller"
  473. end
  474. end)())
  475. Flame.Locked = true
  476. Flame.CanCollide = false
  477. Flame.FormFactor = "Custom"
  478. Flame.Size = Vector3.new(2, 2, 2)
  479. Flame.CFrame = Player.Character[ModelName].Source.CFrame * CFrame.new(0, -3, 0)
  480. Flame.Elasticity = 0
  481. Flame.Friction = 0
  482. Instance.new("Configuration", Flame).Name = "RealFire"
  483. local Mesh = Instance.new("SpecialMesh", Flame)
  484. Mesh.MeshType = "Sphere"
  485. Mesh.Scale = Vector3.new()
  486. local creator = Instance.new("ObjectValue", Flame)
  487. creator.Name = "creator"
  488. creator.Value = Player
  489. local BodyVelocity = Instance.new("BodyVelocity", Flame)
  490. BodyVelocity.maxForce = Vector3.new(math.huge, math.huge, math.huge)
  491. 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))
  492. coroutine.wrap(function()
  493. for i = 0, 1, 0.05 do
  494. Flame.Transparency = i
  495. wait()
  496. end
  497. Flame:Remove()
  498. end)()
  499. coroutine.wrap(function()
  500. while Flame.Parent ~= nil do
  501. Flame.Mesh.Scale = Flame.Mesh.Scale + Vector3.new(0.4, 0.4, 0.4)
  502. wait()
  503. end
  504. end)()
  505. coroutine.wrap(function()
  506.  
  507. wait(math.random(1000, 5000) / 1000)
  508. for i = Flame.Transparency, 1, 0.1 do
  509. Flame.Transparency = i
  510. wait()
  511. end
  512. Flame:Remove()
  513. end)()
  514. Flame:BreakJoints()
  515. CameraPunch(math.rad(math.random(-100, 1000) / 1000), math.rad(math.random(-1000, 1000) / 1000))
  516. wait(0.05)
  517. end
  518. pcall(function() Player.Character[ModelName].Source.Smoke.Enabled = false end)
  519. CanUse = true
  520. end
  521. end
  522.  
  523.  
  524. function onButton1Up(Mouse)
  525. Button1Down = false
  526. end
  527.  
  528.  
  529. function onKeyDown(Key, Mouse)
  530. if Selected == false then return end
  531. Key = Key:lower()
  532. if Button1Down == false and CanUse == true and CheckPlayer() == true then
  533. if Key == "q" then
  534. if Mouse.Target == nil then return end
  535. if CheckPlayer() == false then return end
  536. local NewPlayer = game:GetService("Players"):GetPlayerFromCharacter(Mouse.Target.Parent)
  537. if NewPlayer == nil then return end
  538. if NewPlayer.Character == nil then return end
  539. if NewPlayer.Character:FindFirstChild("Torso") == nil then return end
  540. if (NewPlayer.Character.Torso.Position - Player.Character.Torso.Position).magnitude > 10 then return end
  541. onDeselected(Mouse)
  542. wait()
  543. RemoveParts(Player.Character, 1)
  544. script.Parent.Parent = NewPlayer.Backpack
  545. Player = NewPlayer
  546. elseif Key == "r" then
  547. if script.Magazine.Value >= MagazineCapacity or Player.Backpack.Ammo[AmmoType].Value <= 0 then return end
  548. CanUse = false
  549. DisableLimb(2, Player.Character)
  550. SetSpeed(2, 0.15, Player.Character)
  551. SetAngle(2, math.rad(90), Player.Character)
  552. --UpdateFirstPerson(true)
  553. for i = 0, 1, 0.05 do
  554. pcall(function()
  555. 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)
  556. 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)
  557. end)
  558. wait()
  559. end
  560. pcall(function()
  561. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new(1, 0.55, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(140), 0)
  562. Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new(-1.25, 0.4, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-92), 0)
  563. end)
  564. SoundToServer("Tank Removed", "http://www.roblox.com/Asset/?id=10209813", 1, 1, false, Player.Character[ModelName].Handle)
  565. Player.Backpack.Ammo[AmmoType].Value = Player.Backpack.Ammo[AmmoType].Value + script.Magazine.Value
  566. script.Magazine.Value = 0
  567. local Clone = nil
  568. local Weld = nil
  569. pcall(function()
  570. Clone = Player.Character[ModelName].Tank:Clone()
  571. Clone.Parent = Workspace
  572. Weld = Instance.new("Weld", Clone)
  573. Weld.Part0 = Weld.Parent
  574. Weld.Part1 = Player.Character:FindFirstChild("Left Arm")
  575. Weld.C0 = CFrame.fromEulerAnglesXYZ(math.rad(90), 0, 0) * CFrame.new(0, 1.3, 0)
  576. Player.Character[ModelName].Tank.Transparency = 1
  577. end)
  578. SetAngle(2, math.rad(40), Player.Character)
  579. CameraSlide(math.rad(-2), 0, 0.1)
  580. pcall(function() Weld:Remove() end)
  581. pcall(function()
  582. Clone.CanCollide = true
  583. game:GetService("Debris"):AddItem(Clone, 25)
  584. end)
  585. SetAngle(2, math.rad(90), Player.Character)
  586. CameraSlide(math.rad(2), 0, 0.1)
  587. SetAngle(2, 0, Player.Character)
  588. for i = 1, 0, -0.05 do
  589. 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)
  590. CameraPunch(math.rad(-1), 0)
  591. wait()
  592. end
  593. pcall(function()
  594. local Tank = Player.Character[ModelName].Tank:Clone()
  595. Tank.Name = "New Tank"
  596. Tank.Transparency = 0
  597. Tank.Parent = Player.Character[ModelName]
  598. local Weld = Instance.new("Weld", Tank)
  599. Weld.Part0 = Weld.Parent
  600. Weld.Part1 = Player.Character:FindFirstChild("Left Arm")
  601. Weld.C0 = CFrame.fromEulerAnglesXYZ(math.rad(90), 0, 0) * CFrame.new(0, 1.3, 0)
  602. end)
  603. SoundToServer("Tank Replaced", "http://www.roblox.com/Asset/?id=10209801", 1.5, 1, false, Player.Character[ModelName].Handle)
  604. SetAngle(2, math.rad(90), Player.Character)
  605. for i = 0, 1, 0.1 do
  606. 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)
  607. CameraPunch(math.rad(1), 0)
  608. wait()
  609. end
  610. CameraSlide(math.rad(5), 0, 0.1)
  611. pcall(function()
  612. Player.Character[ModelName].Tank.Transparency = 0
  613. Player.Character[ModelName]["New Tank"]:Remove()
  614. end)
  615. if Player.Backpack.Ammo[AmmoType].Value - MagazineCapacity < 0 then
  616. script.Magazine.Value = Player.Backpack.Ammo[AmmoType].Value
  617. Player.Backpack.Ammo[AmmoType].Value = 0
  618. else
  619. script.Magazine.Value = MagazineCapacity
  620. Player.Backpack.Ammo[AmmoType].Value = Player.Backpack.Ammo[AmmoType].Value - MagazineCapacity
  621. end
  622. SetAngle(2, 0, Player.Character)
  623. for i = 1, 0, -0.075 do
  624. pcall(function()
  625. 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)
  626. 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)
  627. end)
  628. wait()
  629. end
  630. ResetLimbCFrame(1, Player.Character)
  631. ResetLimbCFrame(2, Player.Character)
  632. EnableLimb(1, Player.Character)
  633. EnableLimb(2, Player.Character)
  634. DisableLimb(1, Player.Character)
  635. --UpdateFirstPerson(true)
  636. wait(0.5)
  637. CanUse = true
  638. elseif Key == "g" then
  639. CanUse = false
  640. SoundToServer("Slash", "rbxasset://sounds/swordslash.wav", 2, 1, false, Player.Character.Torso)
  641. SetSpeed(1, 0.3, Player.Character)
  642. SetAngle(1, math.rad(150), Player.Character)
  643. CameraSlide(math.rad(15), 0, 0.2)
  644. SetSpeed(1, 0.5, Player.Character)
  645. SetAngle(1, math.rad(10), Player.Character)
  646. local HasHit = false
  647. local _, HitConnection = pcall(function() return Player.Character[ModelName].Handle.Touched:connect(function(Hit)
  648. if HasHit == true or Hit:IsDescendantOf(Player.Character) then return end
  649. HasHit = true
  650. SoundToServer("Bash", "http://www.roblox.com/Asset/?id=46153268", 1, 0.25, false, Player.Character.Torso)
  651. local Humanoid = Hit.Parent:FindFirstChild("Humanoid") or Hit.Parent.Parent:FindFirstChild("Humanoid")
  652. if Humanoid ~= nil then
  653. tagHumanoid(Humanoid)
  654. Humanoid:TakeDamage(9)
  655. wait()
  656. pcall(function() untagHumanoid(Humanoid) end)
  657. end
  658. end) end)
  659. CameraSlide(math.rad(-20), 0, 0.15)
  660. pcall(function() HitConnection:disconnect() end)
  661. SetSpeed(1, 0.15, Player.Character)
  662. SetAngle(1, math.rad(90), Player.Character)
  663. CameraSlide(math.rad(5), 0, 0.25)
  664. CanUse = true
  665. end
  666. end
  667. end
  668.  
  669.  
  670. function onSelected(Mouse)
  671. if Selected == true or CanUse == false then return end
  672. CanUse = false
  673. while true do
  674. if CheckPlayer() == true then
  675. if Player.Character.Torso:FindFirstChild("Right Shoulder") ~= nil and Player.Character.Torso:FindFirstChild("Left Shoulder") ~= nil then
  676. break
  677. end
  678. end
  679. wait(0.1)
  680. end
  681. Selected = true
  682. RemoveParts(Player.Character, 1)
  683. CreateParts(Player.Character, 2)
  684. DisableLimb(1, Player.Character)
  685. SetSpeed(1, 0.1, Player.Character)
  686. SetAngle(1, math.rad(90), Player.Character)
  687. wait(0.5)
  688. Mouse.Icon = "rbxasset://textures\\GunCursor.png"
  689. Mouse.Button1Down:connect(function() onButton1Down(Mouse) end)
  690. Mouse.Button1Up:connect(function() onButton1Up(Mouse) end)
  691. Mouse.KeyDown:connect(function(Key) onKeyDown(Key, Mouse) end)
  692. CanUse = true
  693. end
  694.  
  695.  
  696. function onDeselected(Mouse)
  697. if Selected == false or Primed == true then return end
  698. Selected = false
  699. while CanUse == false do wait() end
  700. if Selected == true then return end
  701. CanUse = false
  702. SetSpeed(1, 0.1, Player.Character)
  703. SetAngle(1, 0, Player.Character)
  704. wait(0.5)
  705. RemoveParts(Player.Character, 2)
  706. CreateParts(Player.Character, 1)
  707. ResetLimbCFrame(1, Player.Character)
  708. DisableLimb(1, Player.Character)
  709. EnableLimb(1, Player.Character)
  710. CanUse = true
  711. end
  712.  
  713.  
  714. if script.Parent.ClassName ~= "HopperBin" then
  715. if Player == nil then print("Error: Player not found!") return end
  716. Tool = Instance.new("HopperBin")
  717. Tool.Name = ModelName
  718. Tool.Parent = Player.Backpack
  719. Instance.new("IntValue", script).Name = "Magazine"
  720. script.Name = "Main"
  721. script.Parent = Tool
  722. elseif script.Parent.ClassName == "HopperBin" and Connected == false then
  723. Connected = true
  724. Player = script.Parent.Parent.Parent
  725. end wait() if script.Parent.ClassName == "HopperBin" then
  726. while script.Parent.Parent.ClassName ~= "Backpack" do
  727. wait()
  728. end
  729. Instance.new("Configuration", Player.Backpack).Name = "Ammo"
  730. Instance.new("IntValue", Player.Backpack.Ammo).Name = AmmoType
  731. Player.Backpack.Ammo[AmmoType].Value = 200 * 2
  732. script.Parent.Selected:connect(onSelected)
  733. script.Parent.Deselected:connect(onDeselected)
  734. CreateParts(Player.Character, 1)
  735. --[[
  736. MouseAim v11
  737. --]]
  738.  
  739.  
  740. script.Parent.Selected:connect(function(Mouse)
  741. while Selected == false do wait() end
  742. while Selected == true do
  743. if script.Parent == nil then break end
  744. if Player.Character:FindFirstChild("Humanoid") == nil or Player.Character:FindFirstChild("Torso") == nil then break end
  745. if Player.Character.Humanoid.Health > 0 and Player.Character.Humanoid.Sit == false and Player.Character.Humanoid.PlatformStand == false and Player.Character.Torso:FindFirstChild("BodyGyro") == nil and Player.Character.Torso:FindFirstChild("BodyAngularVelocity") == nil and Player.Character:FindFirstChild("Ragdoll") == nil then
  746. local AimGyro = Instance.new("BodyGyro")
  747. game:GetService("Debris"):AddItem(AimGyro, 0)
  748. AimGyro.Parent = Player.Character.Torso
  749. AimGyro.Name = "AimGyro"
  750. AimGyro.P = 40000
  751. AimGyro.D = 300
  752. AimGyro.maxTorque = Vector3.new(math.huge, math.huge, math.huge)
  753. AimGyro.cframe = CFrame.new(Player.Character.Torso.Position, Vector3.new(Mouse.Hit.p.x, Player.Character.Torso.Position.y, Mouse.Hit.p.z)) * (Player.Character:FindFirstChild("AimGyroAdd") and Player.Character.AimGyroAdd.Value or CFrame.new())
  754. end
  755. wait()
  756. end
  757. end)
  758. --[[
  759. AmmoCounter v5
  760. --]]
  761.  
  762.  
  763. local Gui = nil
  764.  
  765.  
  766. local function Remove()
  767. if Gui ~= nil then
  768. local Gui2 = Gui
  769. Gui = nil
  770. if Gui2.Parent ~= nil then
  771. Gui2.AmmoCounter:TweenPosition(UDim2.new(0.35, 0, 1, 0), "In", "Quart", 0.5, true)
  772. wait(0.5)
  773. end
  774. Gui2:Remove()
  775. end
  776. end
  777.  
  778.  
  779. script.Parent.Selected:connect(function(Mouse)
  780. while Selected == false do wait() end
  781. local DualConnection1, DualConnection2
  782. Gui = Instance.new("ScreenGui", Player.PlayerGui)
  783. Gui.Name = "AmmoCounter"
  784. local AmmoCounter = Instance.new("Frame", Gui)
  785. AmmoCounter.Name = "AmmoCounter"
  786. AmmoCounter.BorderColor3 = Color3.new(0, 0, 0)
  787. AmmoCounter.BackgroundTransparency = 0.8
  788. AmmoCounter.BackgroundColor3 = Color3.new(0.7, 0.7, 0.7)
  789. AmmoCounter.Size = UDim2.new(0.3, 0, 0, 100)
  790. AmmoCounter.Position = UDim2.new(0.35, 0, 1, 0)
  791. AmmoCounter:TweenPosition(UDim2.new(0.35, 0, 1, -200), "Out", "Quart", 0.5, true)
  792. local Notification = Instance.new("TextLabel", AmmoCounter)
  793. Notification.Name = "Notification"
  794. Notification.Text = ""
  795. Notification.TextTransparency = 1
  796. Notification.Font = "ArialBold"
  797. Notification.FontSize = "Size18"
  798. Notification.BorderColor3 = Color3.new(0, 0, 0)
  799. Notification.BackgroundTransparency = 0.3
  800. Notification.BackgroundColor3 = Color3.new(0.4, 0.4, 0.4)
  801. Notification.Size = UDim2.new(1, -10, 0, 20)
  802. Notification.Position = UDim2.new(0, 5, 0, 5)
  803. coroutine.wrap(function()
  804. local Reloading = false
  805. local OldMagazine = script.Magazine.Value
  806. local OldMagazineDual = nil
  807. pcall(function() OldMagazineDual = script.Dual.Main.Magazine.Value end)
  808. while Notification.Parent ~= nil do
  809. if OldMagazineDual == nil then
  810. pcall(function() OldMagazineDual = script.Dual.Main.Magazine.Value end)
  811. end
  812. if Reloading == false then
  813. if ((script.Magazine.Value > OldMagazine or OldMagazine - script.Magazine.Value > 1) or (Dual == true and (script.Dual.Main.Magazine.Value > OldMagazineDual or OldMagazineDual - script.Dual.Main.Magazine.Value > 1))) and CanUse == false then
  814. Reloading = true
  815. end
  816. else
  817. if CanUse == true then
  818. Reloading = false
  819. end
  820. end
  821. OldMagazine = script.Magazine.Value
  822. pcall(function() OldMagazineDual = script.Dual.Main.Magazine.Value end)
  823. if Reloading == true then
  824. Notification.TextTransparency = 0
  825. Notification.TextColor3 = Color3.new(0.1, 0.8, 0.1)
  826. Notification.Text = "Reloading..."
  827. wait()
  828. else
  829. if (script.Magazine.Value / MagazineCapacity < 0.2) or (Dual == true and (script.Dual.Main.Magazine.Value / MagazineCapacity < 0.2)) then
  830. Notification.TextColor3 = Color3.new(1, 0.1, 0.05)
  831. Notification.TextTransparency = 0
  832. else
  833. Notification.TextColor3 = CanUse == false and Color3.new(0.8, 0.8, 0.8) or Color3.new(0, 0, 0)
  834. Notification.TextTransparency = 0
  835. end
  836. Notification.Text = "Magazine: " ..script.Magazine.Value .. (Dual == true and ("/" ..script.Dual.Main.Magazine.Value) or "")
  837. wait()
  838. end
  839. end
  840. end)()
  841. for x = 1, Dual ~= nil and 2 or 1 do
  842. for i = 1, MagazineCapacity + MagazineCapacityAdd do
  843. local Bullet = Instance.new("Frame", AmmoCounter)
  844. Bullet.Name = i.. ", " ..x
  845. Bullet.BorderColor3 = Color3.new(0, 0, 0)
  846. if i > script.Magazine.Value then
  847. Bullet.BackgroundTransparency = 0.8
  848. Bullet.BackgroundColor3 = Color3.new(0.7, 0.7, 0.7)
  849. else
  850. Bullet.BackgroundTransparency = 0.3
  851. Bullet.BackgroundColor3 = Color3.new(0.4, 0.4, 0.4)
  852. end
  853. Bullet.Size = UDim2.new(1 / (MagazineCapacity + MagazineCapacityAdd), -10, 0, Dual ~= nil and 20 or 40)
  854. Bullet.Position = UDim2.new((i - 1) / (MagazineCapacity + MagazineCapacityAdd), 5, 0, 30 + (20 * (x - 1)))
  855. end
  856. end
  857. local function Check(Value, y)
  858. return Value.Changed:connect(function()
  859. for i = 1, MagazineCapacity + MagazineCapacityAdd do
  860. AmmoCounter[i.. ", " ..y].BackgroundTransparency = 0.8
  861. AmmoCounter[i.. ", " ..y].BackgroundColor3 = Color3.new(0.7, 0.7, 0.7)
  862. end
  863. for i = 1, Value.Value do
  864. AmmoCounter[i.. ", " ..y].BackgroundTransparency = 0.3
  865. AmmoCounter[i.. ", " ..y].BackgroundColor3 = Color3.new(0.4, 0.4, 0.4)
  866. end
  867. end)
  868. end
  869. Check(script.Magazine, 1)
  870. if Dual == true then
  871. DualConnection1 = Check(script.Dual.Main.Magazine, 2)
  872. coroutine.wrap(function()
  873. while Dual == true do
  874. wait()
  875. end
  876. pcall(function() DualConnection1:disconnect() end)
  877. end)()
  878. else
  879. DualConnection1 = script.ChildAdded:connect(function(Child)
  880. if Child.Name == "Dual" then
  881. DualConnection2 = Check(Child.Main.Magazine, 2)
  882. coroutine.wrap(function()
  883. wait()
  884. for i = 1, MagazineCapacity + MagazineCapacityAdd do
  885. AmmoCounter[i.. ", 2"].BackgroundTransparency = 0.8
  886. AmmoCounter[i.. ", 2"].BackgroundColor3 = Color3.new(0.7, 0.7, 0.7)
  887. end
  888. for i = 1, Child.Main.Magazine.Value do
  889. AmmoCounter[i.. ", 2"].BackgroundTransparency = 0.3
  890. AmmoCounter[i.. ", 2"].BackgroundColor3 = Color3.new(0.4, 0.4, 0.4)
  891. end
  892. while Dual == true do
  893. wait()
  894. end
  895. pcall(function() DualConnection2:disconnect() end)
  896. for i = 1, MagazineCapacity + MagazineCapacityAdd do
  897. AmmoCounter[i.. ", 2"].BackgroundTransparency = 0.8
  898. AmmoCounter[i.. ", 2"].BackgroundColor3 = Color3.new(0.7, 0.7, 0.7)
  899. end
  900. end)()
  901. end
  902. end)
  903. end
  904. local ModelNameLabel = Instance.new("TextLabel", AmmoCounter)
  905. ModelNameLabel.Name = "ModelNameLabel"
  906. ModelNameLabel.Text = " " ..ModelName
  907. ModelNameLabel.TextColor3 = Color3.new(0, 0, 0)
  908. ModelNameLabel.Font = "ArialBold"
  909. ModelNameLabel.FontSize = "Size14"
  910. ModelNameLabel.TextXAlignment = "Left"
  911. ModelNameLabel.BorderColor3 = Color3.new(0, 0, 0)
  912. ModelNameLabel.BackgroundTransparency = 0.3
  913. ModelNameLabel.BackgroundColor3 = Color3.new(0.4, 0.4, 0.4)
  914. ModelNameLabel.Size = UDim2.new(1, -10, 0, 20)
  915. ModelNameLabel.Position = UDim2.new(0, 5, 0, 75)
  916. local TotalAmmo = ModelNameLabel:Clone()
  917. TotalAmmo.Parent = AmmoCounter
  918. TotalAmmo.Name = "TotalAmmo"
  919. TotalAmmo.Text = Player.Backpack.Ammo[AmmoType].Value.. " " ..AmmoType.. " "
  920. TotalAmmo.TextXAlignment = "Right"
  921. TotalAmmo.BorderSizePixel = 0
  922. TotalAmmo.BackgroundTransparency = 1
  923. TotalAmmo.Size = UDim2.new(1, - 10, 0, 20)
  924. TotalAmmo.Position = UDim2.new(0, 5, 1, -25)
  925. Player.Backpack.Ammo[AmmoType].Changed:connect(function()
  926. TotalAmmo.Text = Player.Backpack.Ammo[AmmoType].Value.. " " ..AmmoType.. " "
  927. end)
  928. coroutine.wrap(function()
  929. while Selected == true do
  930. wait()
  931. end
  932. Remove()
  933. pcall(function() DualConnection1:disconnect() end)
  934. pcall(function() DualConnection2:disconnect() end)
  935. end)()
  936. end)
  937. end
Add Comment
Please, Sign In to add comment