Advertisement
HenloMyDude

bad sword

Feb 2nd, 2020
349
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.53 KB | None | 0 0
  1.  
  2. plr = owner
  3. char = plr.Character
  4. tors = char.Torso
  5. ra = char["Right Arm"]
  6. la = char["Left Arm"]
  7. rl = char["Right Leg"]
  8. ll = char["Left Leg"]
  9. hed = char.Head
  10. root = char.HumanoidRootPart
  11. hum = char.Humanoid
  12.  
  13. clerp = function(toclerp, cf, number)
  14. local joint = toclerp
  15. joint.C0 = joint.C0:Lerp(cf, number)
  16. end
  17.  
  18. clerp2 = function(toclerp, cf)
  19. local joint = toclerp
  20. joint.C0 = cf
  21. end
  22.  
  23. clerp3 = function(toclerp, cf, number)
  24. local joint = toclerp
  25. joint.C1 = joint.C1:Lerp(cf, number)
  26. end
  27.  
  28. Swait,swait = function(number)
  29. if number == 0 or number == nil then
  30. game:GetService("RunService").Heartbeat:Wait()
  31. else
  32. for i = 1,number do
  33. game:GetService("RunService").Heartbeat:Wait()
  34. end
  35. end
  36. end
  37.  
  38. ezweld = function(p, a, b, cf)
  39. local weld = Instance.new("Weld",p)
  40. weld.Part0 = a
  41. weld.Part1 = b
  42. weld.C0 = cf
  43. return weld
  44. end
  45.  
  46. NewSound = function(p, id, pit, vol, loop)
  47. local Sound = Instance.new("Sound",p)
  48. Sound.Pitch = pit
  49. Sound.Volume = vol
  50. Sound.SoundId = "rbxassetid://" ..id
  51. Sound.Looped = loop
  52. Sound:Play()
  53. return Sound
  54. end
  55.  
  56. IT = Instance.new
  57. Rad = math.rad
  58. Cos = math.cos
  59. Sin = math.sin
  60. BrickC = BrickColor.new
  61. C3 = Color3.new
  62. VT = Vector3.new
  63.  
  64. anim = "Idle"
  65. attack = false
  66. local RS = char.Torso["Right Shoulder"]
  67. local LS = char.Torso["Left Shoulder"]
  68. local RH = char.Torso["Right Hip"]
  69. local LH = char.Torso["Left Hip"]
  70. local neck = char.Torso["Neck"]
  71. local anim = "Idle"
  72. local animate = char.Animate
  73. local root = char.HumanoidRootPart
  74. local rootj = root.RootJoint
  75. local timepos = 0
  76. local sine = 0
  77. local RSnor = RS.C0
  78. local LSnor = LS.C0
  79. local RHnor = RH.C0
  80. local LHnor = LH.C0
  81. local RSnor2 = RS.C1
  82. local LSnor2 = LS.C1
  83. local RHnor2 = RH.C1
  84. local LHnor2 = LH.C1
  85. local rootjnor = rootj.C0
  86. local necknor = neck.C0
  87. local tors = char.Torso
  88. mouse = plr:GetMouse()
  89. hold = false
  90. Debris = game:GetService("Debris")
  91. attack = false
  92. lunge = false
  93.  
  94. local tool = Instance.new("Tool", plr.Backpack)
  95. tool.Name = "osrwd"
  96. tool.GripForward = VT(-1, 0, 0)
  97. tool.GripPos = VT(0, 0, -1.5)
  98. tool.GripRight = VT(0, 1, 0)
  99. tool.GripUp = VT(0, 0, 1)
  100. local handle = Instance.new("Part", tool)
  101. handle.Size = Vector3.new(1, 0.8, 4)
  102. handle.CanCollide = false
  103. handle.Name = "Handle"
  104. local mesh = Instance.new("SpecialMesh", handle)
  105. mesh.MeshId = "rbxasset://fonts/sword.mesh"
  106. mesh.TextureId = "rbxassetid://323591032"
  107. nl = false
  108.  
  109. Grips = {
  110. Up = CFrame.new(0, 0, -1.70000005, 0, 0, 1, 1, 0, 0, 0, 1, 0),
  111. Out = CFrame.new(0, 0, -1.70000005, 0, 1, 0, 1, -0, 0, 0, 0, -1)
  112. }
  113.  
  114. function thread(f)
  115. return coroutine.resume(coroutine.create(f))
  116. end
  117.  
  118. function damage(model, dmg, bl, cf, vel)
  119. for i,v in pairs (model:children()) do
  120. if model ~= char and model ~= workspace then
  121. if v:IsA("Humanoid") then
  122. v.Health = v.Health - dmg
  123. if bl == true then
  124. local ball = Instance.new("Part", script)
  125. ball.CanCollide = false
  126. ball.Color = Color3.new(1, 0, 0)
  127. ball.Material = "Glass"
  128. ball.Size = Vector3.new(2, 2, 2)
  129. ball.CFrame = cf
  130. ball.Anchored = false
  131. ball.Velocity = Vector3.new(math.random(-vel, vel), math.random(-vel, vel), math.random(-vel, vel))
  132. local mesh = Instance.new("SpecialMesh", ball)
  133. mesh.MeshType = "Sphere"
  134. ball.Touched:connect(function(hit)
  135. if hit.CanCollide == true and hit.Anchored == true and bl == true then
  136. ball.Position = Vector3.new(ball.Position.x, hit.Position.y, ball.Position.z) + Vector3.new(0, hit.Size.y / 2, 0)
  137. ball.Size = Vector3.new(2, 0.01, 2)
  138. ball.Anchored = true
  139. ball.Orientation = Vector3.new(0, 0, 0)
  140. thread(function()
  141. for i = 1,20 do
  142. Swait()
  143. ball.Size = ball.Size:lerp(Vector3.new(4, 0.01, 4), 0.075)
  144. ball.Transparency = ball.Transparency + 0.03
  145. end
  146. ball:remove()
  147. end)
  148. end
  149. end)
  150. end
  151. end
  152. end
  153. end
  154. end
  155.  
  156. function bled(cf, vel)
  157. local ball = Instance.new("Part", script)
  158. ball.CanCollide = false
  159. ball.Color = Color3.new(1, 0, 0)
  160. ball.Material = "Glass"
  161. ball.Size = Vector3.new(2, 2, 2)
  162. ball.CFrame = cf
  163. ball.Anchored = false
  164. ball.Velocity = Vector3.new(math.random(-vel, vel), math.random(-vel, vel), math.random(-vel, vel))
  165. local mesh = Instance.new("SpecialMesh", ball)
  166. mesh.MeshType = "Sphere"
  167. ball.Touched:connect(function(hit)
  168. if hit.CanCollide == true and hit.Anchored == true then
  169. ball.Position = Vector3.new(ball.Position.x, hit.Position.y, ball.Position.z) + Vector3.new(0, hit.Size.y / 2, 0)
  170. ball.Size = Vector3.new(2, 0.01, 2)
  171. ball.Anchored = true
  172. ball.Orientation = Vector3.new(0, 0, 0)
  173. thread(function()
  174. for i = 1,20 do
  175. Swait()
  176. ball.Size = ball.Size:lerp(Vector3.new(4, 0.01, 4), 0.075)
  177. ball.Transparency = ball.Transparency + 0.03
  178. end
  179. ball:remove()
  180. end)
  181. end
  182. end)
  183. end
  184.  
  185. function slash()
  186. tool.Grip = Grips.Up
  187. attack = true
  188. nl = true
  189. thread(function()
  190. wait(0.3)
  191. nl = false
  192. end)
  193. local hitbox = handle.Touched:connect(function(hit)
  194. local dud = hit.Parent
  195. if dud ~= char then
  196. if not dud:FindFirstChild"cool" then
  197. damage(dud, 15, true, hit.CFrame, 60)
  198. for i = 1,5 do
  199. bled(hit.CFrame, 60)
  200. end
  201. local cool = Instance.new("NumberValue", dud) cool.Name = "cool" Debris:AddItem(cool, 0.15)
  202. end
  203. end
  204. end)
  205. for i = 1,17 do
  206. Swait()
  207. if lunge == false then
  208. clerp(RS, RSnor * CFrame.Angles(0, 0, Rad(-90)), 0.35)
  209. end
  210. end
  211. hitbox:disconnect()
  212. attack = false
  213. end
  214.  
  215. function lungi()
  216. tool.Grip = Grips.Out
  217. attack = true
  218. lunge = true
  219. local hitbox = handle.Touched:connect(function(hit)
  220. local dud = hit.Parent
  221. if dud ~= char then
  222. if not dud:FindFirstChild"cool" then
  223. damage(dud, 30, true, hit.CFrame, 60)
  224. for i = 1,3 do
  225. bled(hit.CFrame, 60)
  226. end
  227. local cool = Instance.new("NumberValue", dud) cool.Name = "cool" Debris:AddItem(cool, 0.15)
  228. end
  229. end
  230. end)
  231. for i = 1,30 do
  232. Swait()
  233. if lunge == true then
  234. clerp(RS, RSnor * CFrame.Angles(0, 0, Rad(0)), 0.35)
  235. end
  236. end
  237. hitbox:disconnect()
  238. lunge = false
  239. attack = false
  240. tool.Grip = Grips.Up
  241. end
  242.  
  243. tool.Activated:connect(function()
  244. if attack == false and lunge == false then
  245. slash()
  246. elseif attack == true and lunge == false and nl == true then
  247. lungi()
  248. end
  249. end)
  250.  
  251. while true do
  252. Swait()
  253. if attack == false then
  254. clerp(RS, RSnor, 0.35)
  255. end
  256. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement