Advertisement
LuaExploitz

CHAINSAW!!!!!!!!!!!!!!!!!!!!

Oct 6th, 2016
226
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 18.33 KB | None | 0 0
  1.  
  2.  
  3. if script == nil then return end
  4.  
  5.  
  6. Player = game.Players.LocalPlayer
  7. Char = Player.Character
  8. animate = Char:findFirstChild("Animate")
  9. if animate then
  10. animate:remove()
  11. end
  12. Name = "Chainsaw"
  13. selected = false
  14. Button1Down = false
  15. damage = 10
  16. canUse = true
  17. activated = false
  18. swordType = "normal"
  19.  
  20.  
  21. animation = {}
  22. animation["slashing"] = nil
  23.  
  24.  
  25. function makeParts(format)
  26.     local model = Instance.new("Model")
  27.     model.Name = Name
  28.     model.Parent = Player.Character
  29.     local pm2 = Instance.new("Part")
  30.     pm2.Name = "Weld Point"
  31.     pm2.FormFactor = "Custom"
  32.     pm2.Size = Vector3.new(1, 1, 1)
  33.     pm2.BrickColor = BrickColor.new("Really black")
  34.     pm2.Transparency = 1
  35.     pm2.Locked = true
  36.     pm2.TopSurface = 0
  37.     pm2.BottomSurface = 0
  38.     pm2.Parent = model
  39.     if format ~= nil then
  40.         local w = Instance.new("Weld")
  41.         w.Part0 = pm2
  42.         if format == "hand" then
  43.             w.Part1 = Player.Character:FindFirstChild("Right Arm")
  44.             w.C0 = CFrame.new(0, 1.1, 0.3)
  45.             w.C1 = CFrame.new()
  46.             w.Parent = pm2
  47.         elseif format == "holster" then
  48.             w.Part1 = Player.Character:FindFirstChild("Torso")
  49.             w.C0 = CFrame.new(-0.9, -0.5, -0.8) * CFrame.fromEulerAnglesXYZ(math.rad(90), math.rad(90), 0)
  50.             w.C1 = CFrame.new()
  51.             w.Parent = pm2
  52.             model.Name = Name.. " (Holstered)"
  53.         else
  54.             print("Error: Incorrect format string!")
  55.         end
  56.     end
  57.     local pm = Instance.new("Part")
  58.     pm.Name = "Handle"
  59.     pm.FormFactor = "Custom"
  60.     pm.Size = Vector3.new(1, 1, 1)
  61.     pm.BrickColor = BrickColor.new("Bright orange")
  62.     pm.Reflectance = 0.025
  63.     pm.Locked = true
  64.     pm.TopSurface = 0
  65.     pm.BottomSurface = 0
  66.     pm.Parent = model
  67.     local m = Instance.new("SpecialMesh")
  68.     m.MeshType = "Brick"
  69.     m.Scale = Vector3.new(0.6, 0.9, 1)
  70.     m.Parent = pm
  71.     local w = Instance.new("Weld")
  72.     w.Part0 = pm
  73.     w.Part1 = pm2
  74.     w.C0 = CFrame.new()
  75.     w.C1 = CFrame.new()
  76.     w.Parent = pm
  77.     local s = Instance.new("Sound")
  78.     s.Name = "Start"
  79.     s.SoundId = "http://www.roblox.com/Asset/?id=2766589"
  80.     s.Volume = 1
  81.     s.Pitch = 2
  82.     s.Looped = false
  83.     s.Parent = pm
  84.     local s = Instance.new("Sound")
  85.     s.Name = "Saw"
  86.     s.SoundId = "http://www.roblox.com/Asset/?id=2766576"
  87.     s.Volume = 1
  88.     s.Pitch = 0.25
  89.     s.Looped = true
  90.     s.Parent = pm
  91.     local p = Instance.new("Part")
  92.     p.Name = "Back"
  93.     p.FormFactor = "Custom"
  94.     p.Size = Vector3.new(1, 1, 1)
  95.     p.BrickColor = BrickColor.new("Bright orange")
  96.     p.Reflectance = 0.025
  97.     p.Locked = true
  98.     p.TopSurface = 0
  99.     p.BottomSurface = 0
  100.     p.Parent = model
  101.     local m = Instance.new("SpecialMesh")
  102.     m.MeshType = "Wedge"
  103.     m.Scale = Vector3.new(0.6, 0.8, 0.9)
  104.     m.Parent = p
  105.     local w = Instance.new("Weld")
  106.     w.Part0 = p
  107.     w.Part1 = pm
  108.     w.C0 = CFrame.new(0, -0.9, 0) * CFrame.fromEulerAnglesXYZ(math.rad(270), 0, 0)
  109.     w.C1 = CFrame.new()
  110.     w.Parent = p
  111.     local p = Instance.new("Part")
  112.     p.Name = "Blade"
  113.     p.FormFactor = "Custom"
  114.     p.Size = Vector3.new(1, 1, 3)
  115.     p.CanCollide = false
  116.     p.BrickColor = BrickColor.new("Institutional white")
  117.     p.Reflectance = 0.2
  118.     p.Locked = true
  119.     p.TopSurface = 0
  120.     p.BottomSurface = 0
  121.     p.Parent = model
  122.     local m = Instance.new("SpecialMesh")
  123.     m.MeshType = "Brick"
  124.     m.Scale = Vector3.new(0.03, 0.7, 0.9)
  125.     m.Parent = p
  126.     local w = Instance.new("Weld")
  127.     w.Part0 = p
  128.     w.Part1 = pm
  129.     w.C0 = CFrame.new(0, 0.075, 1.85)
  130.     w.C1 = CFrame.new()
  131.     w.Parent = p
  132.     p.Touched:connect(function(hit) onTouched(hit, p, "sword") end)
  133.     local p = Instance.new("Part")
  134.     p.Name = "Blade Tip"
  135.     p.FormFactor = "Custom"
  136.     p.Size = Vector3.new(1, 1, 1)
  137.     p.CanCollide = false
  138.     p.BrickColor = BrickColor.new("Institutional white")
  139.     p.Reflectance = 0.2
  140.     p.Locked = true
  141.     p.TopSurface = 0
  142.     p.BottomSurface = 0
  143.     p.Parent = model
  144.     local m = Instance.new("CylinderMesh")
  145.     m.Scale = Vector3.new(0.7, 0.03, 0.7)
  146.     m.Parent = p
  147.     local w = Instance.new("Weld")
  148.     w.Part0 = p
  149.     w.Part1 = pm
  150.     w.C0 = CFrame.new(-0.075, 0, 3.2) * CFrame.fromEulerAnglesXYZ(0, 0, math.rad(90))
  151.     w.C1 = CFrame.new()
  152.     w.Parent = p
  153.     p.Touched:connect(function(hit) onTouched(hit, p, "sword") end)
  154. end
  155.  
  156.  
  157. function removeParts(format)
  158.     if format == "hand" then
  159.         if Player.Character:FindFirstChild(Name) ~= nil then
  160.             Player.Character[Name]:Remove()
  161.         end
  162.     elseif format == "holster" then
  163.         if Player.Character:FindFirstChild(Name.. " (Holstered)") ~= nil then
  164.             Player.Character[Name.. " (Holstered)"]:Remove()
  165.         end
  166.     end
  167. end
  168.  
  169.  
  170. function onTouched(hit, source, format)
  171.     if format == "sword" then
  172.         if hit.Parent:FindFirstChild("Humanoid") ~= nil and hit.Parent ~= Player.Character then
  173.             tagHumanoid(hit.Parent.Humanoid)
  174.             if swordType == "normal" then
  175.                 hit.Parent.Humanoid:TakeDamage(1)
  176.             elseif swordType == "slash" then
  177.                 hit.Parent.Humanoid:TakeDamage(damage)
  178.             end
  179.             delay(3, function() untagHumanoid(hit.Parent.Humanoid) end)
  180.         end
  181.     end
  182. end
  183.  
  184.  
  185. function SetAngle(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.     end
  197.     if Joint == 2 or Joint == 4 then
  198.         Joints[Joint].DesiredAngle = -Angle
  199.     end
  200. end
  201.  
  202.  
  203. function ForceAngle(Joint, Angle, Character)
  204.     if Character == nil then return false end
  205.     local Joints = {
  206.         Character.Torso:FindFirstChild("Right Shoulder 2"),
  207.         Character.Torso:FindFirstChild("Left Shoulder 2"),
  208.         Character.Torso:FindFirstChild("Right Hip 2"),
  209.         Character.Torso:FindFirstChild("Left Hip 2")
  210.     }
  211.     if Joints[Joint] == nil then return false end
  212.     if Joint == 1 or Joint == 3 then
  213.         Joints[Joint].DesiredAngle = Angle
  214.         Joints[Joint].CurrentAngle = Angle
  215.     end
  216.     if Joint == 2 or Joint == 4 then
  217.         Joints[Joint].DesiredAngle = -Angle
  218.         Joints[Joint].CurrentAngle = -Angle
  219.     end
  220. end
  221.  
  222.  
  223. function SetSpeed(Joint, Speed, Character)
  224.     if Character == nil then return false end
  225.     local Joints = {
  226.         Character.Torso:FindFirstChild("Right Shoulder 2"),
  227.         Character.Torso:FindFirstChild("Left Shoulder 2"),
  228.         Character.Torso:FindFirstChild("Right Hip 2"),
  229.         Character.Torso:FindFirstChild("Left Hip 2")
  230.     }
  231.     if Joints[Joint] == nil then return false end
  232.     Joints[Joint].MaxVelocity = Speed
  233. end
  234.  
  235.  
  236. function DisableLimb(Limb, Character)
  237.     if Character == nil then return false end
  238.     if Character:FindFirstChild("Torso") == nil then return false end
  239.     local Joints = {
  240.         Character.Torso:FindFirstChild("Right Shoulder"),
  241.         Character.Torso:FindFirstChild("Left Shoulder"),
  242.         Character.Torso:FindFirstChild("Right Hip"),
  243.         Character.Torso:FindFirstChild("Left Hip")
  244.     }
  245.     local Limbs = {
  246.         Character:FindFirstChild("Right Arm"),
  247.         Character:FindFirstChild("Left Arm"),
  248.         Character:FindFirstChild("Right Leg"),
  249.         Character:FindFirstChild("Left Leg")
  250.     }
  251.     if Joints[Limb] == nil then return false end
  252.     if Limbs[Limb] == nil then return false end
  253.     local Joint = Instance.new("Motor")
  254.     Joint.Parent = Character.Torso
  255.     Joint.Part0 = Character.Torso
  256.     Joint.Part1 = Limbs[Limb]
  257.     if Limb == 1 then
  258.         Joint.C0 = CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  259.         Joint.C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  260.         Joint.Name = "Right Shoulder 2"
  261.     elseif Limb == 2 then
  262.         Joint.C0 = CFrame.new(-1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  263.         Joint.C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  264.         Joint.Name = "Left Shoulder 2"
  265.     elseif Limb == 3 then
  266.         Joint.C0 = CFrame.new(0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  267.         Joint.C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  268.         Joint.Name = "Right Hip 2"
  269.     elseif Limb == 4 then
  270.         Joint.C0 = CFrame.new(-0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  271.         Joint.C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  272.         Joint.Name = "Left Hip 2"
  273.     end
  274.     Joint.MaxVelocity = Joints[Limb].MaxVelocity
  275.     Joint.CurrentAngle = Joints[Limb].CurrentAngle
  276.     Joint.DesiredAngle = Joints[Limb].DesiredAngle
  277.     Joints[Limb]:Remove()
  278. end
  279.  
  280.  
  281. function ResetLimbCFrame(Limb, Character)
  282.     if Character == nil then return false end
  283.     if Character.Parent == nil then return false end
  284.     if Character:FindFirstChild("Torso") == nil then return false end
  285.     local Joints = {
  286.         Character.Torso:FindFirstChild("Right Shoulder 2"),
  287.         Character.Torso:FindFirstChild("Left Shoulder 2"),
  288.         Character.Torso:FindFirstChild("Right Hip 2"),
  289.         Character.Torso:FindFirstChild("Left Hip 2")
  290.     }
  291.     local Limbs = {
  292.         Character:FindFirstChild("Right Arm"),
  293.         Character:FindFirstChild("Left Arm"),
  294.         Character:FindFirstChild("Right Leg"),
  295.         Character:FindFirstChild("Left Leg")
  296.     }
  297.     if Joints[Limb] == nil then return false end
  298.     if Limbs[Limb] == nil then return false end
  299.     if Limb == 1 then
  300.         Joints[Limb].C0 = CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  301.         Joints[Limb].C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  302.     elseif Limb == 2 then
  303.         Joints[Limb].C0 = CFrame.new(-1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  304.         Joints[Limb].C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  305.     elseif Limb == 3 then
  306.         Joints[Limb].C0 = CFrame.new(0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  307.         Joints[Limb].C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  308.     elseif Limb == 4 then
  309.         Joints[Limb].C0 = CFrame.new(-0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  310.         Joints[Limb].C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  311.     end
  312. end
  313.  
  314.  
  315. function EnableLimb(Limb, Character)
  316.     if Character == nil then return false end
  317.     if Character:FindFirstChild("Torso") == nil then return false end
  318.     local Joints = {
  319.         Character.Torso:FindFirstChild("Right Shoulder 2"),
  320.         Character.Torso:FindFirstChild("Left Shoulder 2"),
  321.         Character.Torso:FindFirstChild("Right Hip 2"),
  322.         Character.Torso:FindFirstChild("Left Hip 2")
  323.     }
  324.     local Limbs = {
  325.         Character:FindFirstChild("Right Arm"),
  326.         Character:FindFirstChild("Left Arm"),
  327.         Character:FindFirstChild("Right Leg"),
  328.         Character:FindFirstChild("Left Leg")
  329.     }
  330.     if Joints[Limb] == nil then return false end
  331.     if Limbs[Limb] == nil then return false end
  332.     if Limb == 1 then
  333.         Joints[Limb].Name = "Right Shoulder"
  334.     elseif Limb == 2 then
  335.         Joints[Limb].Name = "Left Shoulder"
  336.     elseif Limb == 3 then
  337.         Joints[Limb].Name = "Right Hip"
  338.     elseif Limb == 4 then
  339.         Joints[Limb].Name = "Left Hip"
  340.     end
  341.     Animate = Character:FindFirstChild("Animate")
  342.     if Animate == nil then return false end
  343.     Animate = Animate:Clone()
  344.     Character.Animate:Remove()
  345.     Animate.Parent = Character
  346. end
  347.  
  348.  
  349. function playAnimation(format, mouse)
  350.     if format == "normal" then
  351.         SetSpeed(1, 0.2, Player.Character)
  352.         SetAngle(1, math.rad(90), Player.Character)
  353.     end
  354.     if format == "slashStart" then
  355.         SetSpeed(1, 0.5, Player.Character)
  356.         SetAngle(1, math.rad(10), Player.Character)
  357.         wait(0.05)
  358.         animation["slashing"] = true
  359.         while animation["slashing"] == true do
  360.             SetSpeed(1, 0.075, Player.Character)
  361.             SetAngle(1, math.rad(math.random(10, 45)), Player.Character)
  362.             Player.Character[Name].Handle.Weld.C0 = CFrame.new(0, 0, 0) * CFrame.fromEulerAnglesXYZ(math.rad(math.random(-30, 30)), 0, 0)
  363.             wait(math.random(5, 10) / 100)
  364.         end
  365.     end
  366.     if format == "slashEnd" then
  367.         animation["slashing"] = false
  368.         SetSpeed(1, 0.5, Player.Character)
  369.         SetAngle(1, math.rad(90), Player.Character)
  370.         Player.Character[Name].Handle.Weld.C0 = CFrame.new()
  371.     end
  372. end
  373.  
  374.  
  375. function Weld(x, y)
  376.     local weld = Instance.new("Weld")
  377.     weld.Part0 = x
  378.     weld.Part1 = y
  379.     CJ = CFrame.new(x.Position)
  380.     C0 = x.CFrame:inverse() * CJ
  381.     C1 = y.CFrame:inverse() * CJ
  382.     weld.C0 = C0
  383.     weld.C1 = C1
  384.     weld.Parent = x
  385. end
  386.  
  387.  
  388. function tagHumanoid(humanoid)
  389.     local tag = Instance.new("ObjectValue")
  390.     tag.Name = "creator"
  391.     tag.Value = Player
  392.     tag.Parent = humanoid
  393.     local tag = Instance.new("StringValue")
  394.     tag.Name = "creatorType1"
  395.     tag.Value = Name
  396.     tag.Parent = humanoid
  397.     local tag = Instance.new("StringValue")
  398.     tag.Name = "creatorType2"
  399.     tag.Value = "cut into pieces"
  400.     tag.Parent = humanoid
  401. end
  402.  
  403.  
  404. function untagHumanoid(humanoid)
  405.     if humanoid ~= nil then
  406.         local tag = humanoid:FindFirstChild("creator")
  407.         if tag ~= nil then
  408.             tag:Remove()
  409.         end
  410.         local tag = humanoid:FindFirstChild("creatorType1")
  411.         if tag ~= nil then
  412.             tag:Remove()
  413.         end
  414.         local tag = humanoid:FindFirstChild("creatorType2")
  415.         if tag ~= nil then
  416.             tag:Remove()
  417.         end
  418.     end
  419. end
  420.  
  421.  
  422. function onButton1Down(mouse)
  423.     if selected == false then return end
  424.     if Player.Character:FindFirstChild(Name) ~= nil and Button1Down == false and canUse == true and activated == true then
  425.         if Player.Character[Name]:FindFirstChild("Handle") == nil then return end
  426.         mouse.Icon = "rbxasset://textures\\GunWaitCursor.png"
  427.         Button1Down = true
  428.         canUse = false
  429.         coroutine.resume(coroutine.create(function() playAnimation("slashStart") end))
  430.         for i = 0.25, 1, 0.1 do
  431.             Player.Character[Name].Handle.Saw.Pitch = i
  432.             wait()
  433.         end
  434.         swordType = "slash"
  435.         canUse = true
  436.     end
  437. end
  438.  
  439.  
  440. function onButton1Up(mouse)
  441.     if selected == false or Button1Down == false then return end
  442.     Button1Down = false
  443.     while canUse == false do wait() end
  444.     canUse = false
  445.     coroutine.resume(coroutine.create(function() playAnimation("slashEnd") end))
  446.     for i = 1, 0.25, -0.05 do
  447.         Player.Character[Name].Handle.Saw.Pitch = i
  448.         wait()
  449.     end
  450.     Player.Character[Name].Handle.Saw.Pitch = 0.25
  451.     swordType = "normal"
  452.     mouse.Icon = "rbxasset://textures\\GunCursor.png"
  453.     canUse = true
  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 canUse == 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.     if key == "e" and Button1Down == false and canUse == true then
  469.         if activated == true then
  470.             canUse = false
  471.             for i = 1, 0, -0.05 do
  472.                 Player.Character[Name].Handle.Saw.Volume = i
  473.                 Player.Character[Name].Handle.Saw.Pitch = Player.Character[Name].Handle.Saw.Pitch / 1.05
  474.                 wait()
  475.             end
  476.             Player.Character[Name].Handle.Saw:Stop()
  477.             Player.Character[Name].Handle.Start.Pitch = 1
  478.             Player.Character[Name].Handle.Start.Volume = 1
  479.             Player.Character[Name].Handle.Start:Play()
  480.             activated = false
  481.             wait(0.3)
  482.             canUse = true
  483.         elseif activated == false then
  484.             canUse = false
  485.             Player.Character[Name].Handle.Start.Volume = 1
  486.             Player.Character[Name].Handle.Start.Pitch = 1
  487.             Player.Character[Name].Handle.Start:Play()
  488.             wait(0.2)
  489.             activated = true
  490.             Player.Character[Name].Handle.Saw:Play()
  491.             for i = 0, 1, 0.05 do
  492.                 Player.Character[Name].Handle.Saw.Volume = i
  493.                 Player.Character[Name].Handle.Saw.Pitch = i / 4
  494.                 wait()
  495.             end
  496.             Player.Character[Name].Handle.Saw.Volume = 1
  497.             Player.Character[Name].Handle.Saw.Pitch = 0.25
  498.             canUse = true
  499.         end
  500.     end
  501.     if key == "r" and Button1Down == false and canUse == true and activated == true then
  502.         canUse = false
  503.         Player.Character[Name].Handle.Start.Pitch = math.random(9, 15) / 10
  504.         Player.Character[Name].Handle.Start.Volume = 1
  505.         Player.Character[Name].Handle.Start:Play()
  506.         for i = 0, 1.5, 0.1 do
  507.             Player.Character[Name].Handle.Saw.Pitch = (math.sin(i) / 1.25) + 0.25
  508.             wait()
  509.         end
  510.         for i = 1.5, 3.1, 0.05 do
  511.             Player.Character[Name].Handle.Saw.Pitch = (math.sin(i) / 1.25) + 0.25
  512.             wait()
  513.         end
  514.         Player.Character[Name].Handle.Saw.Pitch = 0.25
  515.         canUse = true
  516.     end
  517.     if key == "t" and Button1Down == false and canUse == true and activated == true then
  518.         canUse = false
  519.         Player.Character[Name].Handle.Start.Pitch = math.random(9, 15) / 10
  520.         Player.Character[Name].Handle.Start.Volume = 1
  521.         Player.Character[Name].Handle.Start:Play()
  522.         wait(0.2)
  523.         canUse = true
  524.     end
  525. end
  526.  
  527.  
  528. function onSelected(mouse)
  529.     if selected == true then return end
  530.     selected = true
  531.     mouse.Icon = "rbxasset://textures\\GunWaitCursor.png"
  532.     while Player.Character:FindFirstChild("WeaponActivated") ~= nil do
  533.         if Player.Character.WeaponActivated.Value == nil then break end
  534.         if Player.Character.WeaponActivated.Value.Parent == nil then break end
  535.         wait()
  536.     end
  537.     mouse.Icon = "rbxasset://textures\\GunCursor.png"
  538.     local weapon = Instance.new("ObjectValue")
  539.     weapon.Name = "WeaponActivated"
  540.     weapon.Value = script.Parent
  541.     weapon.Parent = Player.Character
  542.     DisableLimb(1, Player.Character)
  543.     removeParts("holster")
  544.     makeParts("hand")
  545.     playAnimation("normal")
  546.     mouse.Button1Down:connect(function() onButton1Down(mouse) end)
  547.     mouse.Button1Up:connect(function() onButton1Up(mouse) end)
  548.     mouse.KeyDown:connect(function(key) onKeyDown(key, mouse) end)
  549.     if connection ~= nil then connection:disconnect() end
  550.     connection = Player.Character.Humanoid.Died:connect(function() canUse = true onDeselected(mouse) end)
  551. end
  552.  
  553.  
  554. function onDeselected(mouse)
  555.     if selected == false then return end
  556.     if Button1Down == true then
  557.         coroutine.resume(coroutine.create(function() playAnimation("slashEnd") end))
  558.         for i = 1, 0.25, -0.05 do
  559.             Player.Character[Name].Handle.Saw.Pitch = i
  560.             wait()
  561.         end
  562.         Player.Character[Name].Handle.Saw.Pitch = 0.25
  563.         Button1Down = false
  564.     end
  565.     if activated == true then onKeyDown("e", mouse) end
  566.     selected = false
  567.     while canUse == false do
  568.         wait()
  569.     end
  570.     if Player.Character:FindFirstChild("WeaponActivated") ~= nil then
  571.         if Player.Character.WeaponActivated.Value == script.Parent then
  572.             Player.Character.WeaponActivated:Remove()
  573.         end
  574.     end
  575.     while Player.Character:FindFirstChild("WeaponActivated") ~= nil do
  576.         if Player.Character.WeaponActivated.Value == nil then break end
  577.         if pcall(function() if Player.Character.WeaponActivated.Value.Parent == nil then return true end end) then break end
  578.         wait()
  579.     end
  580.     swordType = "normal"
  581.     EnableLimb(1, Player.Character)
  582.     removeParts("hand")
  583.     makeParts("holster")
  584. end
  585.  
  586.  
  587. if script.Parent.ClassName ~= "HopperBin" then
  588.     if Player == nil then print("Error: Player not found!") return end
  589.     Tool = Instance.new("HopperBin")
  590.     Tool.Name = Name
  591.     Tool.Parent = Player.Backpack
  592.     script.Name = "Main"
  593.     script.Parent = Tool
  594.     Player = game.Players.LocalPlayer
  595.     makeParts("holster")
  596.     Tool.Selected:connect(onSelected)
  597.     Tool.Deselected:connect(onDeselected)
  598. end wait()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement