Advertisement
mikee112

ssssuper sword

Jun 14th, 2016
200
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.06 KB | None | 0 0
  1. r = game:service("RunService")
  2.  
  3.  
  4. local damage = 0
  5.  
  6.  
  7. local slash_damage = 100
  8.  
  9. sword = script.Parent.Handle
  10. Tool = script.Parent
  11.  
  12. local arms = nil
  13. local torso = nil
  14. local welds = {}
  15.  
  16. function Equip(mouse)
  17. wait(0.01)
  18. arms = {Tool.Parent:FindFirstChild("Left Arm"), Tool.Parent:FindFirstChild("Right Arm")}
  19. torso = Tool.Parent:FindFirstChild("Torso")
  20. if arms ~= nil and torso ~= nil then
  21. local sh = {torso:FindFirstChild("Left Shoulder"), torso:FindFirstChild("Right Shoulder")}
  22. if sh ~= nil then
  23. local yes = true
  24. if yes then
  25. yes = false
  26. sh[1].Part1 = nil
  27. sh[2].Part1 = nil
  28. local weld1 = Instance.new("Weld")
  29. weld1.Part0 = torso
  30. weld1.Parent = torso
  31. weld1.Part1 = arms[1]
  32. weld1.C1 = CFrame.new(1.5,0,0) * CFrame.fromEulerAnglesXYZ(math.rad(0), 0, math.rad(0))
  33. welds[1] = weld1
  34. local weld2 = Instance.new("Weld")
  35. weld2.Part0 = torso
  36. weld2.Parent = torso
  37. weld2.Part1 = arms[2]
  38. weld2.C1 = CFrame.new(-1.2, 0.2, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-15), 0)
  39. welds[2] = weld2
  40. end
  41. else
  42. print("sh")
  43. end
  44. else
  45. print("arms")
  46. end
  47. end
  48.  
  49. function Unequip(mouse)
  50. if arms ~= nil and torso ~= nil then
  51. local sh = {torso:FindFirstChild("Left Shoulder"), torso:FindFirstChild("Right Shoulder")}
  52. if sh ~= nil then
  53. local yes = true
  54. if yes then
  55. yes = false
  56. sh[1].Part1 = arms[1]
  57. sh[2].Part1 = arms[2]
  58. welds[1].Parent = nil
  59. welds[2].Parent = nil
  60. end
  61. else
  62. print("sh")
  63. end
  64. else
  65. print("arms")
  66. end
  67. end
  68.  
  69. Tool.Equipped:connect(Equip)
  70. Tool.Unequipped:connect(Unequip)
  71.  
  72.  
  73.  
  74.  
  75.  
  76.  
  77. function blow(hit)
  78. local humanoid = hit.Parent:findFirstChild("Humanoid")
  79. local vCharacter = Tool.Parent
  80. local vPlayer = game.Players:playerFromCharacter(vCharacter)
  81. local hum = vCharacter:findFirstChild("Humanoid") -- non-nil if tool held by a character
  82. if humanoid~=nil and humanoid ~= hum and hum ~= nil then
  83. print("SWORD HIT")
  84. tagHumanoid(humanoid, vPlayer)
  85. humanoid:TakeDamage(damage)
  86. wait(1)
  87. untagHumanoid(humanoid)
  88. end
  89. end
  90.  
  91.  
  92. function tagHumanoid(humanoid, player)
  93. local creator_tag = Instance.new("ObjectValue")
  94. creator_tag.Value = player
  95. creator_tag.Name = "creator"
  96. creator_tag.Parent = humanoid
  97. end
  98.  
  99. function untagHumanoid(humanoid)
  100. if humanoid ~= nil then
  101. local tag = humanoid:findFirstChild("creator")
  102. if tag ~= nil then
  103. tag.Parent = nil
  104. end
  105. end
  106. end
  107.  
  108.  
  109. function attack()
  110. damage = slash_damage
  111. local anim = Instance.new("StringValue")
  112. anim.Name = "toolanim"
  113. anim.Value = "Slash"
  114. anim.Parent = Tool
  115.  
  116. local weld1 = Instance.new("Weld")
  117. weld1.Part0 = torso
  118. weld1.Parent = torso
  119. weld1.Part1 = arms[1]
  120. weld1.C1 = CFrame.new(1.5,.4,.5) * CFrame.fromEulerAnglesXYZ(math.rad(290), 0, math.rad(0))
  121. welds[1] = weld1
  122. local weld2 = Instance.new("Weld")
  123. weld2.Part0 = torso
  124. weld2.Parent = torso
  125. weld2.Part1 = arms[2]
  126. weld2.C1 = CFrame.new(-1.2, 0.2, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-15), 0)
  127. welds[2] = weld2
  128. Tool.GripForward = Vector3.new(-0, -0, -1)
  129. Tool.GripPos = Vector3.new(0,0,0)
  130. Tool.GripRight = Vector3.new(-1e-005, 1, 0)
  131. Tool.GripUp = Vector3.new(-1, -1e-005, 0)
  132. wait(0.125)
  133. weld1.C1 = CFrame.new(1.5,0,0) * CFrame.fromEulerAnglesXYZ(math.rad(0), 0, math.rad(0))
  134. weld2.C1 = CFrame.new(-1.2, 0.2, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-50), 0)
  135. wait(0.0625)
  136. weld1.C1 = CFrame.new(1.5,0,0) * CFrame.fromEulerAnglesXYZ(math.rad(0), 0, math.rad(0))
  137. weld2.C1 = CFrame.new(-1.2, 0.2, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-100), 0)
  138. wait(0.2)
  139. weld1.C1 = CFrame.new(1.5,0,0) * CFrame.fromEulerAnglesXYZ(math.rad(0), 0, math.rad(0))
  140. weld2.C1 = CFrame.new(-1.2, 0.2, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-15), 0)
  141. wait(0.0625)
  142. Tool.GripForward = Vector3.new(-0,-0,-1)
  143. Tool.GripPos = Vector3.new(0,0,0)
  144. Tool.GripRight = Vector3.new(-1, 0, 0)
  145. Tool.GripUp = Vector3.new(0, -1, 0)
  146. end
  147.  
  148.  
  149. function swordUp()
  150. Tool.GripForward = Vector3.new(-0, -0, -1)
  151. Tool.GripPos = Vector3.new(0,0,0)
  152. Tool.GripRight = Vector3.new(-1e-005, 1, 0)
  153. Tool.GripUp = Vector3.new(-1, -1e-005, 0)
  154. end
  155.  
  156. function swordOut()
  157. Tool.GripForward = Vector3.new(-0,-0,-1)
  158. Tool.GripPos = Vector3.new(0,0,0)
  159. Tool.GripRight = Vector3.new(-1, 0, 0)
  160. Tool.GripUp = Vector3.new(0, -1, 0)
  161. end
  162.  
  163. function swordAcross()
  164. -- parry
  165. end
  166.  
  167.  
  168. Tool.Enabled = true
  169. local last_attack = 0
  170. function onActivated()
  171.  
  172. if not Tool.Enabled then
  173. return
  174. end
  175.  
  176. Tool.Enabled = false
  177.  
  178. local character = Tool.Parent;
  179. local humanoid = character.Humanoid
  180. if humanoid == nil then
  181. print("Humanoid not found")
  182. return
  183. end
  184.  
  185. t = r.Stepped:wait()
  186. attack()
  187. last_attack = t
  188.  
  189. --wait(.5)
  190.  
  191. Tool.Enabled = true
  192. end
  193.  
  194.  
  195. function onEquipped()
  196. end
  197.  
  198.  
  199. script.Parent.Activated:connect(onActivated)
  200. script.Parent.Equipped:connect(onEquipped)
  201.  
  202. connection = script.Parent.Handle10.Touched:connect(blow) or script.Parent.Handle11.Touched:connect(blow) or script.Parent.Handle12.Touched:connect(blow) or dscript.Parent.Handle13.Touched:connect(blow) or script.Parent.Handle14.Touched:connect(blow) or script.Parent.Handle15.Touched:connect(blow)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement