Advertisement
lafur

Untitled

Oct 21st, 2018
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.44 KB | None | 0 0
  1. -------- OMG HAX
  2.  
  3. r = game:service("RunService")
  4.  
  5.  
  6. local damage = 50
  7.  
  8.  
  9. local slash_damage = 9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
  10. local lunge_damage = 9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
  11.  
  12.  
  13. Tool = script.Parent
  14.  
  15.  
  16. local SlashSound = Instance.new("Sound")
  17. SlashSound.SoundId = "rbxasset://sounds\\swordslash.wav"
  18. SlashSound.Parent = sword
  19. SlashSound.Volume = .7
  20.  
  21. local LungeSound = Instance.new("Sound")
  22. LungeSound.SoundId = "rbxasset://sounds\\swordlunge.wav"
  23. LungeSound.Parent = sword
  24. LungeSound.Volume = .6
  25.  
  26. local UnsheathSound = Instance.new("Sound")
  27. UnsheathSound.SoundId = "rbxasset://sounds\\unsheath.wav"
  28. UnsheathSound.Parent = sword
  29. UnsheathSound.Volume = 1
  30.  
  31.  
  32.  
  33. function blow(hit)
  34. local humanoid = hit.Parent:findFirstChild("Humanoid")
  35. local vCharacter = Tool.Parent
  36. local vPlayer = game.Players:playerFromCharacter(vCharacter)
  37. local hum = vCharacter:findFirstChild("Humanoid") -- non-nil if tool held by a character
  38. if humanoid~=nil and humanoid ~= hum and hum ~= nil then
  39. print("SWORD HIT")
  40. tagHumanoid(humanoid, vPlayer)
  41. humanoid:TakeDamage(damage)
  42. wait(1)
  43. untagHumanoid(humanoid)
  44. end
  45. end
  46.  
  47.  
  48. function tagHumanoid(humanoid, player)
  49. local creator_tag = Instance.new("ObjectValue")
  50. creator_tag.Value = player
  51. creator_tag.Name = "Maker Only"
  52. creator_tag.Parent = humanoid
  53. end
  54.  
  55. function untagHumanoid(humanoid)
  56. if humanoid ~= nil then
  57. local tag = humanoid:findFirstChild("creator")
  58. if tag ~= nil then
  59. tag.Parent = nil
  60. end
  61. end
  62. end
  63.  
  64.  
  65. function attack()
  66. damage = slash_damage
  67. SlashSound:play()
  68. local anim = Instance.new("StringValue")
  69. anim.Name = "toolanim"
  70. anim.Value = "Slash"
  71. anim.Parent = Tool
  72. end
  73.  
  74. function lunge()
  75. damage = lunge_damage
  76.  
  77. LungeSound:play()
  78.  
  79. local anim = Instance.new("StringValue")
  80. anim.Name = "toolanim"
  81. anim.Value = "Lunge"
  82. anim.Parent = Tool
  83.  
  84.  
  85. force = Instance.new("BodyVelocity")
  86. force.velocity = Vector3.new(0,10,0) --Tool.Parent.Torso.CFrame.lookVector * 80
  87. force.Parent = Tool.Parent.Torso
  88. wait(.25)
  89. swordOut()
  90. wait(.25)
  91. force.Parent = nil
  92. wait(.5)
  93. swordUp()
  94.  
  95. damage = slash_damage
  96. end
  97.  
  98. function swordUp()
  99. Tool.GripForward = Vector3.new(-1,0,0)
  100. Tool.GripRight = Vector3.new(0,1,0)
  101. Tool.GripUp = Vector3.new(0,0,1)
  102. end
  103.  
  104. function swordOut()
  105. Tool.GripForward = Vector3.new(0,0,1)
  106. Tool.GripRight = Vector3.new(0,-1,0)
  107. Tool.GripUp = Vector3.new(-1,0,0)
  108. end
  109.  
  110. function swordAcross()
  111. -- parry
  112. end
  113.  
  114.  
  115.  
  116. local last_attack = 0
  117. function onActivated()
  118.  
  119. if not Tool.Enabled then
  120. return
  121. end
  122.  
  123. Tool.Enabled = false
  124.  
  125. local character = Tool.Parent;
  126. local humanoid = character.Humanoid
  127. if humanoid == nil then
  128. print("Humanoid not found")
  129. return
  130. end
  131.  
  132. t = r.Stepped:wait()
  133.  
  134. if (t - last_attack < .2) then
  135. lunge()
  136. else
  137. attack()
  138. end
  139.  
  140. last_attack =t
  141. end
  142.  
  143.  
  144. function onEquipped()
  145. UnsheathSound:play()
  146. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement