TheUnknownDiscord

teleport sword

Oct 11th, 2021 (edited)
191
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local debris = game:GetService("Debris")
  2. Tool = Instance.new("Tool")
  3. Tool.Name = "Sword"
  4. Knife = Instance.new("Part")
  5. Knife.Name = "Handle"
  6. Knife.Parent = Tool
  7. Knife.Massless = true
  8. Tool.Parent = owner.Character
  9. Tool.Grip = CFrame.Angles(0,math.rad(90),math.rad(90))
  10. Tool.GripUp = Vector3.new(0, 0, 1.5, 0, 0, -1, -1, 0, 0, 0, -1, 0)
  11. Tool.GripPos = Vector3.new(0,0,-1.5)
  12. Knife.Color = Color3.fromRGB(91, 130, 255)
  13. Knife.Material = Enum.Material.ForceField
  14. Mesh = Instance.new("SpecialMesh")
  15. Knife.Transparency = 0.75
  16. Knife.Size = Vector3.new(2, 1, 4)
  17. Mesh.Parent = Knife
  18. Mesh.MeshId = "http://www.roblox.com/asset/?id=12221720"
  19. Mesh.Scale = Vector3.new(1, 1, 1)
  20. local stab = Instance.new("Sound", Knife)
  21. stab.SoundId = "rbxassetid://12222216"
  22. stab.Volume = 1
  23. local equipped = Instance.new("Sound", Knife)
  24. equipped.SoundId = "rbxassetid://12222225"
  25. equipped.Volume = 1
  26. local Lunge = Instance.new("Sound", Knife)
  27. Lunge.SoundId = "rbxassetid://12222208"
  28. Lunge.Volume = 1
  29. candamage = false
  30. islunging = false
  31. LastAttack = 0
  32. local clone
  33. function attack()
  34. local Anim = Instance.new("StringValue")
  35. Anim.Name = "toolanim"
  36. Anim.Value = "Slash"
  37. Anim.Parent = Tool
  38. candamage = true
  39. stab:Stop()
  40. stab:Play()
  41. wait(0.5)
  42. candamage = false
  43. end
  44. owner = nil
  45. character = nil
  46. playerhum = nil
  47. Tool.Equipped:Connect(function()
  48. equipped:Play()
  49. owner = game:GetService("Players"):GetPlayerFromCharacter(Tool.Parent)
  50. character = owner.Character
  51. playerhum = character:findFirstChildOfClass("Humanoid")
  52. end)
  53.  
  54. runservice = game:GetService("RunService")
  55. function lunge()
  56. islunging = true
  57. Lunge:Stop()
  58. Lunge:Play()
  59. Tool.Grip = CFrame.Angles(0,math.rad(180),math.rad(90))
  60. Tool.GripPos = Vector3.new(0,0,-1.75)
  61. local Anim = Instance.new("StringValue")
  62. Anim.Name = "toolanim"
  63. Anim.Value = "Lunge"
  64. Anim.Parent = Tool
  65. wait(0.1)
  66. for i,clone in pairs(owner.Character:GetDescendants()) do
  67. pcall(function()
  68. if clone:IsA("BasePart") then
  69. local v = Instance.new("SpawnLocation",script)
  70. v.Enabled = false
  71. v.Name = ""
  72. game:GetService("Debris"):AddItem(v,0.5)
  73. v.CFrame = clone.CFrame
  74. v.Parent = workspace
  75. v.CanCollide = false
  76. v.Size = clone.Size + Vector3.new(0.05,0.05,0.05)
  77. v.Anchored = true
  78. v.Material = "Neon"
  79. v.Transparency = 0.7
  80. v.Color = Color3.fromRGB(255,255,255)
  81. if clone:FindFirstChildOfClass("SpecialMesh") then
  82. local mesh = clone:FindFirstChildOfClass("SpecialMesh"):Clone()
  83. mesh.Parent = v
  84. mesh.TextureId = ""
  85. end
  86. local tweenService = game:GetService("TweenService")
  87. local timeToFade = 0.5
  88. local object = v
  89. local tweenInfo = TweenInfo.new(timeToFade)
  90. local goal = {}
  91. goal.Transparency = 1
  92. local tween = tweenService:Create(object, tweenInfo, goal)
  93. tween:Play()
  94. local goal2 = {}
  95. goal2.Color = Color3.fromRGB(0,0,0)
  96. local tween2 = tweenService:Create(object, tweenInfo, goal2)
  97. tween2:Play()
  98. end
  99. end)
  100. end
  101. local tweenService = game:GetService("TweenService")
  102. local timeToFade = 0.125
  103. local object = owner.Character.HumanoidRootPart
  104. local tweenInfo = TweenInfo.new(timeToFade)
  105. local goal = {}
  106. goal.CFrame = owner.Character.HumanoidRootPart.CFrame * CFrame.new(0,0,-20)
  107. local tween = tweenService:Create(object, tweenInfo, goal)
  108. tween:Play()
  109. coroutine.wrap(function()
  110. for i = 1, 5 do
  111. wait(0.0078125)
  112. for i,clone in pairs(owner.Character:GetDescendants()) do
  113. pcall(function()
  114. if clone:IsA("BasePart") then
  115. local v = Instance.new("SpawnLocation",script)
  116. v.Enabled = false
  117. v.Name = ""
  118. game:GetService("Debris"):AddItem(v,0.5)
  119. v.CFrame = clone.CFrame
  120. v.Parent = workspace
  121. v.CanCollide = false
  122. v.Size = clone.Size + Vector3.new(0.05,0.05,0.05)
  123. v.Anchored = true
  124. v.Material = "Neon"
  125. v.Transparency = 0.7
  126. v.Color = Color3.fromRGB(255,255,255)
  127. if clone:FindFirstChildOfClass("SpecialMesh") then
  128. local mesh = clone:FindFirstChildOfClass("SpecialMesh"):Clone()
  129. mesh.Parent = v
  130. mesh.TextureId = ""
  131. end
  132. local tweenService = game:GetService("TweenService")
  133. local timeToFade = 0.5
  134. local object = v
  135. local tweenInfo = TweenInfo.new(timeToFade)
  136. local goal = {}
  137. goal.Transparency = 1
  138. local tween = tweenService:Create(object, tweenInfo, goal)
  139. tween:Play()
  140. local goal2 = {}
  141. goal2.Color = Color3.fromRGB(0,0,0)
  142. local tween2 = tweenService:Create(object, tweenInfo, goal2)
  143. tween2:Play()
  144. end
  145. end)
  146. end
  147. end
  148. end)()
  149. wait(0.25)
  150. islunging = false
  151. wait(0.40)
  152. Tool.Grip = CFrame.Angles(0,math.rad(90),math.rad(90))
  153. Tool.GripPos = Vector3.new(0,0,-1.5)
  154. end
  155. Tool.Activated:connect(function()
  156. local Tick = runservice.Stepped:wait()
  157. if (Tick - LastAttack) < 1 then
  158. lunge()
  159. else
  160. attack()
  161. end
  162. LastAttack = Tick
  163. end)
  164.  
  165. local isTouched = false
  166.  
  167. local function damagePlayer(otherPart)
  168. if candamage and not islunging then
  169. local partParent = otherPart.Parent
  170. local humanoid = partParent:FindFirstChildWhichIsA("Humanoid")
  171. if humanoid ~= owner.Character.Humanoid and humanoid then
  172. if not isTouched then
  173. isTouched = true
  174. if humanoid.Health ~= 0 then
  175. humanoid.Health = humanoid.Health - 15
  176. wait(0.40)
  177. isTouched = false
  178. end
  179. end
  180. end
  181. end
  182. end
  183. local function lungelol(otherPart3)
  184. if islunging and not candamage then
  185. local partParent3 = otherPart3.Parent
  186. local humanoid = partParent3:FindFirstChildWhichIsA("Humanoid")
  187. if humanoid ~= owner.Character.Humanoid and humanoid then
  188. if humanoid.Health ~= 0 then
  189. humanoid.Health = humanoid.Health - 50
  190. end
  191. end
  192. end
  193. end
  194.  
  195. local function tapped(otherPart2)
  196. if not islunging and not candamage then
  197. local partParent2 = otherPart2.Parent
  198. local humanoid = partParent2:FindFirstChildWhichIsA("Humanoid")
  199. if humanoid ~= owner.Character.Humanoid and humanoid then
  200. if not isTouched then
  201. isTouched = true
  202. if humanoid.Health ~= 0 then
  203. humanoid.Health = humanoid.Health - 2.5
  204. wait(0.1)
  205. isTouched = false
  206. end
  207. end
  208. end
  209. end
  210. end
  211.  
  212. Knife.Touched:Connect(lungelol)
  213. Knife.Touched:Connect(damagePlayer)
  214. Knife.Touched:Connect(tapped)
RAW Paste Data