TheUnknownDiscord

linked sword

Aug 28th, 2021 (edited)
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Tool = Instance.new("Tool")
  2. Tool.Name = "Sword"
  3. LastAttack = 0
  4. Knife = Instance.new("Part")
  5. Knife.Name = "Handle"
  6. Knife.Parent = Tool
  7. Tool.Parent = owner.Character
  8. Tool.Grip = CFrame.Angles(0,math.rad(90),math.rad(90))
  9. Tool.GripUp = Vector3.new(0, 0, 1.5, 0, 0, -1, -1, 0, 0, 0, -1, 0)
  10. Tool.GripPos = Vector3.new(0,0,-1.5)
  11. Mesh = Instance.new("SpecialMesh")
  12. Knife.Size = Vector3.new(2, 1, 4)
  13. Mesh.Parent = Knife
  14. Mesh.MeshId = "http://www.roblox.com/asset/?id=12221720"
  15. Mesh.TextureId = "http://www.roblox.com/asset/?id=12224218"
  16. Mesh.Scale = Vector3.new(1, 1, 1)
  17. myhum = owner.Character.Humanoid
  18. local stab = Instance.new("Sound", owner.character.Head)
  19. stab.SoundId = "rbxassetid://12222216"
  20. stab.Volume = 1
  21. local equipped = Instance.new("Sound", owner.character.Head)
  22. equipped.SoundId = "rbxassetid://12222225"
  23. equipped.Volume = 1
  24. local Lunge = Instance.new("Sound", owner.character.Head)
  25. Lunge.SoundId = "rbxassetid://12222208"
  26. Lunge.Volume = 1
  27. candamage = false
  28. islunging = false
  29.  
  30. Tool.Activated:connect(function()
  31. local Tick = game:GetService("RunService").Stepped:wait()
  32. if (Tick - LastAttack) < .5 then
  33. coroutine.wrap(function()
  34. islunging = true
  35. Lunge:Stop()
  36. Lunge:Play()
  37. Tool.Grip = CFrame.Angles(0,math.rad(180),math.rad(90))
  38. Tool.GripPos = Vector3.new(0,0,-1.75)
  39. local Anim = Instance.new("StringValue")
  40. Anim.Name = "toolanim"
  41. Anim.Value = "Lunge"
  42. Anim.Parent = Tool
  43. wait(0.25)
  44. islunging = false
  45. wait(0.40)
  46. Tool.Grip = CFrame.Angles(0,math.rad(90),math.rad(90))
  47. Tool.GripPos = Vector3.new(0,0,-1.5)
  48. end)()
  49. else
  50. coroutine.wrap(function()
  51. stab:Stop()
  52. stab:Play()
  53. local Anim = Instance.new("StringValue")
  54. Anim.Name = "toolanim"
  55. Anim.Value = "Slash"
  56. Anim.Parent = Tool
  57. candamage = true
  58. wait(0.5)
  59. candamage = false
  60. end)()
  61. end
  62. LastAttack = Tick
  63. end)
  64.  
  65.  
  66. Tool.Equipped:Connect(function()
  67. equipped:Play()
  68. end)
  69.  
  70. local isTouched = false
  71.  
  72. local function damagePlayer(otherPart)
  73. if candamage and not islunging then
  74. local partParent = otherPart.Parent
  75. local humanoid = partParent:FindFirstChildWhichIsA("Humanoid")
  76. if humanoid ~= "myhum" and humanoid then
  77. if not isTouched then
  78. isTouched = true
  79. if humanoid.Health ~= 0 then
  80. humanoid.Health = humanoid.Health - 10
  81. wait(0.40)
  82. isTouched = false
  83. end
  84. end
  85. end
  86. end
  87. end
  88.  
  89. local function lungelol(otherPart3)
  90. if islunging and not candamage then
  91. local partParent3 = otherPart3.Parent
  92. local humanoid = partParent3:FindFirstChildWhichIsA("Humanoid")
  93. if humanoid ~= "myhum" and humanoid then
  94. if humanoid.Health ~= 0 then
  95. humanoid.Health = humanoid.Health - 20
  96. end
  97. end
  98. end
  99. end
  100.  
  101. local function tapped(otherPart2)
  102. if not islunging and not candamage then
  103. local partParent2 = otherPart2.Parent
  104. local humanoid = partParent2:FindFirstChildWhichIsA("Humanoid")
  105. if humanoid ~= "myhum" and humanoid then
  106. if not isTouched then
  107. isTouched = true
  108. if humanoid.Health ~= 0 then
  109. humanoid.Health = humanoid.Health - 5
  110. wait(0.1)
  111. isTouched = false
  112. end
  113. end
  114. end
  115. end
  116. end
  117.  
  118. Knife.Touched:Connect(lungelol)
  119. Knife.Touched:Connect(damagePlayer)
  120. Knife.Touched:Connect(tapped)
Add Comment
Please, Sign In to add comment