Advertisement
Kaemi

Untitled

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