hoainamqn

su

Mar 25th, 2019
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.62 KB | None | 0 0
  1. --Rescripted by Luckymaxer
  2. --EUROCOW WAS HERE BECAUSE I MADE THE PARTICLES AND THEREFORE THIS ENTIRE SWORD PRETTY AND LOOK PRETTY WORDS AND I'D LIKE TO DEDICATE THIS TO MY FRIENDS AND HI LUCKYMAXER PLS FIX SFOTH SWORDS TY LOVE Y'ALl
  3. --Updated for R15 avatars by StarWars
  4. --Re-updated by TakeoHonorable
  5.  
  6. Tool = script.Parent
  7. Handle = Tool:WaitForChild("Handle")
  8.  
  9. function Create(ty)
  10. return function(data)
  11. local obj = Instance.new(ty)
  12. for k, v in pairs(data) do
  13. if type(k) == 'number' then
  14. v.Parent = obj
  15. else
  16. obj[k] = v
  17. end
  18. end
  19. return obj
  20. end
  21. end
  22.  
  23. local BaseUrl = "rbxassetid://"
  24.  
  25. Players = game:GetService("Players")
  26. Debris = game:GetService("Debris")
  27. RunService = game:GetService("RunService")
  28.  
  29. DamageValues = {
  30. BaseDamage = 5,
  31. SlashDamage = 10,
  32. LungeDamage = 30
  33. }
  34.  
  35. --For R15 avatars
  36. Animations = {
  37. R15Slash = 522635514,
  38. R15Lunge = 522638767
  39. }
  40.  
  41. Damage = DamageValues.BaseDamage
  42.  
  43. Grips = {
  44. Up = CFrame.new(0, 0, -1.70000005, 0, 0, 1, 1, 0, 0, 0, 1, 0),
  45. Out = CFrame.new(0, 0, -1.70000005, 0, 1, 0, 1, -0, 0, 0, 0, -1)
  46. }
  47.  
  48. Sounds = {
  49. Slash = Handle:WaitForChild("SwordSlash"),
  50. Lunge = Handle:WaitForChild("SwordLunge"),
  51. Unsheath = Handle:WaitForChild("Unsheath")
  52. }
  53.  
  54. ToolEquipped = false
  55.  
  56. --For Omega Rainbow Katana thumbnail to display a lot of particles.
  57. for i, v in pairs(Handle:GetChildren()) do
  58. if v:IsA("ParticleEmitter") then
  59. v.Rate = 20
  60. end
  61. end
  62.  
  63. Tool.Grip = Grips.Up
  64. Tool.Enabled = true
  65.  
  66. function IsTeamMate(Player1, Player2)
  67. return (Player1 and Player2 and not Player1.Neutral and not Player2.Neutral and Player1.TeamColor == Player2.TeamColor)
  68. end
  69.  
  70. function TagHumanoid(humanoid, player)
  71. local Creator_Tag = Instance.new("ObjectValue")
  72. Creator_Tag.Name = "creator"
  73. Creator_Tag.Value = player
  74. Debris:AddItem(Creator_Tag, 2)
  75. Creator_Tag.Parent = humanoid
  76. end
  77.  
  78. function UntagHumanoid(humanoid)
  79. for i, v in pairs(humanoid:GetChildren()) do
  80. if v:IsA("ObjectValue") and v.Name == "creator" then
  81. v:Destroy()
  82. end
  83. end
  84. end
  85.  
  86. function Blow(Hit)
  87. if not Hit or not Hit.Parent or not CheckIfAlive() or not ToolEquipped then
  88. return
  89. end
  90. local RightArm = Character:FindFirstChild("Right Arm") or Character:FindFirstChild("RightHand")
  91. if not RightArm then
  92. return
  93. end
  94. local RightGrip = RightArm:FindFirstChild("RightGrip")
  95. if not RightGrip or (RightGrip.Part0 ~= Handle and RightGrip.Part1 ~= Handle) then
  96. return
  97. end
  98. local character = Hit.Parent
  99. if character == Character then
  100. return
  101. end
  102. local humanoid = character:FindFirstChildOfClass("Humanoid")
  103. if not humanoid or humanoid.Health == 0 then
  104. return
  105. end
  106. local player = Players:GetPlayerFromCharacter(character)
  107. if player and (player == Player or IsTeamMate(Player, player)) then
  108. return
  109. end
  110. UntagHumanoid(humanoid)
  111. TagHumanoid(humanoid, Player)
  112. humanoid:TakeDamage(Damage)
  113. end
  114.  
  115.  
  116. function Attack()
  117. Damage = DamageValues.SlashDamage
  118. Sounds.Slash:Play()
  119.  
  120. if Humanoid then
  121. if Humanoid.RigType == Enum.HumanoidRigType.R6 then
  122. local Anim = Instance.new("StringValue")
  123. Anim.Name = "toolanim"
  124. Anim.Value = "Slash"
  125. Anim.Parent = Tool
  126. elseif Humanoid.RigType == Enum.HumanoidRigType.R15 then
  127. local Anim = Tool:FindFirstChild("R15Slash")
  128. if Anim then
  129. local Track = Humanoid:LoadAnimation(Anim)
  130. Track:Play(0)
  131. end
  132. end
  133. end
  134. end
  135.  
  136. function Lunge()
  137. Damage = DamageValues.LungeDamage
  138.  
  139. Sounds.Lunge:Play()
  140.  
  141. if Humanoid then
  142. if Humanoid.RigType == Enum.HumanoidRigType.R6 then
  143. local Anim = Instance.new("StringValue")
  144. Anim.Name = "toolanim"
  145. Anim.Value = "Lunge"
  146. Anim.Parent = Tool
  147. elseif Humanoid.RigType == Enum.HumanoidRigType.R15 then
  148. local Anim = Tool:FindFirstChild("R15Lunge")
  149. if Anim then
  150. local Track = Humanoid:LoadAnimation(Anim)
  151. Track:Play(0)
  152. end
  153. end
  154. end
  155. --[[
  156. if CheckIfAlive() then
  157. local Force = Instance.new("BodyVelocity")
  158. Force.velocity = Vector3.new(0, 10, 0)
  159. Force.maxForce = Vector3.new(0, 4000, 0)
  160. Debris:AddItem(Force, 0.4)
  161. Force.Parent = Torso
  162. end
  163. ]]
  164.  
  165. wait(0.2)
  166. Tool.Grip = Grips.Out
  167. wait(0.6)
  168. Tool.Grip = Grips.Up
  169.  
  170. Damage = DamageValues.SlashDamage
  171. end
  172.  
  173. Tool.Enabled = true
  174. LastAttack = 0
  175.  
  176. function Activated()
  177. if not Tool.Enabled or not ToolEquipped or not CheckIfAlive() then
  178. return
  179. end
  180. Tool.Enabled = false
  181. local Tick = RunService.Stepped:wait()
  182. if (Tick - LastAttack < 0.2) then
  183. Lunge()
  184. else
  185. Attack()
  186. end
  187. LastAttack = Tick
  188. --wait(0.5)
  189. Damage = DamageValues.BaseDamage
  190. local SlashAnim = (Tool:FindFirstChild("R15Slash") or Create("Animation"){
  191. Name = "R15Slash",
  192. AnimationId = BaseUrl .. Animations.R15Slash,
  193. Parent = Tool
  194. })
  195.  
  196. local LungeAnim = (Tool:FindFirstChild("R15Lunge") or Create("Animation"){
  197. Name = "R15Lunge",
  198. AnimationId = BaseUrl .. Animations.R15Lunge,
  199. Parent = Tool
  200. })
  201. Tool.Enabled = true
  202. end
  203.  
  204. function CheckIfAlive()
  205. return (((Player and Player.Parent and Character and Character.Parent and Humanoid and Humanoid.Parent and Humanoid.Health > 0 and Torso and Torso.Parent) and true) or false)
  206. end
  207.  
  208. function Equipped()
  209. Character = Tool.Parent
  210. Player = Players:GetPlayerFromCharacter(Character)
  211. Humanoid = Character:FindFirstChildOfClass("Humanoid")
  212. Torso = Character:FindFirstChild("Torso") or Character:FindFirstChild("HumanoidRootPart")
  213. if not CheckIfAlive() then
  214. return
  215. end
  216. ToolEquipped = true
  217. Sounds.Unsheath:Play()
  218. end
  219.  
  220. function Unequipped()
  221. Tool.Grip = Grips.Up
  222. ToolEquipped = false
  223. end
  224.  
  225. Tool.Activated:Connect(Activated)
  226. Tool.Equipped:Connect(Equipped)
  227. Tool.Unequipped:Connect(Unequipped)
  228.  
  229. Connection = Handle.Touched:Connect(Blow)
Add Comment
Please, Sign In to add comment