Advertisement
RyanDaCoder

sword1

Sep 8th, 2017
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.11 KB | None | 0 0
  1. local katana = Instance.new("Tool")
  2. katana.Name = "Roblox's Biggest Katana"
  3. katana.Parent = game.Players.LocalPlayer.Backpack
  4. local hnd = Instance.new("Part")
  5. hnd.Size = Vector3.new("38, 45.2, 457")
  6. hnd.Anchored = false
  7. hnd.Name = "Handle"
  8. hnd.Parent = katana
  9. local sound1 = Instance.new("Sound")
  10. sound1.SoundId = "rbxasset://sounds/swordlunge.wav"
  11. sound1.Name = "Sound"
  12. sound1.Parent = hnd
  13. local sound2 = Instance.new("Sound")
  14. sound2.SoundId = "rbxasset://sounds/unsheath.wav"
  15. sound2.Name = "Sound"
  16. sound2.Parent = hnd
  17. local sound3 = Instance.new("Sound")
  18. sound3.SoundId = "rbxasset://sounds/swordslash.wav"
  19. sound3.Name = "Sound"
  20. sound3.Parent = hnd
  21.  
  22. local mesh = Instance.new("SpecialMesh")
  23. mesh.MeshId = "http://www.roblox.com/asset/?id=11442510"
  24. mesh.TextureId = "http://www.roblox.com/asset/?id=12067965"
  25. mesh.Scale = Vector3.new("170, 170, 170")
  26.  
  27. -------- OMG HAX
  28.  
  29. r = game:service("RunService")
  30.  
  31.  
  32. local damage = 5
  33.  
  34.  
  35. local slash_damage = 8
  36. local lunge_damage = 12
  37.  
  38. sword = hnd
  39. Tool = katana
  40.  
  41.  
  42. local SlashSound = Instance.new("Sound")
  43. SlashSound.SoundId = "rbxasset://sounds\\swordslash.wav"
  44. SlashSound.Parent = sword
  45. SlashSound.Volume = .7
  46. SlashSound.Pitch = .9
  47.  
  48. local LungeSound = Instance.new("Sound")
  49. LungeSound.SoundId = "rbxasset://sounds\\swordlunge.wav"
  50. LungeSound.Parent = sword
  51. LungeSound.Volume = .6
  52. LungeSound.Pitch = .9
  53.  
  54. local UnsheathSound = Instance.new("Sound")
  55. UnsheathSound.SoundId = "rbxasset://sounds\\unsheath.wav"
  56. UnsheathSound.Parent = sword
  57. UnsheathSound.Volume = 1
  58.  
  59.  
  60. function blow(hit)
  61. local humanoid = hit.Parent:findFirstChild("Humanoid")
  62. local vCharacter = Tool.Parent
  63. local vPlayer = game.Players:playerFromCharacter(vCharacter)
  64. local hum = vCharacter:findFirstChild("Humanoid") -- non-nil if tool held by a character
  65. if humanoid~=nil and humanoid ~= hum and hum ~= nil then
  66. -- final check, make sure sword is in-hand
  67.  
  68. local right_arm = vCharacter:FindFirstChild("Right Arm")
  69. if (right_arm ~= nil) then
  70. local joint = right_arm:FindFirstChild("RightGrip")
  71. if (joint ~= nil and (joint.Part0 == sword or joint.Part1 == sword)) then
  72. tagHumanoid(humanoid, vPlayer)
  73. humanoid:TakeDamage(damage)
  74. wait(1)
  75. untagHumanoid(humanoid)
  76. end
  77. end
  78.  
  79.  
  80. end
  81. end
  82.  
  83.  
  84. function tagHumanoid(humanoid, player)
  85. local creator_tag = Instance.new("ObjectValue")
  86. creator_tag.Value = player
  87. creator_tag.Name = "creator"
  88. creator_tag.Parent = humanoid
  89. end
  90.  
  91. function untagHumanoid(humanoid)
  92. if humanoid ~= nil then
  93. local tag = humanoid:findFirstChild("creator")
  94. if tag ~= nil then
  95. tag.Parent = nil
  96. end
  97. end
  98. end
  99.  
  100.  
  101. function attack()
  102. damage = slash_damage
  103. SlashSound:play()
  104. local anim = Instance.new("StringValue")
  105. anim.Name = "toolanim"
  106. anim.Value = "Slash"
  107. anim.Parent = Tool
  108. end
  109.  
  110. function lunge()
  111. damage = lunge_damage
  112.  
  113. LungeSound:play()
  114.  
  115. local anim = Instance.new("StringValue")
  116. anim.Name = "toolanim"
  117. anim.Value = "Lunge"
  118. anim.Parent = Tool
  119.  
  120.  
  121. force = Instance.new("BodyVelocity")
  122. force.velocity = Vector3.new(0,10,0) --Tool.Parent.Torso.CFrame.lookVector * 80
  123. force.Parent = Tool.Parent.Torso
  124. wait(.2)
  125. swordOut()
  126. wait(.2)
  127. force.Parent = nil
  128. wait(.4)
  129. swordUp()
  130.  
  131. damage = slash_damage
  132. end
  133.  
  134. function swordUp()
  135. Tool.GripForward = Vector3.new(-1,0,0)
  136. Tool.GripRight = Vector3.new(0,1,0)
  137. Tool.GripUp = Vector3.new(0,0,1)
  138. end
  139.  
  140. function swordOut()
  141. Tool.GripForward = Vector3.new(0,0,1)
  142. Tool.GripRight = Vector3.new(0,1,0)
  143. Tool.GripUp = Vector3.new(1,0,0)
  144. end
  145.  
  146. function swordAcross()
  147. -- parry
  148. end
  149.  
  150.  
  151. Tool.Enabled = true
  152. local last_attack = 0
  153. function onActivated()
  154.  
  155. if not Tool.Enabled then
  156. return
  157. end
  158.  
  159. Tool.Enabled = false
  160.  
  161. local character = Tool.Parent;
  162. local humanoid = character.Humanoid
  163. if humanoid == nil then
  164. print("Humanoid not found")
  165. return
  166. end
  167.  
  168. t = r.Stepped:wait()
  169.  
  170. if (t - last_attack < .2) then
  171. lunge()
  172. else
  173. attack()
  174. end
  175.  
  176. last_attack = t
  177.  
  178. --wait(.5)
  179.  
  180. Tool.Enabled = true
  181. end
  182.  
  183.  
  184. function onEquipped()
  185. UnsheathSound:play()
  186. end
  187.  
  188.  
  189. script.Parent.Activated:connect(onActivated)
  190. script.Parent.Equipped:connect(onEquipped)
  191.  
  192.  
  193. connection = sword.Touched:connect(blow)
  194.  
  195. --rbxsig%aoxvdm1aPjaZNWfciK/Pr0xTiQSMTYPK6DeYzUBftM3ktWksFxD/qPfCrisawJWUgizm/pahcvio8hGdfVGRiDrzgV+Eu4mePmGNQTrNP1WKW+gHElJt9nBVEWptENhA5JCXALEN65aM6HLKdEaWvEOtAKhSF2Y2nJcuyixzj58=%
  196. --rbxassetid%1014476%
  197. local Tool = script.Parent;
  198.  
  199. enabled = true
  200. function onButton1Down(mouse)
  201. if not enabled then
  202. return
  203. end
  204.  
  205. enabled = false
  206. mouse.Icon = "rbxasset://textures\\GunWaitCursor.png"
  207.  
  208. wait(.5)
  209. mouse.Icon = "rbxasset://textures\\GunCursor.png"
  210. enabled = true
  211.  
  212. end
  213.  
  214. function onEquippedLocal(mouse)
  215.  
  216. if mouse == nil then
  217. print("Mouse not found")
  218. return
  219. end
  220.  
  221. mouse.Icon = "rbxasset://textures\\GunCursor.png"
  222. mouse.Button1Down:connect(function() onButton1Down(mouse) end)
  223. end
  224.  
  225.  
  226. katana.Equipped:connect(onEquippedLocal)
  227.  
  228. local cam = Instance.new("Camera")
  229. cam.Name = "ThumbnailCamera"
  230. cam.FieldOfView = "70"
  231. cam.HeadLocked = true
  232. cam.CameraType = "Fixed"
  233. cam.HeadScale = "1"
  234. cam.Archivable = true
  235. cam.Parent = Katana
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement