Advertisement
memberhero

Untitled

Sep 8th, 2016
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 16.29 KB | None | 0 0
  1. --[[
  2. Morphene Shot
  3. Gives a litte health.
  4. --]]
  5.  
  6.  
  7. if script == nil then return end
  8.  
  9.  
  10. Player = game:GetService("Players"):FindFirstChild("memberhero")
  11. Name = "Medical Syringe"
  12. selected = false
  13. Button1Down = false
  14. CanUse = true
  15.  
  16.  
  17. function makeParts(format)
  18. local model = Instance.new("Model")
  19. model.Name = Name
  20. local pm = Instance.new("Part")
  21. pm.Name = "Handle"
  22. pm.FormFactor = "Custom"
  23. pm.Size = Vector3.new(1, 1, 1)
  24. pm.BrickColor = BrickColor.new("Institutional white")
  25. pm.Locked = true
  26. pm.TopSurface = 0
  27. pm.BottomSurface = 0
  28. pm.Parent = model
  29. local m = Instance.new("CylinderMesh")
  30. m.Scale = Vector3.new(0.25, 1, 0.25)
  31. m.Parent = pm
  32. if format ~= nil then
  33. local w = Instance.new("Weld")
  34. w.Part0 = pm
  35. if format == "hand" then
  36. w.Part1 = Player.Character:FindFirstChild("Right Arm")
  37. w.C0 = CFrame.new(0, 0.1, 1.1) * CFrame.fromEulerAnglesXYZ(math.rad(70), 0, 0)
  38. w.C1 = CFrame.new()
  39. elseif format == "holster" then
  40. w.Part1 = Player.Character:FindFirstChild("Right Leg")
  41. w.C0 = CFrame.new(-0.65, -0.25, 0) * CFrame.fromEulerAnglesXYZ(math.rad(25), 0, 0)
  42. w.C1 = CFrame.new()
  43. w.Parent = pm
  44. model.Name = Name.. " (Holstered)"
  45. end
  46. w.Parent = pm
  47. model.Parent = Player.Character
  48. end
  49. local p = Instance.new("Part")
  50. p.Name = "Syringe Valve 1"
  51. p.FormFactor = "Custom"
  52. p.Size = Vector3.new(1, 1, 1)
  53. p.BrickColor = BrickColor.new("Institutional white")
  54. p.CanCollide = false
  55. p.Locked = true
  56. p.TopSurface = 0
  57. p.BottomSurface = 0
  58. p.Parent = model
  59. local m = Instance.new("CylinderMesh")
  60. m.Scale = Vector3.new(0.15, 0.5, 0.15)
  61. m.Parent = p
  62. local w = Instance.new("Weld")
  63. w.Part0 = p
  64. w.Part1 = pm
  65. w.C0 = CFrame.new(0, -0.75, 0)
  66. w.C1 = CFrame.new()
  67. w.Parent = p
  68. local p = Instance.new("Part")
  69. p.Name = "Syringe Valve 2"
  70. p.FormFactor = "Custom"
  71. p.Size = Vector3.new(1, 1, 1)
  72. p.BrickColor = BrickColor.new("Institutional white")
  73. p.CanCollide = false
  74. p.Locked = true
  75. p.TopSurface = 0
  76. p.BottomSurface = 0
  77. p.Parent = model
  78. local m = Instance.new("CylinderMesh")
  79. m.Scale = Vector3.new(0.3, 0.01, 0.3)
  80. m.Parent = p
  81. local w = Instance.new("Weld")
  82. w.Part0 = p
  83. w.Part1 = pm
  84. w.C0 = CFrame.new(0, -1, 0)
  85. w.C1 = CFrame.new()
  86. w.Parent = p
  87. local p = Instance.new("Part")
  88. p.Name = "Syringe Tip"
  89. p.FormFactor = "Custom"
  90. p.Size = Vector3.new(1, 1, 1)
  91. p.BrickColor = BrickColor.new("Institutional white")
  92. p.CanCollide = false
  93. p.Locked = true
  94. p.TopSurface = 0
  95. p.BottomSurface = 0
  96. p.Parent = model
  97. local m = Instance.new("CylinderMesh")
  98. m.Scale = Vector3.new(0.2, 0.1, 0.2)
  99. m.Parent = p
  100. local w = Instance.new("Weld")
  101. w.Part0 = p
  102. w.Part1 = pm
  103. w.C0 = CFrame.new(0, 0.5, 0)
  104. w.C1 = CFrame.new()
  105. w.Parent = p
  106. local p = Instance.new("Part")
  107. p.Name = "Syringe Needle"
  108. p.FormFactor = "Custom"
  109. p.Size = Vector3.new(1, 1, 1)
  110. p.BrickColor = BrickColor.new("Medium stone grey")
  111. p.CanCollide = false
  112. p.Locked = true
  113. p.TopSurface = 0
  114. p.BottomSurface = 0
  115. p.Parent = model
  116. local m = Instance.new("CylinderMesh")
  117. m.Scale = Vector3.new(0.01, 1, 0.01)
  118. m.Parent = p
  119. local w = Instance.new("Weld")
  120. w.Part0 = p
  121. w.Part1 = pm
  122. w.C0 = CFrame.new(0, 1, 0)
  123. w.C1 = CFrame.new()
  124. w.Parent = p
  125. return model
  126. end
  127.  
  128.  
  129. function removeParts(format)
  130. if format == "hand" then
  131. pcall(function() Player.Character[Name]:Remove() end)
  132. elseif format == "holster" then
  133. pcall(function() Player.Character[Name.. " (Holstered)"]:Remove() end)
  134. end
  135. end
  136.  
  137.  
  138. function SetAngle(Joint, Angle, Character)
  139. if Character == nil then return false end
  140. local Joints = {
  141. Character.Torso:FindFirstChild("Right Shoulder 2"),
  142. Character.Torso:FindFirstChild("Left Shoulder 2"),
  143. Character.Torso:FindFirstChild("Right Hip 2"),
  144. Character.Torso:FindFirstChild("Left Hip 2")
  145. }
  146. if Joints[Joint] == nil then return false end
  147. if Joint == 1 or Joint == 3 then
  148. Joints[Joint].DesiredAngle = Angle
  149. end
  150. if Joint == 2 or Joint == 4 then
  151. Joints[Joint].DesiredAngle = -Angle
  152. end
  153. end
  154.  
  155.  
  156. function ForceAngle(Joint, Angle, Character)
  157. if Character == nil then return false end
  158. local Joints = {
  159. Character.Torso:FindFirstChild("Right Shoulder 2"),
  160. Character.Torso:FindFirstChild("Left Shoulder 2"),
  161. Character.Torso:FindFirstChild("Right Hip 2"),
  162. Character.Torso:FindFirstChild("Left Hip 2")
  163. }
  164. if Joints[Joint] == nil then return false end
  165. if Joint == 1 or Joint == 3 then
  166. Joints[Joint].DesiredAngle = Angle
  167. Joints[Joint].CurrentAngle = Angle
  168. end
  169. if Joint == 2 or Joint == 4 then
  170. Joints[Joint].DesiredAngle = -Angle
  171. Joints[Joint].CurrentAngle = -Angle
  172. end
  173. end
  174.  
  175.  
  176. function SetSpeed(Joint, Speed, Character)
  177. if Character == nil then return false end
  178. local Joints = {
  179. Character.Torso:FindFirstChild("Right Shoulder 2"),
  180. Character.Torso:FindFirstChild("Left Shoulder 2"),
  181. Character.Torso:FindFirstChild("Right Hip 2"),
  182. Character.Torso:FindFirstChild("Left Hip 2")
  183. }
  184. if Joints[Joint] == nil then return false end
  185. Joints[Joint].MaxVelocity = Speed
  186. end
  187.  
  188.  
  189. function DisableLimb(Limb, Character)
  190. if Character == nil then return false end
  191. if Character:FindFirstChild("Torso") == nil then return false end
  192. local Joints = {
  193. Character.Torso:FindFirstChild("Right Shoulder"),
  194. Character.Torso:FindFirstChild("Left Shoulder"),
  195. Character.Torso:FindFirstChild("Right Hip"),
  196. Character.Torso:FindFirstChild("Left Hip")
  197. }
  198. local Limbs = {
  199. Character:FindFirstChild("Right Arm"),
  200. Character:FindFirstChild("Left Arm"),
  201. Character:FindFirstChild("Right Leg"),
  202. Character:FindFirstChild("Left Leg")
  203. }
  204. if Joints[Limb] == nil then return false end
  205. if Limbs[Limb] == nil then return false end
  206. local Joint = Instance.new("Motor")
  207. Joint.Parent = Character.Torso
  208. Joint.Part0 = Character.Torso
  209. Joint.Part1 = Limbs[Limb]
  210. if Limb == 1 then
  211. Joint.C0 = CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  212. Joint.C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  213. Joint.Name = "Right Shoulder 2"
  214. elseif Limb == 2 then
  215. Joint.C0 = CFrame.new(-1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  216. Joint.C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  217. Joint.Name = "Left Shoulder 2"
  218. elseif Limb == 3 then
  219. Joint.C0 = CFrame.new(0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  220. Joint.C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  221. Joint.Name = "Right Hip 2"
  222. elseif Limb == 4 then
  223. Joint.C0 = CFrame.new(-0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  224. Joint.C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  225. Joint.Name = "Left Hip 2"
  226. end
  227. Joint.MaxVelocity = Joints[Limb].MaxVelocity
  228. Joint.CurrentAngle = Joints[Limb].CurrentAngle
  229. Joint.DesiredAngle = Joints[Limb].DesiredAngle
  230. Joints[Limb]:Remove()
  231. end
  232.  
  233.  
  234. function ResetLimbCFrame(Limb, Character)
  235. if Character == nil then return false end
  236. if Character.Parent == nil then return false end
  237. if Character:FindFirstChild("Torso") == nil then return false end
  238. local Joints = {
  239. Character.Torso:FindFirstChild("Right Shoulder 2"),
  240. Character.Torso:FindFirstChild("Left Shoulder 2"),
  241. Character.Torso:FindFirstChild("Right Hip 2"),
  242. Character.Torso:FindFirstChild("Left Hip 2")
  243. }
  244. local Limbs = {
  245. Character:FindFirstChild("Right Arm"),
  246. Character:FindFirstChild("Left Arm"),
  247. Character:FindFirstChild("Right Leg"),
  248. Character:FindFirstChild("Left Leg")
  249. }
  250. if Joints[Limb] == nil then return false end
  251. if Limbs[Limb] == nil then return false end
  252. if Limb == 1 then
  253. Joints[Limb].C0 = CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  254. Joints[Limb].C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  255. elseif Limb == 2 then
  256. Joints[Limb].C0 = CFrame.new(-1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  257. Joints[Limb].C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  258. elseif Limb == 3 then
  259. Joints[Limb].C0 = CFrame.new(0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  260. Joints[Limb].C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  261. elseif Limb == 4 then
  262. Joints[Limb].C0 = CFrame.new(-0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  263. Joints[Limb].C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  264. end
  265. end
  266.  
  267.  
  268. function EnableLimb(Limb, Character)
  269. if Character == nil then return false end
  270. if Character:FindFirstChild("Torso") == nil then return false end
  271. local Joints = {
  272. Character.Torso:FindFirstChild("Right Shoulder 2"),
  273. Character.Torso:FindFirstChild("Left Shoulder 2"),
  274. Character.Torso:FindFirstChild("Right Hip 2"),
  275. Character.Torso:FindFirstChild("Left Hip 2")
  276. }
  277. local Limbs = {
  278. Character:FindFirstChild("Right Arm"),
  279. Character:FindFirstChild("Left Arm"),
  280. Character:FindFirstChild("Right Leg"),
  281. Character:FindFirstChild("Left Leg")
  282. }
  283. if Joints[Limb] == nil then return false end
  284. if Limbs[Limb] == nil then return false end
  285. if Limb == 1 then
  286. Joints[Limb].Name = "Right Shoulder"
  287. elseif Limb == 2 then
  288. Joints[Limb].Name = "Left Shoulder"
  289. elseif Limb == 3 then
  290. Joints[Limb].Name = "Right Hip"
  291. elseif Limb == 4 then
  292. Joints[Limb].Name = "Left Hip"
  293. end
  294. Animate = Character:FindFirstChild("Animate")
  295. if Animate == nil then return false end
  296. Animate = Animate:Clone()
  297. Character.Animate:Remove()
  298. Animate.Parent = Character
  299. end
  300.  
  301.  
  302. function onButton1Down(mouse)
  303. if selected == false or CanUse == false then return end
  304. if Player.Character:FindFirstChild(Name) ~= nil then
  305. local Model = nil
  306. if mouse.Target ~= nil then
  307. if mouse.Target.Parent:FindFirstChild("Humanoid") ~= nil and mouse.Target.Parent:FindFirstChild("Torso") ~= nil then
  308. Model = mouse.Target.Parent
  309. if (Model.Torso.Position - Player.Character[Name]["Syringe Needle"].Position).magnitude > 3 then return end
  310. end
  311. end
  312. if Model == nil then
  313. if Player.Character:FindFirstChild("Humanoid") ~= nil and Player.Character:FindFirstChild("Torso") ~= nil then
  314. Model = Player.Character
  315. end
  316. end
  317. if Model == nil then return end
  318. CanUse = false
  319. local Completed = false
  320. if Model:FindFirstChild("Right Arm") == nil then
  321. local Limb = Instance.new("Part")
  322. Limb.Name = "Right Arm"
  323. pcall(function() Limb.BrickColor = BrickColor.new(tostring(Model["Body Colors"].RightArmColor)) end)
  324. Limb.FormFactor = 0
  325. Limb.Size = Vector3.new(1, 2, 1)
  326. Limb.Parent = Model
  327. Instance.new("Motor6D", Model.Torso).Name = "Right Shoulder"
  328. DisableLimb(1, Model)
  329. EnableLimb(1, Model)
  330. Completed = true
  331. end
  332. if Model:FindFirstChild("Left Arm") == nil then
  333. local Limb = Instance.new("Part")
  334. Limb.Name = "Left Arm"
  335. pcall(function() Limb.BrickColor = BrickColor.new(tostring(Model["Body Colors"].LeftArmColor)) end)
  336. Limb.FormFactor = 0
  337. Limb.Size = Vector3.new(1, 2, 1)
  338. Limb.Parent = Model
  339. Instance.new("Motor6D", Model.Torso).Name = "Left Shoulder"
  340. DisableLimb(2, Model)
  341. EnableLimb(2, Model)
  342. Completed = true
  343. end
  344. if Model:FindFirstChild("Right Leg") == nil then
  345. local Limb = Instance.new("Part")
  346. Limb.Name = "Right Leg"
  347. pcall(function() Limb.BrickColor = BrickColor.new(tostring(Model["Body Colors"].RightLegColor)) end)
  348. Limb.TopSurface = 0
  349. Limb.BottomSurface = 0
  350. Limb.FormFactor = 0
  351. Limb.Size = Vector3.new(1, 2, 1)
  352. Limb.Parent = Model
  353. Instance.new("Motor6D", Model.Torso).Name = "Right Hip"
  354. DisableLimb(3, Model)
  355. EnableLimb(3, Model)
  356. DisableLimb(3, Model)
  357. SetSpeed(3, 0.1, Model)
  358. EnableLimb(3, Model)
  359. Completed = true
  360. end
  361. if Model:FindFirstChild("Left Leg") == nil then
  362. local Limb = Instance.new("Part")
  363. Limb.Name = "Left Leg"
  364. pcall(function() Limb.BrickColor = BrickColor.new(tostring(Model["Body Colors"].LeftLegColor)) end)
  365. Limb.TopSurface = 0
  366. Limb.BottomSurface = 0
  367. Limb.FormFactor = 0
  368. Limb.Size = Vector3.new(1, 2, 1)
  369. Limb.Parent = Model
  370. Instance.new("Motor6D", Model.Torso).Name = "Left Hip"
  371. DisableLimb(4, Model)
  372. EnableLimb(4, Model)
  373. DisableLimb(4, Model)
  374. SetSpeed(4, 0.1, Model)
  375. EnableLimb(4, Model)
  376. Completed = true
  377. end
  378. if Model.Humanoid.Health < 75 then
  379. Model.Humanoid.Health = Model.Humanoid.Health + math.random(1, 15)
  380. if math.random(1, 25) == 1 then
  381. coroutine.wrap(function()
  382. for i = 1, math.random(50, 100) do
  383. Model.Humanoid.Health = math.random(1, Model.Humanoid.MaxHealth)
  384. wait()
  385. end
  386. Model.Humanoid.Health = 0
  387. end)()
  388. end
  389. Completed = true
  390. end
  391. if Completed == true then
  392. if Model == Player.Character then
  393. SetSpeed(1, 0.1, Model)
  394. for i = 90, 0, -10 do
  395. SetAngle(1, math.rad(5), Model)
  396. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(i), 0)
  397. wait()
  398. end
  399. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new(1.5, 0.5, 0)
  400. end
  401. coroutine.wrap(function()
  402. for i = 0, 1, 0.1 do
  403. Player.Character[Name]["Syringe Valve 1"].Weld.C0 = CFrame.new(0, -0.75 + (0.5 * i), 0)
  404. Player.Character[Name]["Syringe Valve 2"].Weld.C0 = CFrame.new(0, -1 + (0.5 * i), 0)
  405. wait()
  406. end
  407. wait(0.25)
  408. for i = 1, 0, -0.05 do
  409. Player.Character[Name]["Syringe Valve 1"].Weld.C0 = CFrame.new(0, -0.75 + (0.5 * i), 0)
  410. Player.Character[Name]["Syringe Valve 2"].Weld.C0 = CFrame.new(0, -1 + (0.5 * i), 0)
  411. wait()
  412. end
  413. end)()
  414. if Model == Player.Character then
  415. wait(0.75)
  416. SetSpeed(1, 0.1, Model)
  417. for i = 0, 90, 15 do
  418. SetAngle(1, math.rad(90), Model)
  419. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(i), 0)
  420. wait()
  421. end
  422. ResetLimbCFrame(1, Model)
  423. end
  424. end
  425. CanUse = true
  426. end
  427. end
  428.  
  429.  
  430. function onKeyDown(key, mouse)
  431. if selected == false then return end
  432. key = key:lower()
  433. if key == "q" and CanUse == true then
  434. if mouse.Target == nil then return end
  435. if game:GetService("Players"):GetPlayerFromCharacter(mouse.Target.Parent) ~= nil then
  436. onDeselected(mouse)
  437. removeParts("holster")
  438. script.Parent.Parent = game:GetService("Players"):GetPlayerFromCharacter(mouse.Target.Parent).Backpack
  439. end
  440. end
  441. end
  442.  
  443.  
  444. function onSelected(mouse)
  445. if selected == true then return end
  446. selected = true
  447. mouse.Icon = "rbxasset://textures\\GunWaitCursor.png"
  448. while Player.Character:FindFirstChild("WeaponActivated") ~= nil do
  449. if Player.Character.WeaponActivated.Value == nil then break end
  450. if Player.Character.WeaponActivated.Value.Parent == nil then break end
  451. wait()
  452. end
  453. local weapon = Instance.new("ObjectValue")
  454. weapon.Name = "WeaponActivated"
  455. weapon.Value = script.Parent
  456. weapon.Parent = Player.Character
  457. DisableLimb(1, Player.Character)
  458. SetAngle(1, math.rad(90), Player.Character)
  459. removeParts("holster")
  460. makeParts("hand")
  461. mouse.Button1Down:connect(function() onButton1Down(mouse) end)
  462. mouse.KeyDown:connect(function(key) onKeyDown(key, mouse) end)
  463. mouse.Icon = "rbxasset://textures\\GunCursor.png"
  464. end
  465.  
  466.  
  467. function onDeselected(mouse)
  468. if selected == false then return end
  469. Button1Down = false
  470. while canFire == false do
  471. wait()
  472. end
  473. selected = false
  474. removeParts("hand")
  475. makeParts("holster")
  476. ForceAngle(1, 0, Player.Character)
  477. EnableLimb(1, Player.Character)
  478. if Player.PlayerGui:FindFirstChild(Name) ~= nil then Player.PlayerGui[Name]:Remove() end
  479. if Player.Character:FindFirstChild("WeaponActivated") ~= nil then
  480. if Player.Character.WeaponActivated.Value == script.Parent then
  481. Player.Character.WeaponActivated:Remove()
  482. end
  483. end
  484. while Player.Character:FindFirstChild("WeaponActivated") ~= nil do
  485. if Player.Character.WeaponActivated.Value == nil then break end
  486. if Player.Character.WeaponActivated.Value.Parent == nil then break end
  487. wait()
  488. end
  489. end
  490.  
  491.  
  492. if script.Parent.ClassName ~= "HopperBin" then
  493. if Player == nil then print("Error: Player not found!") return end
  494. Tool = Instance.new("HopperBin")
  495. Tool.Name = Name
  496. Tool.Parent = Player.Backpack
  497. script.Name = "Main"
  498. script.Parent = Tool
  499. elseif script.Parent.ClassName == "HopperBin" then
  500. while script.Parent.Parent.ClassName ~= "Backpack" do
  501. wait()
  502. end
  503. Player = script.Parent.Parent.Parent
  504. makeParts("holster")
  505. script.Parent.Selected:connect(onSelected)
  506. script.Parent.Deselected:connect(onDeselected)
  507. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement