Advertisement
popster12345

Untitled

Feb 20th, 2016
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.42 KB | None | 0 0
  1. -------- OMG HAX
  2.  
  3. r = game:service("RunService")
  4. debris = game:GetService("Debris")
  5.  
  6. local damage = 0
  7.  
  8.  
  9. local slash_damage = 50
  10. local lunge_damage = 50
  11.  
  12. sword = script.Parent.Handle
  13. Tool = script.Parent
  14.  
  15.  
  16.  
  17. local SmashSound = Instance.new("Sound")
  18. SmashSound.SoundId = "http://www.roblox.com/asset/?id=12222030"
  19. SmashSound.Parent = sword
  20. SmashSound.Volume = .7
  21.  
  22. local SmashSound2 = Instance.new("Sound")
  23. SmashSound2.SoundId = "http://www.roblox.com/asset/?id=12222030"
  24. SmashSound2.Parent = sword
  25. SmashSound2.Volume = .7
  26.  
  27. local sounds = {SmashSound, SmashSound2}
  28.  
  29. local UnsheathSound = Instance.new("Sound")
  30. UnsheathSound.SoundId = "rbxasset://sounds\\unsheath.wav"
  31. UnsheathSound.Parent = sword
  32. UnsheathSound.Volume = 1
  33.  
  34.  
  35. function blow(hit)
  36.  
  37. if (Tool.Enabled) then return end -- only damages on a swing
  38.  
  39. local humanoid = hit.Parent:findFirstChild("Zombie")
  40. local vCharacter = Tool.Parent
  41. local vPlayer = game.Players:playerFromCharacter(vCharacter)
  42. local hum = vCharacter:findFirstChild("Humanoid") -- non-nil if tool held by a character
  43. if humanoid~=nil and humanoid ~= hum and hum ~= nil then
  44. -- final check, make sure sword is in-hand
  45.  
  46. local right_arm = vCharacter:FindFirstChild("Right Arm")
  47. if (right_arm ~= nil) then
  48. local joint = right_arm:FindFirstChild("RightGrip")
  49. if (joint ~= nil and (joint.Part0 == sword or joint.Part1 == sword)) then
  50. tagHumanoid(humanoid, vPlayer)
  51. humanoid:TakeDamage(damage)
  52. wait(1)
  53. untagHumanoid(humanoid)
  54. end
  55. end
  56.  
  57.  
  58. else
  59. if humanoid == nil and hum ~= nil then
  60. -- break some joints
  61. if (hit:getMass() < 34) then
  62. hit:BreakJoints()
  63. local dir = (hit.Position - vCharacter.Torso.Position).unit
  64. local bf = Instance.new("BodyForce")
  65. bf.force = dir * 10000
  66. bf.Parent = hit
  67. debris:AddItem(bf, .5)
  68. end
  69. end
  70. end
  71. end
  72.  
  73.  
  74. function tagHumanoid(humanoid, player)
  75. local creator_tag = Instance.new("ObjectValue")
  76. creator_tag.Value = player
  77. creator_tag.Name = "creator"
  78. creator_tag.Parent = humanoid
  79. end
  80.  
  81. function untagHumanoid(humanoid)
  82. if humanoid ~= nil then
  83. local tag = humanoid:findFirstChild("creator")
  84. if tag ~= nil then
  85. tag.Parent = nil
  86. end
  87. end
  88. end
  89.  
  90.  
  91. function attack()
  92. damage = slash_damage
  93.  
  94. local s = sounds[math.random(1,#sounds)]
  95. s.Pitch = .9 + (math.random() * .2)
  96. s.Volume = .7 + (math.random() * .3)
  97. s:Play()
  98.  
  99. local anim = Instance.new("StringValue")
  100. anim.Name = "toolanim"
  101. anim.Value = "Slash"
  102. anim.Parent = Tool
  103. end
  104.  
  105.  
  106.  
  107. function swordUp()
  108. Tool.GripForward = Vector3.new(0, 0, -1)
  109. Tool.GripRight = Vector3.new(1, 0, 0)
  110. Tool.GripUp = Vector3.new(0, 1, 0)
  111. end
  112.  
  113. function swordOut()
  114. Tool.GripForward = Vector3.new(0,0,1)
  115. Tool.GripRight = Vector3.new(0,-1,0)
  116. Tool.GripUp = Vector3.new(-1,0,0)
  117. end
  118.  
  119. function swordAcross()
  120. -- parry
  121. end
  122.  
  123.  
  124. Tool.Enabled = true
  125. local last_attack = 0
  126. function onActivated()
  127.  
  128. if not Tool.Enabled then
  129. return
  130. end
  131.  
  132. Tool.Enabled = false
  133.  
  134. local character = Tool.Parent;
  135. local humanoid = character.Humanoid
  136. if humanoid == nil then
  137. print("Humanoid not found")
  138. return
  139. end
  140.  
  141.  
  142. attack()
  143.  
  144.  
  145.  
  146. wait(.5)
  147.  
  148. Tool.Enabled = true
  149. end
  150.  
  151.  
  152. function onEquipped()
  153. UnsheathSound:play()
  154. end
  155.  
  156.  
  157. script.Parent.Activated:connect(onActivated)
  158. script.Parent.Equipped:connect(onEquipped)
  159.  
  160.  
  161. connection = sword.Touched:connect(blow)
  162.  
  163. function DarkKill(character, humanoid, attacker)
  164.  
  165. if (character:FindFirstChild("ForceField") ~= nil) then return end
  166.  
  167. local childs = character:GetChildren()
  168.  
  169. local colors = {}
  170.  
  171. tagHumanoid(humanoid, attacker)
  172. humanoid.Health = 0
  173.  
  174. for i=1,#childs do
  175. if (childs[i].className == "Part") then
  176. colors[i] = childs[i].BrickColor
  177. childs[i].BrickColor = BrickColor.new(1011)
  178. childs[i].CanCollide = true
  179. childs[i].Anchored = true
  180. end
  181. end
  182.  
  183. wait(.25)
  184.  
  185. for i=1,#childs do
  186. if (childs[i].className == "Part") then
  187. local b = Instance.new("BodyVelocity")
  188. b.velocity = Vector3.new(math.random() - .5, 0, math.random() - .5).unit * 80
  189. b.maxForce = Vector3.new(1e5,1e5,1e5)
  190. b.Parent = childs[i]
  191. end
  192. end
  193.  
  194. for i=1,#childs do
  195. if (childs[i].className == "Part") then
  196. childs[i].Anchored = false
  197. end
  198. end
  199.  
  200.  
  201.  
  202.  
  203.  
  204.  
  205.  
  206.  
  207. end
  208.  
  209.  
  210.  
  211.  
  212. function blow(hit)
  213. local humanoid = hit.Parent:findFirstChild("Humanoid")
  214. local vCharacter = Tool.Parent
  215. local vPlayer = game.Players:playerFromCharacter(vCharacter)
  216. local hum = vCharacter:findFirstChild("Humanoid") -- non-nil if tool held by a character
  217. if humanoid~=nil and humanoid ~= hum and hum ~= nil then
  218. -- final check, make sure sword is in-hand
  219.  
  220. local right_arm = vCharacter:FindFirstChild("Right Arm")
  221. if (right_arm ~= nil) then
  222. local joint = right_arm:FindFirstChild("RightGrip")
  223. if (joint ~= nil and (joint.Part0 == sword or joint.Part1 == sword)) then
  224. hum.Health = hum.Health + (damage * .4)
  225. if humanoid.Health > damage then
  226. tagHumanoid(humanoid, vPlayer)
  227. humanoid:TakeDamage(damage)
  228. else
  229. DarkKill(humanoid.Parent, humanoid, vPlayer)
  230. end
  231. end
  232. end
  233.  
  234.  
  235. end
  236. end
  237.  
  238.  
  239.  
  240. function tagHumanoid(humanoid, player)
  241. local creator_tag = Instance.new("ObjectValue")
  242. creator_tag.Value = player
  243. creator_tag.Name = "creator"
  244. creator_tag.Parent = humanoid
  245. game.Debris:AddItem(creator_tag, 1)
  246. end
  247.  
  248.  
  249.  
  250.  
  251. function attack()
  252. damage = slash_damage
  253. SlashSound:play()
  254. local anim = Instance.new("StringValue")
  255. anim.Name = "toolanim"
  256. anim.Value = "Slash"
  257. anim.Parent = Tool
  258. end
  259.  
  260.  
  261. function swordUp()
  262. Tool.GripForward = Vector3.new(0,0,-1)
  263. Tool.GripRight = Vector3.new(0,-.8,0)
  264. Tool.GripUp = Vector3.new(0,1,0)
  265. end
  266.  
  267. function swordOut()
  268. Tool.GripForward = Vector3.new(0,0,-1)
  269. Tool.GripRight = Vector3.new(0,-.8,0)
  270. Tool.GripUp = Vector3.new(0,1,0)
  271. end
  272.  
  273. function swordAcross()
  274. -- parry
  275. end
  276.  
  277.  
  278. Tool.Enabled = true
  279. local last_attack = 0
  280. function onActivated()
  281.  
  282. if not Tool.Enabled then
  283. return
  284. end
  285.  
  286. Tool.Enabled = false
  287.  
  288. local character = Tool.Parent;
  289. local humanoid = character.Humanoid
  290. if humanoid == nil then
  291. print("Humanoid not found")
  292. return
  293. end
  294.  
  295. t = r.Stepped:wait()
  296.  
  297. if (t - last_attack < .2) then
  298. lunge()
  299. else
  300. attack()
  301. end
  302.  
  303. last_attack = t
  304.  
  305. --wait(.5)
  306.  
  307. Tool.Enabled = true
  308. end
  309.  
  310.  
  311. function onEquipped()
  312. UnsheathSound:play()
  313. end
  314.  
  315.  
  316. script.Parent.Activated:connect(onActivated)
  317. script.Parent.Equipped:connect(onEquipped)
  318.  
  319.  
  320. connection = sword.Touched:connect(blow)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement