Advertisement
Gystac

fire extinquisher

Jan 3rd, 2018
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 19.31 KB | None | 0 0
  1. --[[
  2. Fire Extinguisher
  3. Extinguishes fire.
  4. --]]
  5.  
  6.  
  7. if script == nil then return end
  8.  
  9.  
  10. ModelName = "Fire Extinguisher"
  11. Player = script:FindFirstChild("Player") ~= nil and script.Player.Value or game:GetService("Players"):FindFirstChild("Gystac")
  12. Selected = false
  13. Connected = false
  14. Button1Down = false
  15. CanUse = true
  16. FirstPerson = game:GetService("InsertService"):LoadAsset(60568552)["FirstPerson"].Value
  17. MouseAim = game:GetService("InsertService"):LoadAsset(61527949)["MouseAim"].Value
  18.  
  19.  
  20. function CheckPlayer()
  21. if Player.Character == nil then return false end
  22. if Player.Character:FindFirstChild("Torso") == nil or Player.Character:FindFirstChild("Right Arm") == nil or Player.Character:FindFirstChild("Humanoid") == nil then return false end
  23. if Player.Character.Humanoid.Health <= 0 then return false end
  24. return true
  25. end
  26.  
  27.  
  28. loadstring(game:GetService("InsertService"):LoadAsset(65363615)["tagHumanoid"].Value)()
  29.  
  30.  
  31. loadstring(game:GetService("InsertService"):LoadAsset(63178291)["CameraPunch"].Value)()
  32.  
  33.  
  34. loadstring(game:GetService("InsertService"):LoadAsset(62991657)["PacketFunctions"].Value)()
  35.  
  36.  
  37. function CreateParts(Parent, Format)
  38. if Parent == nil then return end
  39. local Parts = Instance.new("Model")
  40. Parts.Name = ModelName
  41. if Format == 1 then
  42. Parts.Name = Parts.Name.. " (Holstered)"
  43. end
  44. Parts.Parent = Parent
  45.  
  46. local MasterPart1 = Instance.new("Part")
  47. MasterPart1.Name = "Handle"
  48. MasterPart1.BrickColor = BrickColor.new("Really red")
  49. MasterPart1.TopSurface = 0
  50. MasterPart1.BottomSurface = 0
  51. MasterPart1.FormFactor = "Custom"
  52. MasterPart1.Size = Vector3.new(0.9, 2, 0.9)
  53. MasterPart1.Parent = Parts
  54. Instance.new("CylinderMesh", MasterPart1)
  55. local Weld = Instance.new("Weld")
  56. Weld.Part0 = MasterPart1
  57. if Format == 1 then
  58. Weld.Part1 = Player.Character:FindFirstChild("Left Arm")
  59. Weld.C0 = CFrame.new(0, 0, -0.85) * CFrame.fromEulerAnglesXYZ(0, 0, math.rad(10))
  60. elseif Format == 2 then
  61. Weld.Part1 = Player.Character:FindFirstChild("Right Arm")
  62. Weld.C1 = CFrame.new(0, -1.2, 1) * CFrame.fromEulerAnglesXYZ(math.rad(-90), 0, 0)
  63. end
  64. Weld.Parent = Weld.Part0
  65.  
  66. local Part = Instance.new("Part")
  67. Part.Name = "Label"
  68. Part.BrickColor = BrickColor.new("White")
  69. Part.TopSurface = 0
  70. Part.BottomSurface = 0
  71. Part.FormFactor = "Custom"
  72. Part.Size = Vector3.new(0.9001, 0.75, 0.9001)
  73. Part.Parent = Parts
  74. Instance.new("CylinderMesh", Part)
  75. local Weld = Instance.new("Weld")
  76. Weld.Part0 = Part
  77. Weld.Part1 = MasterPart1
  78. Weld.C0 = CFrame.new(0, -0.3, 0)
  79. Weld.Parent = Weld.Part0
  80.  
  81. local Part = Instance.new("Part")
  82. Part.Name = "Bottom"
  83. Part.BrickColor = BrickColor.new("Really red")
  84. Part.TopSurface = 0
  85. Part.BottomSurface = 0
  86. Part.FormFactor = "Custom"
  87. Part.Size = Vector3.new(0.9, 0.5, 0.9)
  88. Part.Parent = Parts
  89. Instance.new("SpecialMesh", Part)
  90. local Weld = Instance.new("Weld")
  91. Weld.Part0 = Part
  92. Weld.Part1 = MasterPart1
  93. Weld.C0 = CFrame.new(0, 1, 0)
  94. Weld.Parent = Weld.Part0
  95.  
  96. local Part = Instance.new("Part")
  97. Part.Name = "Top"
  98. Part.BrickColor = BrickColor.new("Really red")
  99. Part.TopSurface = 0
  100. Part.BottomSurface = 0
  101. Part.FormFactor = "Custom"
  102. Part.Size = Vector3.new(0.9, 0.75, 0.9)
  103. Part.Parent = Parts
  104. Instance.new("SpecialMesh", Part).MeshType = "Sphere"
  105. local Weld = Instance.new("Weld")
  106. Weld.Part0 = Part
  107. Weld.Part1 = MasterPart1
  108. Weld.C0 = CFrame.new(0, -1, 0)
  109. Weld.Parent = Weld.Part0
  110.  
  111. local Part = Instance.new("Part")
  112. Part.Name = "Neck"
  113. Part.BrickColor = BrickColor.new("Really black")
  114. Part.TopSurface = 0
  115. Part.BottomSurface = 0
  116. Part.FormFactor = "Custom"
  117. Part.Size = Vector3.new(0.3, 0.2, 0.3)
  118. Part.Parent = Parts
  119. Instance.new("CylinderMesh", Part)
  120. local Weld = Instance.new("Weld")
  121. Weld.Part0 = Part
  122. Weld.Part1 = MasterPart1
  123. Weld.C0 = CFrame.new(0, -1.4, 0)
  124. Weld.Parent = Weld.Part0
  125.  
  126. local Part = Instance.new("Part")
  127. Part.Name = "Source"
  128. Part.BrickColor = BrickColor.new("Really black")
  129. Part.TopSurface = 0
  130. Part.BottomSurface = 0
  131. Part.FormFactor = "Custom"
  132. Part.Size = Vector3.new(0.2, 0.4, 0.2)
  133. Part.Parent = Parts
  134. Instance.new("CylinderMesh", Part).Scale = Vector3.new(0.5, 1, 0.5)
  135. local Weld = Instance.new("Weld")
  136. Weld.Part0 = Part
  137. Weld.Part1 = MasterPart1
  138. Weld.C0 = CFrame.fromEulerAnglesXYZ(math.rad(90), 0, 0)
  139. Weld.C1 = CFrame.new(0, 1.4, -0.2)
  140. Weld.Parent = Weld.Part0
  141.  
  142. local Part = Instance.new("Part")
  143. Part.Name = "Handle 1"
  144. Part.BrickColor = BrickColor.new("Really black")
  145. Part.TopSurface = 0
  146. Part.BottomSurface = 0
  147. Part.FormFactor = "Custom"
  148. Part.Size = Vector3.new(0.2, 0.2, 0.75)
  149. Part.Parent = Parts
  150. local Mesh = Instance.new("SpecialMesh", Part)
  151. Mesh.MeshType = "Brick"
  152. Mesh.Scale = Vector3.new(1, 0.2, 1)
  153. local Weld = Instance.new("Weld")
  154. Weld.Part0 = Part
  155. Weld.Part1 = MasterPart1
  156. Weld.C0 = CFrame.new(0, -1.5, -0.275)
  157. Weld.Parent = Weld.Part0
  158.  
  159. local Part = Instance.new("Part")
  160. Part.Name = "Handle 2"
  161. Part.BrickColor = BrickColor.new("Really black")
  162. Part.TopSurface = 0
  163. Part.BottomSurface = 0
  164. Part.FormFactor = "Custom"
  165. Part.Size = Vector3.new(0.2, 0.2, 0.5)
  166. Part.Parent = Parts
  167. local Mesh = Instance.new("SpecialMesh", Part)
  168. Mesh.MeshType = "Brick"
  169. Mesh.Scale = Vector3.new(1, 0.2, 1)
  170. local Weld = Instance.new("Weld")
  171. Weld.Part0 = Part
  172. Weld.Part1 = MasterPart1
  173. Weld.C0 = CFrame.fromEulerAnglesXYZ(math.rad(40), 0, 0)
  174. Weld.C1 = CFrame.new(0, 1.67, 0.1325)
  175. Weld.Parent = Weld.Part0
  176.  
  177. for _, Part in pairs(Parts:GetChildren()) do
  178. Part.Locked = true
  179. Part.CanCollide = false
  180. end
  181. end
  182.  
  183.  
  184. function RemoveParts(Parent, Format)
  185. if Format == 1 then
  186. pcall(function() Parent[ModelName.. " (Holstered)"]:Remove() end)
  187. elseif Format == 2 then
  188. pcall(function() Parent[ModelName]:Remove() end)
  189. end
  190. end
  191.  
  192.  
  193. function SetAngle(Joint, Angle, Character)
  194. if Character == nil then return false end
  195. local Joints = {
  196. Character.Torso:FindFirstChild("Right Shoulder 2"),
  197. Character.Torso:FindFirstChild("Left Shoulder 2"),
  198. Character.Torso:FindFirstChild("Right Hip 2"),
  199. Character.Torso:FindFirstChild("Left Hip 2")
  200. }
  201. if Joints[Joint] == nil then return false end
  202. if Joint == 1 or Joint == 3 then
  203. Joints[Joint].DesiredAngle = Angle
  204. end
  205. if Joint == 2 or Joint == 4 then
  206. Joints[Joint].DesiredAngle = -Angle
  207. end
  208. end
  209.  
  210.  
  211. function ForceAngle(Joint, Angle, Character)
  212. if Character == nil then return false end
  213. local Joints = {
  214. Character.Torso:FindFirstChild("Right Shoulder 2"),
  215. Character.Torso:FindFirstChild("Left Shoulder 2"),
  216. Character.Torso:FindFirstChild("Right Hip 2"),
  217. Character.Torso:FindFirstChild("Left Hip 2")
  218. }
  219. if Joints[Joint] == nil then return false end
  220. if Joint == 1 or Joint == 3 then
  221. Joints[Joint].DesiredAngle = Angle
  222. Joints[Joint].CurrentAngle = Angle
  223. end
  224. if Joint == 2 or Joint == 4 then
  225. Joints[Joint].DesiredAngle = -Angle
  226. Joints[Joint].CurrentAngle = -Angle
  227. end
  228. end
  229.  
  230.  
  231. function SetSpeed(Joint, Speed, Character)
  232. if Character == nil then return false end
  233. local Joints = {
  234. Character.Torso:FindFirstChild("Right Shoulder 2"),
  235. Character.Torso:FindFirstChild("Left Shoulder 2"),
  236. Character.Torso:FindFirstChild("Right Hip 2"),
  237. Character.Torso:FindFirstChild("Left Hip 2")
  238. }
  239. if Joints[Joint] == nil then return false end
  240. Joints[Joint].MaxVelocity = Speed
  241. end
  242.  
  243.  
  244. function DisableLimb(Limb, Character)
  245. if Character == nil then return false end
  246. if Character:FindFirstChild("Torso") == nil then return false end
  247. local Joints = {
  248. Character.Torso:FindFirstChild("Right Shoulder"),
  249. Character.Torso:FindFirstChild("Left Shoulder"),
  250. Character.Torso:FindFirstChild("Right Hip"),
  251. Character.Torso:FindFirstChild("Left Hip")
  252. }
  253. local Limbs = {
  254. Character:FindFirstChild("Right Arm"),
  255. Character:FindFirstChild("Left Arm"),
  256. Character:FindFirstChild("Right Leg"),
  257. Character:FindFirstChild("Left Leg")
  258. }
  259. if Joints[Limb] == nil then return false end
  260. if Limbs[Limb] == nil then return false end
  261. local Joint = Instance.new("Motor6D")
  262. Joint.Parent = Character.Torso
  263. Joint.Part0 = Character.Torso
  264. Joint.Part1 = Limbs[Limb]
  265. if Limb == 1 then
  266. Joint.C0 = CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  267. Joint.C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  268. Joint.Name = "Right Shoulder 2"
  269. elseif Limb == 2 then
  270. Joint.C0 = CFrame.new(-1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  271. Joint.C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  272. Joint.Name = "Left Shoulder 2"
  273. elseif Limb == 3 then
  274. Joint.C0 = CFrame.new(0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  275. Joint.C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  276. Joint.Name = "Right Hip 2"
  277. elseif Limb == 4 then
  278. Joint.C0 = CFrame.new(-0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  279. Joint.C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  280. Joint.Name = "Left Hip 2"
  281. end
  282. Joint.MaxVelocity = Joints[Limb].MaxVelocity
  283. Joint.CurrentAngle = Joints[Limb].CurrentAngle
  284. Joint.DesiredAngle = Joints[Limb].DesiredAngle
  285. Joints[Limb]:Remove()
  286. end
  287.  
  288.  
  289. function ResetLimbCFrame(Limb, Character)
  290. if Character == nil then return false end
  291. if Character.Parent == nil then return false end
  292. if Character:FindFirstChild("Torso") == nil then return false end
  293. local Joints = {
  294. Character.Torso:FindFirstChild("Right Shoulder 2"),
  295. Character.Torso:FindFirstChild("Left Shoulder 2"),
  296. Character.Torso:FindFirstChild("Right Hip 2"),
  297. Character.Torso:FindFirstChild("Left Hip 2")
  298. }
  299. local Limbs = {
  300. Character:FindFirstChild("Right Arm"),
  301. Character:FindFirstChild("Left Arm"),
  302. Character:FindFirstChild("Right Leg"),
  303. Character:FindFirstChild("Left Leg")
  304. }
  305. if Joints[Limb] == nil then return false end
  306. if Limbs[Limb] == nil then return false end
  307. if Limb == 1 then
  308. Joints[Limb].C0 = CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  309. Joints[Limb].C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  310. elseif Limb == 2 then
  311. Joints[Limb].C0 = CFrame.new(-1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  312. Joints[Limb].C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  313. elseif Limb == 3 then
  314. Joints[Limb].C0 = CFrame.new(0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  315. Joints[Limb].C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  316. elseif Limb == 4 then
  317. Joints[Limb].C0 = CFrame.new(-0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  318. Joints[Limb].C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  319. end
  320. end
  321.  
  322.  
  323. function EnableLimb(Limb, Character)
  324. if Character == nil then return false end
  325. if Character:FindFirstChild("Torso") == nil then return false end
  326. local Joints = {
  327. Character.Torso:FindFirstChild("Right Shoulder 2"),
  328. Character.Torso:FindFirstChild("Left Shoulder 2"),
  329. Character.Torso:FindFirstChild("Right Hip 2"),
  330. Character.Torso:FindFirstChild("Left Hip 2")
  331. }
  332. local Limbs = {
  333. Character:FindFirstChild("Right Arm"),
  334. Character:FindFirstChild("Left Arm"),
  335. Character:FindFirstChild("Right Leg"),
  336. Character:FindFirstChild("Left Leg")
  337. }
  338. if Joints[Limb] == nil then return false end
  339. if Limbs[Limb] == nil then return false end
  340. if Limb == 1 then
  341. Joints[Limb].Name = "Right Shoulder"
  342. elseif Limb == 2 then
  343. Joints[Limb].Name = "Left Shoulder"
  344. elseif Limb == 3 then
  345. Joints[Limb].Name = "Right Hip"
  346. elseif Limb == 4 then
  347. Joints[Limb].Name = "Left Hip"
  348. end
  349. Animate = Character:FindFirstChild("Animate")
  350. if Animate == nil then return false end
  351. Animate = Animate:Clone()
  352. Character.Animate:Remove()
  353. Animate.Parent = Character
  354. end
  355.  
  356.  
  357. function onButton1Down(Mouse)
  358. if Button1Down == true then return end
  359. Button1Down = true
  360. if CheckPlayer() == false then return end
  361. if CanUse == true then
  362. CanUse = false
  363. while Button1Down == true and Selected == true do
  364. SoundToServer("Whoosh", "rbxasset://sounds/Rocket whoosh 01.wav", 10, 0.5, false, Player.Character[ModelName].Handle)
  365. local Foam = Instance.new("Part", Workspace)
  366. Foam.Name = "Foam"
  367. Foam.TopSurface = 0
  368. Foam.BottomSurface = 0
  369. Foam.BrickColor = BrickColor.new("White")
  370. Foam.Locked = true
  371. Foam.CanCollide = false
  372. Foam.FormFactor = "Custom"
  373. Foam.Size = Vector3.new(1, 1, 1)
  374. Foam.CFrame = Player.Character[ModelName].Source.CFrame * CFrame.new(0, 2, 0)
  375. Foam.Elasticity = 0
  376. Foam.Friction = 0
  377. local Mesh = Instance.new("SpecialMesh", Foam)
  378. Mesh.MeshType = "Sphere"
  379. Mesh.Scale = Vector3.new()
  380. local BodyVelocity = Instance.new("BodyVelocity", Foam)
  381. BodyVelocity.maxForce = Vector3.new(math.huge, math.huge, math.huge)
  382. BodyVelocity.velocity = ((Mouse.Hit.p - Player.Character[ModelName].Source.Position).unit * math.random(130, 150)) + Vector3.new(math.random(-5000, 5000) / 1000, math.random(-5000, 5000) / 1000, math.random(-5000, 5000) / 1000)
  383. TouchedToServer([[if Hit == nil then return end
  384. if Hit.Parent == nil then return end
  385. if Hit.Name ~= "Foam" and Hit:GetMass() < 500 and Hit:FindFirstChild("RealFire") == nil and math.random(1, 5) == 1 then
  386. Hit.BrickColor = BrickColor.new((function()
  387. local Color = math.random(1, 4)
  388. if Color == 1 then
  389. return "White"
  390. elseif Color == 2 then
  391. return "Institutional white"
  392. elseif Color == 3 then
  393. return "Medium stone grey"
  394. elseif Color == 4 then
  395. return "Phosph. White"
  396. end
  397. end)())
  398. end
  399. ]], Foam)
  400. coroutine.wrap(function()
  401. while Foam.Parent ~= nil do
  402. Foam.Mesh.Scale = Foam.Mesh.Scale + Vector3.new(0.5, 0.5, 0.5)
  403. wait()
  404. end
  405. end)()
  406. coroutine.wrap(function()
  407. wait(math.random(100, 300) / 1000)
  408. for i = Foam.Transparency, 1, 0.1 do
  409. Foam.Transparency = i
  410. wait()
  411. end
  412. Foam:Remove()
  413. end)()
  414. Foam:BreakJoints()
  415. CameraPunch(math.rad(math.random(-100, 1000) / 1000), math.rad(math.random(-1000, 1000) / 1000))
  416. wait()
  417. end
  418. CanUse = true
  419. end
  420. end
  421.  
  422.  
  423. function onButton1Up(Mouse)
  424. if Button1Down == false then return end
  425. Button1Down = false
  426. end
  427.  
  428.  
  429. function onKeyDown(Key, Mouse)
  430. if Selected == false then return end
  431. Key = Key:lower()
  432. if Button1Down == false and CanUse == true and CheckPlayer() == true then
  433. if Key == "q" then
  434. if Mouse.Target == nil then return end
  435. if CheckPlayer() == false then return end
  436. local NewPlayer = game:GetService("Players"):GetPlayerFromCharacter(Mouse.Target.Parent)
  437. if NewPlayer == nil then return end
  438. if NewPlayer.Character == nil then return end
  439. if NewPlayer.Character:FindFirstChild("Torso") == nil then return end
  440. if (NewPlayer.Character.Torso.Position - Player.Character.Torso.Position).magnitude > 10 then return end
  441. onDeselected(Mouse)
  442. wait()
  443. RemoveParts(Player.Character, 1)
  444. script.Parent.Parent = NewPlayer.Backpack
  445. Player = NewPlayer
  446. elseif Key == "g" then
  447. CanUse = false
  448. SoundToServer("Slash", "rbxasset://sounds/swordslash.wav", 0.9, 1, false, Player.Character:FindFirstChild("Torso"))
  449. SetSpeed(1, 0.3, Player.Character)
  450. SetAngle(1, math.rad(200), Player.Character)
  451. local HasHit = false
  452. local _, HitConnection = pcall(function() return Player.Character[ModelName].Handle.Touched:connect(function(Hit)
  453. if HasHit == true or Hit:IsDescendantOf(Player.Character) then return end
  454. HasHit = true
  455. SoundToServer("Bash", "http://www.roblox.com/Asset/?id=10209596", 0.8, 0.4, false, Player.Character:FindFirstChild("Torso"))
  456. local Humanoid = Hit.Parent:FindFirstChild("Humanoid") or Hit.Parent.Parent:FindFirstChild("Humanoid")
  457. if Humanoid ~= nil then
  458. tagHumanoid(Humanoid)
  459. Humanoid:TakeDamage(15)
  460. wait()
  461. pcall(function() untagHumanoid(Humanoid) end)
  462. end
  463. end) end)
  464. for i = 0, 1, 0.1 do
  465. pcall(function()
  466. Player.Character[ModelName].Handle.Weld.C0 = CFrame.new(0, 1.75 * i, 0.8 * i) * CFrame.fromEulerAnglesXYZ(math.rad(-140 * i), 0, 0)
  467. end)
  468. CameraPunch(math.rad(1.6), 0)
  469. wait()
  470. end
  471. pcall(function()
  472. Player.Character[ModelName].Handle.Weld.C0 = CFrame.new(0, 1.75, 0.8) * CFrame.fromEulerAnglesXYZ(math.rad(-140), 0, 0)
  473. end)
  474. SetSpeed(1, 0.5, Player.Character)
  475. SetAngle(1, 0, Player.Character)
  476. pcall(function() HitConnection:disconnect() end)
  477. HasHit = false
  478. local _, HitConnection = pcall(function() return Player.Character[ModelName].Handle.Touched:connect(function(Hit)
  479. if HasHit == true or Hit:IsDescendantOf(Player.Character) then return end
  480. HasHit = true
  481. SoundToServer("Bash", "http://www.roblox.com/Asset/?id=10209596", 0.75, 0.5, false, Player.Character:FindFirstChild("Torso"))
  482. local Humanoid = Hit.Parent:FindFirstChild("Humanoid") or Hit.Parent.Parent:FindFirstChild("Humanoid")
  483. if Humanoid ~= nil then
  484. tagHumanoid(Humanoid)
  485. Humanoid:TakeDamage(20)
  486. wait()
  487. pcall(function() untagHumanoid(Humanoid) end)
  488. end
  489. end) end)
  490. for i = 0, 1, 0.19 do
  491. pcall(function()
  492. Player.Character[ModelName].Handle.Weld.C0 = CFrame.new(0, 1.75, 0.8) * CFrame.fromEulerAnglesXYZ(math.rad(-140 + (40 * i)), 0, 0)
  493. end)
  494. CameraPunch(math.rad(-4), 0)
  495. wait()
  496. end
  497. pcall(function() HitConnection:disconnect() end)
  498. SetSpeed(1, 0.075, Player.Character)
  499. SetAngle(1, math.rad(90), Player.Character)
  500. for i = 1, 0, -0.08 do
  501. pcall(function()
  502. Player.Character[ModelName].Handle.Weld.C0 = CFrame.new(0, 1.75 * i, 0.8 * i) * CFrame.fromEulerAnglesXYZ(math.rad(-100 * i), 0, 0)
  503. end)
  504. CameraPunch(math.rad(0.5), 0)
  505. wait()
  506. end
  507. pcall(function()
  508. Player.Character[ModelName].Handle.Weld.C0 = CFrame.new()
  509. end)
  510. wait(0.1)
  511. CanUse = true
  512. end
  513. end
  514. end
  515.  
  516.  
  517. function onSelected(Mouse)
  518. if Selected == true or CanUse == false then return end
  519. CanUse = false
  520. while true do
  521. if CheckPlayer() == true then
  522. if Player.Character.Torso:FindFirstChild("Right Shoulder") ~= nil and Player.Character.Torso:FindFirstChild("Left Shoulder") ~= nil then
  523. break
  524. end
  525. end
  526. wait(0.1)
  527. end
  528. Selected = true
  529. RemoveParts(Player.Character, 1)
  530. CreateParts(Player.Character, 2)
  531. DisableLimb(1, Player.Character)
  532. SetSpeed(1, 0.5, Player.Character)
  533. SetAngle(1, math.rad(90), Player.Character)
  534. Mouse.Icon = "rbxasset://textures\\GunCursor.png"
  535. Mouse.Button1Down:connect(function() onButton1Down(Mouse) end)
  536. Mouse.Button1Up:connect(function() onButton1Up(Mouse) end)
  537. Mouse.KeyDown:connect(function(Key) onKeyDown(Key, Mouse) end)
  538. CanUse = true
  539. end
  540.  
  541.  
  542. function onDeselected(Mouse)
  543. if Selected == false or Primed == true then return end
  544. Selected = false
  545. while CanUse == false do wait() end
  546. if Selected == true then return end
  547. CanUse = false
  548. RemoveParts(Player.Character, 2)
  549. CreateParts(Player.Character, 1)
  550. SetAngle(1, 0, Player.Character)
  551. EnableLimb(1, Player.Character)
  552. CanUse = true
  553. end
  554.  
  555.  
  556. if script.Parent.ClassName ~= "HopperBin" then
  557. if Player == nil then print("Error: Player not found!") return end
  558. Tool = Instance.new("HopperBin")
  559. Tool.Name = ModelName
  560. Tool.Parent = Player.Backpack
  561. script.Name = "Main"
  562. script.Parent = Tool
  563. elseif script.Parent.ClassName == "HopperBin" and Connected == false then
  564. Connected = true
  565. Player = script.Parent.Parent.Parent
  566. script.Parent.Selected:connect(onSelected)
  567. script.Parent.Deselected:connect(onDeselected)
  568. CreateParts(Player.Character, 1)
  569. coroutine.wrap(loadstring(FirstPerson))()
  570. coroutine.wrap(loadstring(MouseAim))()
  571. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement