Want more features on Pastebin? Sign Up, it's FREE!
Guest

roblox knife script

By: madman24 on Jun 26th, 2012  |  syntax: None  |  size: 10.63 KB  |  views: 21,707  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. me = game.Players.djface203
  2.  
  3. char = me.Character
  4.  
  5. selected = false
  6.  
  7. attacking = false
  8.  
  9. hurt = false
  10.  
  11. grabbed = nil
  12.  
  13. mode = "drop"
  14.  
  15. bloodcolors = {"Really red", "Bright red"}
  16.  
  17.  
  18.  
  19. function prop(part, parent, collide, tran, ref, x, y, z, color, anchor, form)
  20.  
  21. part.Parent = parent
  22.  
  23. part.formFactor = form
  24.  
  25. part.CanCollide = collide
  26.  
  27. part.Transparency = tran
  28.  
  29. part.Reflectance = ref
  30.  
  31. part.Size = Vector3.new(x,y,z)
  32.  
  33. part.BrickColor = BrickColor.new(color)
  34.  
  35. part.TopSurface = 0
  36.  
  37. part.BottomSurface = 0
  38.  
  39. part.Anchored = anchor
  40.  
  41. part.Locked = true
  42.  
  43. part:BreakJoints()
  44.  
  45. end
  46.  
  47.  
  48. function weld(w, p, p1, a, b, c, x, y, z)
  49.  
  50. w.Parent = p
  51.  
  52. w.Part0 = p
  53.  
  54. w.Part1 = p1
  55.  
  56. w.C1 = CFrame.fromEulerAnglesXYZ(a,b,c) * CFrame.new(x,y,z)
  57.  
  58. end
  59.  
  60.  
  61. function mesh(mesh, parent, x, y, z, type)
  62.  
  63. mesh.Parent = parent
  64.  
  65. mesh.Scale = Vector3.new(x, y, z)
  66.  
  67. mesh.MeshType = type
  68.  
  69. end
  70.  
  71.  
  72. function remgui()
  73.  
  74. for _,v in pairs(me.PlayerGui:GetChildren()) do
  75.  
  76. if v.Name == "Modeshow" then
  77.  
  78. v:remove()
  79.  
  80. end
  81.  
  82. end
  83.  
  84. end
  85.  
  86.  
  87. function inform(text,delay)
  88.  
  89. remgui()
  90.  
  91. local sc = Instance.new("ScreenGui")
  92.  
  93. sc.Parent = me.PlayerGui
  94.  
  95. sc.Name = "Modeshow"
  96.  
  97. local bak = Instance.new("Frame",sc)
  98.  
  99. bak.BackgroundColor3 = Color3.new(1,1,1)
  100.  
  101. bak.Size = UDim2.new(0.94,0,0.1,0)
  102.  
  103. bak.Position = UDim2.new(0.03,0,0.037,0)
  104.  
  105. bak.BorderSizePixel = 0
  106.  
  107. local gi = Instance.new("TextLabel",sc)
  108.  
  109. gi.Size = UDim2.new(0.92,0,0.09,0)
  110.  
  111. gi.BackgroundColor3 = Color3.new(0,0,0)
  112.  
  113. gi.Position = UDim2.new(0.04,0,0.042,0)
  114.  
  115. gi.TextColor3 = Color3.new(1,1,1)
  116.  
  117. gi.FontSize = "Size12"
  118.  
  119. gi.Text = text
  120.  
  121. coroutine.resume(coroutine.create(function()
  122.  
  123. wait(delay)
  124.  
  125. sc:remove()
  126.  
  127. end))
  128.  
  129. end
  130.  
  131.  
  132. if char:findFirstChild("Bricks",true) then
  133.  
  134. char:findFirstChild("Bricks",true):remove()
  135.  
  136. end
  137.  
  138.  
  139. bricks = Instance.new("Model",me.Character)
  140.  
  141. bricks.Name = "Bricks"
  142.  
  143.  
  144. --Parts-------------------------Parts-------------------------Parts-------------------------Parts----------------------
  145.  
  146.  
  147. rarm = char:findFirstChild("Right Arm")
  148.  
  149. larm = char:findFirstChild("Left Arm")
  150.  
  151. lleg = char:findFirstChild("Left Leg")
  152.  
  153. torso = char:findFirstChild("Torso")
  154.  
  155. hum = char:findFirstChild("Humanoid")
  156.  
  157.  
  158. righthold = Instance.new("Part")
  159.  
  160. prop(righthold, bricks, false, 1, 0, 0.1, 0.1, 0.1, "White", false, "Custom")
  161.  
  162. w11 = Instance.new("Weld")
  163.  
  164. weld(w11, rarm, righthold, 0, 0, 0, 0, 1, 0)
  165.  
  166.  
  167. lefthold = Instance.new("Part")
  168.  
  169. prop(lefthold, bricks, false, 1, 0, 0.1, 0.1, 0.1, "White", false, "Custom")
  170.  
  171. w12 = Instance.new("Weld")
  172.  
  173. weld(w12, larm, lefthold, 0, 0, 0, 0, 1, 0)
  174.  
  175.  
  176. hold = Instance.new("Part")
  177.  
  178. prop(hold, bricks, false, 0, 0, 0.2, 0.4, 0.7, "Really red", false, "Custom")
  179.  
  180. oh = Instance.new("Weld")
  181.  
  182. weld(oh, lleg, hold, -math.pi/1.4, 0, math.rad(35), 0.55, -0.9, 0.3)
  183.  
  184.  
  185. knife = Instance.new("Part")
  186.  
  187. prop(knife, bricks, false, 0, 0, 0.35, 1.1, 0.5, "Really black", false, "Custom")
  188.  
  189. orr = Instance.new("Weld")
  190.  
  191. weld(orr, hold, knife, 0, 0, 0, 0, 0.7, 0)
  192.  
  193. ar = Instance.new("Weld")
  194.  
  195. weld(ar, lefthold, nil, math.pi/2, 0, math.pi, 0, 0, 0)
  196.  
  197.  
  198.  
  199. blade = Instance.new("Part")
  200.  
  201. prop(blade, bricks, false, 0, 0, 0.1, 1.5, 0.4, "Medium grey", false, "Custom")
  202.  
  203. Instance.new("BlockMesh",blade).Scale = Vector3.new(0.3,1,1)
  204.  
  205. w2 = Instance.new("Weld")
  206.  
  207. weld(w2, knife, blade, 0, 0, 0, 0, -1.2, 0)
  208.  
  209.  
  210. blade2 = Instance.new("Part")
  211.  
  212. prop(blade2, bricks, false, 0, 0, 0.1, 0.5, 0.4, "Medium grey", false, "Custom")
  213.  
  214. local mew = Instance.new("SpecialMesh",blade2)
  215.  
  216. mew.MeshType = "Wedge"
  217.  
  218. mew.Scale = Vector3.new(0.3,1,1)
  219.  
  220. w3 = Instance.new("Weld")
  221.  
  222. weld(w3, blade, blade2, 0, 0, 0, 0, -1, 0)
  223.  
  224.  
  225.  
  226.  
  227.  
  228. rb = Instance.new("Part")
  229.  
  230. prop(rb, bricks, false, 1, 0, 0.1, 0.1, 0.1, "White", false, "Custom")
  231.  
  232. w13 = Instance.new("Weld")
  233.  
  234. weld(w13, torso, rb, 0, 0, 0, -1.5, -0.5, 0)
  235.  
  236.  
  237. lb = Instance.new("Part")
  238.  
  239. prop(lb, bricks, false, 1, 0, 0.1, 0.1, 0.1, "White", false, "Custom")
  240.  
  241. w14 = Instance.new("Weld")
  242.  
  243. weld(w14, torso, lb, 0, 0, 0, 1.5, -0.5, 0)
  244.  
  245.  
  246. rw = Instance.new("Weld")
  247.  
  248. weld(rw, rb, nil, 0, 0, 0, 0, 0.5, 0)
  249.  
  250.  
  251. lw = Instance.new("Weld")
  252.  
  253. weld(lw, lb, nil, 0, 0, 0, 0, 0.5, 0)
  254.  
  255.  
  256. grabweld = nil
  257.  
  258. platlol = nil
  259.  
  260. lolhum = nil
  261.  
  262.  
  263. function touch(h)
  264.  
  265. if hurt then
  266.  
  267. if grabbed == nil then
  268.  
  269. local hu = h.Parent:findFirstChild("Humanoid")
  270.  
  271. local head = h.Parent:findFirstChild("Head")
  272.  
  273. local torz = h.Parent:findFirstChild("Torso")
  274.  
  275. if hu ~= nil and head ~= nil and torz ~= nil and h.Parent.Name ~= name then
  276.  
  277. if hu.Health > 0 then
  278.  
  279. grabbed = torz
  280.  
  281. hu.PlatformStand = true
  282.  
  283. local w = Instance.new("Weld")
  284.  
  285. weld(w,righthold,grabbed,math.pi/2,0.2,0,0.7,-0.9,-0.6)
  286.  
  287. grabweld = w
  288.  
  289. lolhum = hu
  290.  
  291. local lolxd = true
  292.  
  293. platlol = lolxd
  294.  
  295. hu.Changed:connect(function(prop)
  296.  
  297. if prop == "PlatformStand" and platlol then
  298.  
  299. hu.PlatformStand = true
  300.  
  301. end
  302.  
  303. end)
  304.  
  305. end
  306.  
  307. end
  308.  
  309. end
  310.  
  311. end
  312.  
  313. end
  314.  
  315.  
  316. righthold.Touched:connect(touch)
  317.  
  318. lefthold.Touched:connect(touch)
  319.  
  320.  
  321. function bleed(part,po)
  322.  
  323. local lol1 = math.random(5,30)/100
  324.  
  325. local lol2 = math.random(5,30)/100
  326.  
  327. local lol3 =math.random(5,30)/100
  328.  
  329. local lol4 = math.random(1,#bloodcolors)
  330.  
  331. local p = Instance.new("Part")
  332.  
  333. prop(p,part.Parent,false,0,0,lol1,lol2,lol3,bloodcolors[lol4],false,"Custom")
  334.  
  335. p.CFrame = part.CFrame * CFrame.new(math.random(-5,5)/10,po,math.random(-5,5)/10)
  336.  
  337. p.Velocity = Vector3.new(math.random(-190,190)/10,math.random(-190,190)/10,math.random(-190,190)/10)
  338.  
  339. p.RotVelocity = Vector3.new(math.random(-400,400)/10,math.random(-400,400)/10,math.random(-400,400)/10)
  340.  
  341. coroutine.resume(coroutine.create(function()
  342.  
  343. wait(3)
  344.  
  345. p:remove()
  346.  
  347. end))
  348.  
  349. end
  350.  
  351.  
  352. if script.Parent.className ~= "HopperBin" then
  353.  
  354. h = Instance.new("HopperBin",me.Backpack)
  355.  
  356. h.Name = "Grab"
  357.  
  358. script.Parent = h
  359.  
  360. end
  361.  
  362.  
  363. bin = script.Parent
  364.  
  365.  
  366. function select(mouse)
  367.  
  368. orr.Part1 = nil
  369.  
  370. ar.Part1 = knife
  371.  
  372. mouse.Button1Down:connect(function()
  373.  
  374. if attacking == false then
  375.  
  376. attacking = true
  377.  
  378. lw.Part1 = larm
  379.  
  380. rw.Part1 = rarm
  381.  
  382. hurt = true
  383.  
  384. for i=1, 8 do
  385.  
  386. rw.C0 = rw.C0 * CFrame.new(-0.03,0,-0.08) * CFrame.fromEulerAnglesXYZ(0.18,0.04,0)
  387.  
  388. lw.C0 = lw.C0 * CFrame.new(0.06,0,-0.06) * CFrame.fromEulerAnglesXYZ(0.15,-0.11,-0.05)
  389.  
  390. wait()
  391.  
  392. end
  393.  
  394. wait(1)
  395.  
  396. hurt = false
  397.  
  398. if grabbed == nil then
  399.  
  400. for i=1, 4 do
  401.  
  402. rw.C0 = rw.C0 * CFrame.new(0.06,0,0.16) * CFrame.fromEulerAnglesXYZ(-0.36,-0.08,0)
  403.  
  404. lw.C0 = lw.C0 * CFrame.new(-0.12,0,0.12) * CFrame.fromEulerAnglesXYZ(-0.3,0.22,0.05)
  405.  
  406. wait()
  407.  
  408. end
  409.  
  410. lw.C0 = CFrame.new(0,0,0)
  411.  
  412. rw.C0 = CFrame.new(0,0,0)
  413.  
  414. lw.Part1 = nil
  415.  
  416. rw.Part1 = nil
  417.  
  418. attacking = false
  419.  
  420. end
  421.  
  422. elseif hurt == false and grabbed ~= nil and mode == "drop" then
  423.  
  424. grabweld:remove()
  425.  
  426. grabweld = nil
  427.  
  428. platlol = false
  429.  
  430. grabbed = nil
  431.  
  432. lolhum.PlatformStand = false
  433.  
  434. lolhum = nil
  435.  
  436. for i=1, 4 do
  437.  
  438. rw.C0 = rw.C0 * CFrame.new(0.06,0,0.16) * CFrame.fromEulerAnglesXYZ(-0.36,-0.08,0)
  439.  
  440. lw.C0 = lw.C0 * CFrame.new(-0.12,0,0.16) * CFrame.fromEulerAnglesXYZ(-0.3,0.2,0)
  441.  
  442. wait()
  443.  
  444. end
  445.  
  446. lw.C0 = CFrame.new(0,0,0)
  447.  
  448. rw.C0 = CFrame.new(0,0,0)
  449.  
  450. lw.Part1 = nil
  451.  
  452. rw.Part1 = nil
  453.  
  454. attacking = false
  455.  
  456. platlol = nil
  457.  
  458. elseif hurt == false and grabbed ~= nil and grabweld ~= nil and mode == "throw" then
  459.  
  460. grabweld:remove()
  461.  
  462. grabweld = nil
  463.  
  464. local bf = Instance.new("BodyForce",grabbed)
  465.  
  466. bf.force = torso.CFrame.lookVector * 8500
  467.  
  468. bf.force = bf.force + Vector3.new(0,7400,0)
  469.  
  470. coroutine.resume(coroutine.create(function()
  471.  
  472. wait(0.12)
  473.  
  474. bf:remove()
  475.  
  476. end))
  477.  
  478. for i=1, 6 do
  479.  
  480. rw.C0 = rw.C0 * CFrame.new(0,0,0) * CFrame.fromEulerAnglesXYZ(0.35,0,0)
  481.  
  482. lw.C0 = lw.C0 * CFrame.new(0,0,0) * CFrame.fromEulerAnglesXYZ(-0.18,0,0)
  483.  
  484. wait()
  485.  
  486. end
  487.  
  488. for i=1, 4 do
  489.  
  490. rw.C0 = rw.C0 * CFrame.new(0,0,0) * CFrame.fromEulerAnglesXYZ(-0.47,0,0)
  491.  
  492. lw.C0 = lw.C0 * CFrame.new(0,0,0) * CFrame.fromEulerAnglesXYZ(0.2,0,0)
  493.  
  494. wait()
  495.  
  496. end
  497.  
  498. wait(0.2)
  499.  
  500. platlol = false
  501.  
  502. grabbed = nil
  503.  
  504. lolhum.PlatformStand = false
  505.  
  506. lolhum = nil
  507.  
  508. for i=1, 4 do
  509.  
  510. rw.C0 = rw.C0 * CFrame.new(0.06,0,0.16) * CFrame.fromEulerAnglesXYZ(-0.36,-0.08,0)
  511.  
  512. lw.C0 = lw.C0 * CFrame.new(-0.12,0,0.16) * CFrame.fromEulerAnglesXYZ(-0.3,0.2,0)
  513.  
  514. wait()
  515.  
  516. end
  517.  
  518. lw.C0 = CFrame.new(0,0,0)
  519.  
  520. rw.C0 = CFrame.new(0,0,0)
  521.  
  522. lw.Part1 = nil
  523.  
  524. rw.Part1 = nil
  525.  
  526. attacking = false
  527.  
  528. platlol = nil
  529.  
  530. elseif hurt == false and grabbed ~= nil and lolhum ~= nil and grabweld ~= nil and mode == "kill" then
  531.  
  532. for i=1, 5 do
  533.  
  534. lw.C0 = lw.C0 * CFrame.new(0.02,0.12,0.1) * CFrame.fromEulerAnglesXYZ(-0.05,0,-0.03)
  535.  
  536. wait()
  537.  
  538. end
  539.  
  540. local ne = grabbed:findFirstChild("Neck")
  541.  
  542. coroutine.resume(coroutine.create(function()
  543.  
  544. local duh = grabbed
  545.  
  546. local duh2 = grabbed.Parent.Head
  547.  
  548. local lolas = lolhum
  549.  
  550. duh.RotVelocity = Vector3.new(math.random(-20,20),math.random(-20,20),math.random(-20,20))
  551.  
  552. for i=1, 60 do
  553.  
  554. wait()
  555.  
  556. local hm = math.random(1,9)
  557.  
  558. pcall(function()
  559.  
  560. if hm == 1 then
  561.  
  562. duh2.Sound.Pitch = math.random(90,110)/100
  563.  
  564. duh2.Sound:play()
  565.  
  566. end
  567.  
  568. end)
  569.  
  570. if hm > 0 and hm < 3 then
  571.  
  572. bleed(duh,1)
  573.  
  574. bleed(duh2,-0.5)
  575.  
  576. end
  577.  
  578. end
  579.  
  580. lolas.Health = 0
  581.  
  582. for i=1, 85 do
  583.  
  584. wait()
  585.  
  586. local hm = math.random(1,9)
  587.  
  588. pcall(function()
  589.  
  590. if hm == 1 then
  591.  
  592. duh2.Sound.Pitch = math.random(90,110)/100
  593.  
  594. duh2.Sound:play()
  595.  
  596. end
  597.  
  598. end)
  599.  
  600. if hm > 0 and hm < 3 then
  601.  
  602. bleed(duh,1)
  603.  
  604. bleed(duh2,-0.5)
  605.  
  606. end
  607.  
  608. end
  609.  
  610. end))
  611.  
  612. for i=1, 3 do
  613.  
  614. lw.C0 = lw.C0 * CFrame.new(0.02,0.12,0.1) * CFrame.fromEulerAnglesXYZ(-0.05,0,-0.03)
  615.  
  616. if ne ~= nil then
  617.  
  618. grabbed.Neck.C0 = grabbed.Neck.C0 * CFrame.fromEulerAnglesXYZ(-0.35,0,0)
  619.  
  620. end
  621.  
  622. wait()
  623.  
  624. end
  625.  
  626. grabweld:remove()
  627.  
  628. grabweld = nil
  629.  
  630. for i=1, 4 do
  631.  
  632. lw.C0 = lw.C0 * CFrame.new(-0.04,-0.24,-0.2) * CFrame.fromEulerAnglesXYZ(0.1,0,0.06)
  633.  
  634. wait()
  635.  
  636. end
  637.  
  638. for i=1, 4 do
  639.  
  640. rw.C0 = rw.C0 * CFrame.new(0.06,0,0.16) * CFrame.fromEulerAnglesXYZ(-0.36,-0.08,0)
  641.  
  642. lw.C0 = lw.C0 * CFrame.new(-0.12,0,0.12) * CFrame.fromEulerAnglesXYZ(-0.3,0.22,0.05)
  643.  
  644. wait()
  645.  
  646. end
  647.  
  648. lw.C0 = CFrame.new(0,0,0)
  649.  
  650. rw.C0 = CFrame.new(0,0,0)
  651.  
  652. lw.Part1 = nil
  653.  
  654. rw.Part1 = nil
  655.  
  656. platlol = false
  657.  
  658. grabbed = nil
  659.  
  660. lolhum = nil
  661.  
  662. attacking = false
  663.  
  664. platlol = nil
  665.  
  666. end
  667.  
  668. end)
  669.  
  670. mouse.KeyDown:connect(function(kai)
  671.  
  672. key = kai:lower()
  673.  
  674. if key == "q" then
  675.  
  676. mode = "drop"
  677.  
  678. inform("Mode: Drop",2)
  679.  
  680. elseif key == "e" then
  681.  
  682. mode = "throw"
  683.  
  684. inform("Mode: Throw",2)
  685.  
  686. elseif key == "f" then
  687.  
  688. mode = "kill"
  689.  
  690. inform("Mode: Kill",2)
  691.  
  692. end
  693.  
  694. end)
  695.  
  696. end
  697.  
  698.  
  699. function desel()
  700.  
  701. repeat wait() until attacking == false
  702.  
  703. orr.Part1 = knife
  704.  
  705. ar.Part1 = nil
  706.  
  707. end
  708.  
  709.  
  710. bin.Selected:connect(select)
  711.  
  712. bin.Deselected:connect(desel)
  713.  
  714.  
  715. char.Humanoid.Died:connect(function()
  716.  
  717. pcall(function()
  718.  
  719. grabweld:remove()
  720.  
  721. grabweld = nil
  722.  
  723. grabbed = nil
  724.  
  725. platlol = false
  726.  
  727. platlol = nil
  728.  
  729. end)
  730.  
  731. end)
  732.  
  733.  
  734. inform("Grab script loaded succesfully.",2)
clone this paste RAW Paste Data