Advertisement
memberhero

grapefruit grenade script leaked

Sep 6th, 2016
433
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 16.50 KB | None | 0 0
  1. --[[
  2. Script Version 2.1
  3. Changelog Revision 2
  4.  
  5. Grapefruit grenade, a nickname that US Army troops named their
  6. fragmentation grenades because they (somewhat) resembled grapefruits.
  7.  
  8. Script by DarkShadow6
  9.  
  10. Changelog:
  11. o 2.1
  12. o Updated with love from Five-seveN. Limb controllers fixed.
  13. o 2.0
  14. o Started changelog.
  15. o Revamped script. The hopperbin no longer stays in your backpack after you throw it for like 3 seconds.
  16. o Made it blue.
  17. --]]
  18.  
  19.  
  20. if script == nil then return end
  21.  
  22.  
  23. Player = game.Players.LocalPlayer
  24. Char = Player.Character
  25. animate = Char:findFirstChild("Animate")
  26. if animate then
  27. animate:Destroy()
  28. end
  29. Name = "Grapefruit"
  30. selected = false
  31. Button1Down = false
  32. thrown = false
  33.  
  34.  
  35. function makeParts(format)
  36. local grenade = Instance.new("Model")
  37. grenade.Name = Name
  38. grenade.Parent = Player.Character
  39. local pm = Instance.new("Part")
  40. pm.Name = "Handle"
  41. pm.FormFactor = "Custom"
  42. pm.Size = Vector3.new(1, 1, 1)
  43. pm.BrickColor = BrickColor.new("Earth green")
  44. pm.Locked = true
  45. pm.TopSurface = 0
  46. pm.BottomSurface = 0
  47. pm.Parent = grenade
  48. local m = Instance.new("SpecialMesh")
  49. m.MeshType = "Sphere"
  50. m.Scale = Vector3.new(1, 1, 0.8)
  51. m.Parent = pm
  52. local w = Instance.new("Weld")
  53. w.Part0 = pm
  54. if format == "hand" then
  55. w.Part1 = Player.Character:FindFirstChild("Right Arm")
  56. w.C0 = CFrame.new(-1.2, 0, 0) * CFrame.fromEulerAnglesXYZ(math.rad(90), 0, math.rad(90))
  57. w.C1 = CFrame.new()
  58. elseif format == "holster" then
  59. w.Part1 = Player.Character:FindFirstChild("Left Leg")
  60. w.C0 = CFrame.new(0.8, -0.25, 0)
  61. w.C1 = CFrame.new()
  62. grenade.Name = Name.. " (Holstered)"
  63. end
  64. w.Parent = pm
  65. local s = Instance.new("Sound")
  66. s.Name = "Explode"
  67. s.SoundId = "rbxasset://sounds\\collide.wav"
  68. s.Volume = 1
  69. s.Pitch = 1
  70. s.Looped = false
  71. s.Parent = pm
  72. local s = Instance.new("Sound")
  73. s.Name = "Pin"
  74. s.SoundId = "http://www.roblox.com/Asset/?id=2697295"
  75. s.Volume = 1
  76. s.Pitch = 5
  77. s.Looped = false
  78. s.Parent = pm
  79. for x = 0, 360, 360 / 5 do
  80. for i = 0, 360, 360 / 5 do
  81. local p = Instance.new("Part")
  82. p.Name = "Fragment"
  83. p.FormFactor = "Custom"
  84. p.Size = Vector3.new(1, 1, 1)
  85. p.BrickColor = BrickColor.new("Earth green")
  86. p.CanCollide = false
  87. p.Transparency = 0
  88. p.Locked = true
  89. p.TopSurface = 0
  90. p.BottomSurface = 0
  91. p.Parent = grenade
  92. local m = Instance.new("SpecialMesh")
  93. m.MeshType = "Brick"
  94. m.Scale = Vector3.new(0.25, 1.05, 0.25)
  95. m.Parent = p
  96. local w = Instance.new("Weld")
  97. w.Part0 = p
  98. w.Part1 = pm
  99. w.C0 = CFrame.new() * CFrame.fromEulerAnglesXYZ(math.rad(x), 0, math.rad(i))
  100. w.C1 = CFrame.new()
  101. w.Parent = p
  102. end
  103. end
  104. local p = Instance.new("Part")
  105. p.Name = "Pin Holder"
  106. p.FormFactor = "Custom"
  107. p.Size = Vector3.new(1, 1, 1)
  108. p.BrickColor = BrickColor.new("Dark stone grey")
  109. p.CanCollide = false
  110. p.Transparency = 0
  111. p.Locked = true
  112. p.TopSurface = 0
  113. p.BottomSurface = 0
  114. p.Parent = grenade
  115. local m = Instance.new("CylinderMesh")
  116. m.Scale = Vector3.new(0.25, 0.4, 0.25)
  117. m.Parent = p
  118. local w = Instance.new("Weld")
  119. w.Part0 = p
  120. w.Part1 = pm
  121. w.C0 = CFrame.new(0, -0.5, 0)
  122. w.C1 = CFrame.new()
  123. w.Parent = p
  124. local pm2 = Instance.new("Part")
  125. pm2.Name = "Pin"
  126. pm2.FormFactor = "Custom"
  127. pm2.Size = Vector3.new(1, 1, 1)
  128. pm2.BrickColor = BrickColor.new("Dark stone grey")
  129. pm2.Transparency = 0
  130. pm2.Locked = true
  131. pm2.TopSurface = 0
  132. pm2.BottomSurface = 0
  133. pm2.Parent = grenade
  134. local m = Instance.new("SpecialMesh")
  135. m.MeshType = "Brick"
  136. m.Scale = Vector3.new(0.1, 0.1, 0.2)
  137. m.Parent = pm2
  138. local w = Instance.new("Weld")
  139. w.Part0 = pm2
  140. w.Part1 = pm
  141. w.C0 = CFrame.new(0, -0.6, 0.15)
  142. w.C1 = CFrame.new()
  143. w.Parent = pm2
  144. local p = Instance.new("Part")
  145. p.Name = "Pin Ring"
  146. p.FormFactor = "Custom"
  147. p.Size = Vector3.new(1, 1, 1)
  148. p.BrickColor = BrickColor.new("Dark stone grey")
  149. p.Transparency = 0
  150. p.Locked = true
  151. p.TopSurface = 0
  152. p.BottomSurface = 0
  153. p.Parent = grenade
  154. local m = Instance.new("SpecialMesh")
  155. m.MeshType = "Brick"
  156. m.Scale = Vector3.new(0.15, 0.15, 0.15)
  157. m.Parent = p
  158. local w = Instance.new("Weld")
  159. w.Part0 = p
  160. w.Part1 = pm2
  161. w.C0 = CFrame.new(0, 0, 0.15)
  162. w.C1 = CFrame.new()
  163. w.Parent = p
  164. end
  165.  
  166.  
  167. function removeParts(format)
  168. if format == "hand" then
  169. if Player.Character:FindFirstChild(Name) ~= nil then
  170. Player.Character[Name]:Remove()
  171. end
  172. elseif format == "holster" then
  173. if Player.Character:FindFirstChild(Name.. " (Holstered)") ~= nil then
  174. Player.Character[Name.. " (Holstered)"]:Remove()
  175. end
  176. end
  177. end
  178.  
  179.  
  180. function SetAngle(Joint, Angle, Character)
  181. if Character == nil then return false end
  182. local Joints = {
  183. Character.Torso:FindFirstChild("Right Shoulder 2"),
  184. Character.Torso:FindFirstChild("Left Shoulder 2"),
  185. Character.Torso:FindFirstChild("Right Hip 2"),
  186. Character.Torso:FindFirstChild("Left Hip 2")
  187. }
  188. if Joints[Joint] == nil then return false end
  189. if Joint == 1 or Joint == 3 then
  190. Joints[Joint].DesiredAngle = Angle
  191. end
  192. if Joint == 2 or Joint == 4 then
  193. Joints[Joint].DesiredAngle = -Angle
  194. end
  195. end
  196.  
  197.  
  198. function ForceAngle(Joint, Angle, Character)
  199. if Character == nil then return false end
  200. local Joints = {
  201. Character.Torso:FindFirstChild("Right Shoulder 2"),
  202. Character.Torso:FindFirstChild("Left Shoulder 2"),
  203. Character.Torso:FindFirstChild("Right Hip 2"),
  204. Character.Torso:FindFirstChild("Left Hip 2")
  205. }
  206. if Joints[Joint] == nil then return false end
  207. if Joint == 1 or Joint == 3 then
  208. Joints[Joint].DesiredAngle = Angle
  209. Joints[Joint].CurrentAngle = Angle
  210. end
  211. if Joint == 2 or Joint == 4 then
  212. Joints[Joint].DesiredAngle = -Angle
  213. Joints[Joint].CurrentAngle = -Angle
  214. end
  215. end
  216.  
  217.  
  218. function SetSpeed(Joint, Speed, Character)
  219. if Character == nil then return false end
  220. local Joints = {
  221. Character.Torso:FindFirstChild("Right Shoulder 2"),
  222. Character.Torso:FindFirstChild("Left Shoulder 2"),
  223. Character.Torso:FindFirstChild("Right Hip 2"),
  224. Character.Torso:FindFirstChild("Left Hip 2")
  225. }
  226. if Joints[Joint] == nil then return false end
  227. Joints[Joint].MaxVelocity = Speed
  228. end
  229.  
  230.  
  231. function DisableLimb(Limb, Character)
  232. if Character == nil then return false end
  233. if Character:FindFirstChild("Torso") == nil then return false end
  234. local Joints = {
  235. Character.Torso:FindFirstChild("Right Shoulder"),
  236. Character.Torso:FindFirstChild("Left Shoulder"),
  237. Character.Torso:FindFirstChild("Right Hip"),
  238. Character.Torso:FindFirstChild("Left Hip")
  239. }
  240. local Limbs = {
  241. Character:FindFirstChild("Right Arm"),
  242. Character:FindFirstChild("Left Arm"),
  243. Character:FindFirstChild("Right Leg"),
  244. Character:FindFirstChild("Left Leg")
  245. }
  246. if Joints[Limb] == nil then return false end
  247. if Limbs[Limb] == nil then return false end
  248. local Joint = Instance.new("Motor")
  249. Joint.Parent = Character.Torso
  250. Joint.Part0 = Character.Torso
  251. Joint.Part1 = Limbs[Limb]
  252. if Limb == 1 then
  253. Joint.C0 = CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  254. Joint.C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  255. Joint.Name = "Right Shoulder 2"
  256. elseif Limb == 2 then
  257. Joint.C0 = CFrame.new(-1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  258. Joint.C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  259. Joint.Name = "Left Shoulder 2"
  260. elseif Limb == 3 then
  261. Joint.C0 = CFrame.new(0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  262. Joint.C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  263. Joint.Name = "Right Hip 2"
  264. elseif Limb == 4 then
  265. Joint.C0 = CFrame.new(-0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  266. Joint.C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  267. Joint.Name = "Left Hip 2"
  268. end
  269. Joint.MaxVelocity = Joints[Limb].MaxVelocity
  270. Joint.CurrentAngle = Joints[Limb].CurrentAngle
  271. Joint.DesiredAngle = Joints[Limb].DesiredAngle
  272. Joints[Limb]:Remove()
  273. end
  274.  
  275.  
  276. function ResetLimbCFrame(Limb, Character)
  277. if Character == nil then return false end
  278. if Character.Parent == nil then return false end
  279. if Character:FindFirstChild("Torso") == nil then return false end
  280. local Joints = {
  281. Character.Torso:FindFirstChild("Right Shoulder 2"),
  282. Character.Torso:FindFirstChild("Left Shoulder 2"),
  283. Character.Torso:FindFirstChild("Right Hip 2"),
  284. Character.Torso:FindFirstChild("Left Hip 2")
  285. }
  286. local Limbs = {
  287. Character:FindFirstChild("Right Arm"),
  288. Character:FindFirstChild("Left Arm"),
  289. Character:FindFirstChild("Right Leg"),
  290. Character:FindFirstChild("Left Leg")
  291. }
  292. if Joints[Limb] == nil then return false end
  293. if Limbs[Limb] == nil then return false end
  294. if Limb == 1 then
  295. Joints[Limb].C0 = CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  296. Joints[Limb].C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  297. elseif Limb == 2 then
  298. Joints[Limb].C0 = CFrame.new(-1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  299. Joints[Limb].C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  300. elseif Limb == 3 then
  301. Joints[Limb].C0 = CFrame.new(0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  302. Joints[Limb].C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  303. elseif Limb == 4 then
  304. Joints[Limb].C0 = CFrame.new(-0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  305. Joints[Limb].C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  306. end
  307. end
  308.  
  309.  
  310. function EnableLimb(Limb, Character)
  311. if Character == nil then return false end
  312. if Character:FindFirstChild("Torso") == nil then return false end
  313. local Joints = {
  314. Character.Torso:FindFirstChild("Right Shoulder 2"),
  315. Character.Torso:FindFirstChild("Left Shoulder 2"),
  316. Character.Torso:FindFirstChild("Right Hip 2"),
  317. Character.Torso:FindFirstChild("Left Hip 2")
  318. }
  319. local Limbs = {
  320. Character:FindFirstChild("Right Arm"),
  321. Character:FindFirstChild("Left Arm"),
  322. Character:FindFirstChild("Right Leg"),
  323. Character:FindFirstChild("Left Leg")
  324. }
  325. if Joints[Limb] == nil then return false end
  326. if Limbs[Limb] == nil then return false end
  327. if Limb == 1 then
  328. Joints[Limb].Name = "Right Shoulder"
  329. elseif Limb == 2 then
  330. Joints[Limb].Name = "Left Shoulder"
  331. elseif Limb == 3 then
  332. Joints[Limb].Name = "Right Hip"
  333. elseif Limb == 4 then
  334. Joints[Limb].Name = "Left Hip"
  335. end
  336. Animate = Character:FindFirstChild("Animate")
  337. if Animate == nil then return false end
  338. Animate = Animate:Clone()
  339. Character.Animate:Remove()
  340. Animate.Parent = Character
  341. end
  342.  
  343.  
  344. function Weld(x, y)
  345. local weld = Instance.new("Weld")
  346. weld.Part0 = x
  347. weld.Part1 = y
  348. CJ = CFrame.new(x.Position)
  349. C0 = x.CFrame:inverse() * CJ
  350. C1 = y.CFrame:inverse() * CJ
  351. weld.C0 = C0
  352. weld.C1 = C1
  353. weld.Parent = x
  354. end
  355.  
  356.  
  357. function tagHumanoid(humanoid)
  358. local tag = Instance.new("ObjectValue")
  359. tag.Name = "creator"
  360. tag.Value = Player
  361. tag.Parent = humanoid
  362. local tag = Instance.new("StringValue")
  363. tag.Name = "creatorType1"
  364. tag.Value = Name
  365. tag.Parent = humanoid
  366. local tag = Instance.new("StringValue")
  367. tag.Name = "creatorType2"
  368. tag.Value = "blown up"
  369. tag.Parent = humanoid
  370. end
  371.  
  372.  
  373. function untagHumanoid(humanoid)
  374. if humanoid ~= nil then
  375. local tag = humanoid:FindFirstChild("creator")
  376. if tag ~= nil then
  377. tag:Remove()
  378. end
  379. local tag = humanoid:FindFirstChild("creatorType1")
  380. if tag ~= nil then
  381. tag:Remove()
  382. end
  383. local tag = humanoid:FindFirstChild("creatorType2")
  384. if tag ~= nil then
  385. tag:Remove()
  386. end
  387. end
  388. end
  389.  
  390.  
  391. function fire(v)
  392. if Player.Character:FindFirstChild(Name) == nil then makeParts("hand") end
  393. if Player.Character[Name]:FindFirstChild("Handle") == nil then return end
  394. if Player.Character[Name].Handle:FindFirstChild("Weld") ~= nil then Player.Character[Name].Handle.Weld:Remove() end
  395. local bodyVelocity = Instance.new("BodyVelocity")
  396. bodyVelocity.maxForce = Vector3.new(math.huge, math.huge, math.huge)
  397. bodyVelocity.velocity = v * 75
  398. bodyVelocity.Parent = Player.Character[Name].Handle
  399. wait(0.1)
  400. bodyVelocity:Remove()
  401. end
  402.  
  403.  
  404. function onButton1Down(mouse)
  405. if selected == false then return end
  406. if Player.Character:FindFirstChild(Name) ~= nil and Button1Down ~= true and thrown ~= true then
  407. if Player.Character[Name]:FindFirstChild("Handle") == nil then return end
  408. if Player.Character[Name]:FindFirstChild("Pin") == nil then return end
  409. Button1Down = true
  410. mouse.Icon = "rbxasset://textures\\GunWaitCursor.png"
  411. if Player.Character[Name].Pin:FindFirstChild("Weld") ~= nil then Player.Character[Name].Pin.Weld:Remove() end
  412. Player.Character[Name].Handle.Pin:Play()
  413. coroutine.resume(coroutine.create(function()
  414. wait(3)
  415. if Player.Character:FindFirstChild(Name) ~= nil then
  416. if Player.Character[Name]:FindFirstChild("Handle") ~= nil then
  417. local e = Instance.new("Explosion")
  418. e.BlastPressure = 1000000
  419. e.BlastRadius = 10
  420. e.Position = Player.Character[Name].Handle.Position
  421. e.Parent = Workspace
  422. e.Hit:connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") ~= nil then tagHumanoid(hit.Parent.Humanoid) delay(1, function() untagHumanoid(hit.Parent.Humanoid) end) end end)
  423. Player.Character[Name].Handle.Explode:Play()
  424. Player.Character[Name].Handle.Transparency = 1
  425. Player.Character[Name].Handle.CanCollide = false
  426. end
  427. end
  428. wait()
  429. if Player.Character:FindFirstChild("WeaponActivated") ~= nil then
  430. Player.Character.WeaponActivated:Remove()
  431. end
  432. thrown = false
  433. Button1Down = false
  434. selected = true
  435. onDeselected(mouse)
  436. removeParts("holster")
  437. script.Parent:Remove()
  438. end))
  439. end
  440. end
  441.  
  442.  
  443. function onButton1Up(mouse)
  444. if selected == false then return end
  445. if Button1Down == true and thrown ~= true then
  446. thrown = true
  447. mouse.Icon = "rbxasset://textures\\GunCursor.png"
  448. SetSpeed(1, 2, Player.Character)
  449. SetAngle(1, 0, Player.Character)
  450. EnableLimb(1, Player.Character)
  451. fire((mouse.Hit.p - Player.Character[Name].Handle.Position).unit)
  452. end
  453. Button1Down = false
  454. end
  455.  
  456.  
  457. function onKeyDown(key, mouse)
  458. if selected == false then return end
  459. key = key:lower()
  460. if key == "q" and Button1Down == false and thrown ~= true then
  461. if mouse.Target == nil then return end
  462. if game:GetService("Players"):GetPlayerFromCharacter(mouse.Target.Parent) ~= nil then
  463. onDeselected(mouse)
  464. removeParts("holster")
  465. script.Parent.Parent = game:GetService("Players"):GetPlayerFromCharacter(mouse.Target.Parent).Backpack
  466. end
  467. end
  468. end
  469.  
  470.  
  471. function onSelected(mouse)
  472. if selected == true then return end
  473. selected = true
  474. mouse.Icon = "rbxasset://textures\\GunWaitCursor.png"
  475. while Player.Character:FindFirstChild("WeaponActivated") ~= nil or thrown == true do
  476. if Player.Character.WeaponActivated.Value == nil then break end
  477. if Player.Character.WeaponActivated.Value.Parent == nil then break end
  478. wait()
  479. end
  480. mouse.Icon = "rbxasset://textures\\GunCursor.png"
  481. removeParts("holster")
  482. makeParts("hand")
  483. local weapon = Instance.new("ObjectValue")
  484. weapon.Name = "WeaponActivated"
  485. weapon.Value = script.Parent
  486. weapon.Parent = Player.Character
  487. DisableLimb(1, Player.Character)
  488. SetAngle(1, math.rad(200), Player.Character)
  489. mouse.Button1Down:connect(function() onButton1Down(mouse) end)
  490. mouse.Button1Up:connect(function() onButton1Up(mouse) end)
  491. mouse.KeyDown:connect(function(key) onKeyDown(key, mouse) end)
  492. end
  493.  
  494.  
  495. function onDeselected(mouse)
  496. if selected == false then return end
  497. selected = false
  498. while Button1Down == true or thrown == true do
  499. wait()
  500. end
  501. if Player.Character:FindFirstChild("WeaponActivated") ~= nil then
  502. if Player.Character.WeaponActivated.Value == script.Parent then
  503. Player.Character.WeaponActivated:Remove()
  504. end
  505. end
  506. while Player.Character:FindFirstChild("WeaponActivated") ~= nil do
  507. if Player.Character.WeaponActivated.Value == nil then break end
  508. if pcall(function() if Player.Character.WeaponActivated.Value.Parent == nil then return true end end) then break end
  509. wait()
  510. end
  511. removeParts("hand")
  512. makeParts("holster")
  513. SetAngle(1, 0, Player.Character)
  514. EnableLimb(1, Player.Character)
  515. end
  516.  
  517.  
  518. if script.Parent.ClassName ~= "HopperBin" then
  519. if Player == nil then print("Error: Player not found!") return end
  520. Tool = Instance.new("HopperBin")
  521. Tool.Name = Name
  522. Tool.Parent = Player.Backpack
  523. script.Name = "Main"
  524. script.Parent = Tool
  525. end wait() if script.Parent.ClassName == "HopperBin" then
  526. while script.Parent.Parent.ClassName ~= "Backpack" do
  527. wait()
  528. end
  529. Player = script.Parent.Parent.Parent
  530. makeParts("holster")
  531. script.Parent.Selected:connect(onSelected)
  532. script.Parent.Deselected:connect(onDeselected)
  533. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement