awzp

Lazer sword (not by me)

Jun 1st, 2018
353
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 14.01 KB | None | 0 0
  1. --CubicFlares
  2. --Version 1.1.3 (Minor Improvements and Bug Fixes)
  3.  
  4. DAMAGE = 50
  5. local Player = game.Players.LocalPlayer
  6. local Mouse = Player:getMouse()
  7. local Tool = Instance.new("Tool")
  8. Tool.Parent = Player.Backpack
  9. Player.Character.Humanoid.MaxHealth = 500
  10. Player.Character.Humanoid.Health = 500
  11. Player.Character.Humanoid.WalkSpeed = 25
  12. Tool.Name = ("Laser Blade - Inactive")
  13. local Handle = Instance.new("Part")
  14. Handle.Parent = Tool
  15. Handle.Anchored = false
  16. Handle.BrickColor = BrickColor.new("Dark indigo")
  17. Handle.Material = ("Neon")
  18. Handle.Name = ("Handle")
  19. Handle.TopSurface = ("SmoothNoOutlines")
  20. Handle.BottomSurface = ("SmoothNoOutlines")
  21. Handle.Size = Vector3.new(0.5,3,0.5)
  22. Mesh = Instance.new("CylinderMesh")
  23. Mesh.Parent = Handle
  24. local Part = Instance.new("Part")
  25. Part.Parent = Tool
  26. Part.Name = ("Middle")
  27. Part.CFrame = Handle.CFrame + Vector3.new(0,3.25,0)
  28. Part.Anchored = false
  29. Part.BrickColor = BrickColor.new("Dark indigo")
  30. Part.Material = ("Neon")
  31. Part.TopSurface = ("SmoothNoOutlines")
  32. Part.BottomSurface = ("SmoothNoOutlines")
  33. Part.Reflectance = 0
  34. Part.Size = Vector3.new(0.5,4.84,1.5)
  35. local Wedge = Instance.new("WedgePart")
  36. Wedge.Parent = Tool
  37. Wedge.CFrame = Part.CFrame + Vector3.new(0,4.18,0)
  38. Wedge.Anchored = false
  39. Wedge.BrickColor = BrickColor.new("Dark indigo")
  40. Wedge.Material = ("Neon")
  41. Wedge.TopSurface = ("SmoothNoOutlines")
  42. Wedge.BottomSurface = ("SmoothNoOutlines")
  43. Wedge.Reflectance = 0
  44. Wedge.Name = ("Blade")
  45. Wedge.Size = Vector3.new(0.5,3.5,1.5)
  46. local Weld = Instance.new("Weld")
  47. Weld.Parent = Handle
  48. Weld.Part0 = Wedge
  49. Weld.C0 = Wedge.CFrame:inverse()
  50. Weld.Part1 = Handle
  51. Weld.C1 = Handle.CFrame:inverse()
  52. local Weld3 = Instance.new("Weld")
  53. Weld3.Parent = Part
  54. Weld3.Part0 = Wedge
  55. Weld3.C0 = Wedge.CFrame:inverse()
  56. Weld3.Part1 = Part
  57. Weld3.C1 = Part.CFrame:inverse()
  58. local Weld4 = Instance.new("Weld")
  59. Weld4.Parent = Wedge
  60. Weld4.Part0 = Part
  61. Weld4.C0 = Part.CFrame:inverse()
  62. Weld4.Part1 = Wedge
  63. Weld4.C1 = Wedge.CFrame:inverse()
  64. Hurt = true
  65. local function Active()
  66. Tool.Name = ("Laser Blade - Active")
  67. end
  68. local function Inactive()
  69. Tool.Name = ("Laser Blade - Inactive")
  70. end
  71. local function Draw()
  72. local Sound = Instance.new("Sound")
  73. Sound.Parent = Handle
  74. Sound.Volume = 1
  75. Sound.Pitch = 0.5
  76. Sound.SoundId = ("http://www.roblox.com/asset/?id=11998796")
  77. Sound:Play()
  78. end
  79. local function Damage(part)
  80. if part.Name == ("Head") or part.Name == ("Torso") or part.Name == ("Left Arm") or part.Name == ("Right Arm") or part.Name == ("Left Leg") or part.Name == ("Right Leg") then
  81. if Hurt == true then
  82. Hurt = false
  83. part.Parent.Humanoid:TakeDamage(DAMAGE)
  84. wait(0.1)
  85. Hurt = true
  86. end
  87. end
  88. end
  89. local Enabled = true
  90. local function attack()
  91. if Enabled == true then
  92. Enabled = false
  93. local Animation = Instance.new("Animation")
  94. Animation.AnimationId = ("rbxassetid://80395075")
  95. Animation.Name = ("Swing")
  96. Animation.Parent = Tool
  97. local animTrack = Player.Character.Humanoid:LoadAnimation(Animation)
  98. animTrack:Play()
  99. local Sound = Instance.new("Sound")
  100. Sound.Parent = Handle
  101. Sound.Volume = 3
  102. Sound.SoundId = ("rbxassetid://136847657")
  103. Sound.Pitch = 0.5
  104. Sound:Play()
  105. Wedge.Touched:connect(Damage)
  106. Part.Touched:connect(Damage)
  107. wait(0.5)
  108. Enabled = true
  109. end
  110. end
  111. Tool.Activated:connect(attack)
  112. local function Charge(key)
  113. if Enabled == true then
  114. if (key == "q") then
  115. if Tool.Name == ("Laser Blade - Active") then
  116. Enabled = false
  117. local Time = 0
  118. local Animation = Instance.new("Animation")
  119. Animation.AnimationId = ("http://www.roblox.com/Asset?ID=159223413")
  120. Animation.Parent = Tool
  121. Animation.Name = ("Charge")
  122. local animTrack = Player.Character.Humanoid:LoadAnimation(Animation)
  123. animTrack:Play()
  124. Hurt = false
  125. Player.Character.Humanoid.WalkSpeed = 50
  126. local Sound = Instance.new("Sound")
  127. Sound.Parent = Player.Character.Humanoid
  128. Sound.Volume = 1
  129. Sound.SoundId = ("rbxassetid://138187451")
  130. Sound:Play()
  131. wait(5)
  132. Sound:remove()
  133. Hurt = true
  134. animTrack:Stop()
  135. Player.Character.Humanoid.WalkSpeed = 25
  136. Enabled = true
  137. end
  138. end
  139. end
  140. end
  141. Mouse.KeyDown:connect(Charge)
  142. local function Hit(part)
  143. if part.Name == ("Head") or part.Name == ("Torso") or part.Name == ("Left Arm") or part.Name == ("Right Arm") or part.Name == ("Left Leg") or part.Name == ("Right Leg") and part.Parent.Name ~= ("Player1") then
  144. local Damage = DAMAGE
  145. part.Parent.Humanoid:TakeDamage(Damage)
  146. game.Workspace.Bullet1:remove()
  147. wait(0.5)
  148. end
  149. end
  150. local function Hit2(part)
  151. if part.Name ~= ("Baseplate") or part.Name ~= ("Base") or part.Name ~= ("Middle") or part.Name ~= ("Blade") then
  152. part.BrickColor = BrickColor.Black()
  153. part.Position = part.Position + Player.Character.Head.CFrame.lookVector*5
  154. print(part.Name)
  155. part.CanCollide = true
  156. local Particle = Instance.new("ParticleEmitter")
  157. Particle.Parent = part
  158. Particle.Texture = ("http://www.roblox.com/asset/?id=311395391")
  159. Particle.Lifetime = NumberRange.new(1,1)
  160. Particle.Rate = 5
  161. local Sound = Instance.new("Sound")
  162. Sound.Parent = part
  163. Sound.Volume = 1
  164. Sound.Pitch = 0.5
  165. Sound.SoundId = ("http://www.roblox.com/asset/?id=247718165")
  166. Sound:Play()
  167. part.Anchored = true
  168. repeat
  169. wait(0.1)
  170. part.CFrame = part.CFrame + Vector3.new(0,1,0)
  171. part.Transparency = part.Transparency + 0.1
  172. until part.Transparency > 1
  173. part:remove()
  174. end
  175. end
  176. local function Zap(key)
  177. if Enabled == true then
  178. if (key == "e")then
  179. if Tool.Name == ("Laser Blade - Active") then
  180. Enabled = false
  181. local Animation = Instance.new("Animation")
  182. Animation.AnimationId = ("rbxassetid://32659706")
  183. local animTrack = Player.Character.Humanoid:LoadAnimation(Animation)
  184. animTrack:Play()
  185. wait(0.25)
  186. local Bullet = Instance.new("Part")
  187. Bullet.Name = ("Bullet1")
  188. Bullet.Anchored = false
  189. Bullet.Parent = game.Workspace
  190. Bullet.Size = Vector3.new(4,4,4)
  191. Bullet.Material = ("Neon")
  192. Bullet.Shape = ("Ball")
  193. Bullet.BrickColor = BrickColor.new("Dark indigo")
  194. Bullet.TopSurface = ("Smooth")
  195. Bullet.BottomSurface = ("Smooth")
  196. Bullet.CanCollide = false
  197. Bullet.Position = Wedge.Position + Vector3.new(0,5,0)
  198. Bullet.CFrame = CFrame.new(Bullet.Position,Mouse.Hit.p)
  199. local v = Instance.new("BodyVelocity",Bullet)
  200. v.velocity = Bullet.CFrame.lookVector*360
  201. v.maxForce = Vector3.new(math.huge,math.huge,math.huge)
  202. local Sound = Instance.new("Sound")
  203. Sound.Parent = Part
  204. Sound.Volume = 1
  205. Sound.SoundId = ("http://www.roblox.com/asset/?id=247718107")
  206. Sound.Pitch = 1
  207. Sound:Play()
  208. wait(0.1)
  209. Bullet.Touched:connect(Hit)
  210. wait(0.3)
  211. Enabled = true
  212.  
  213. end
  214. end
  215. end
  216. end
  217. Mouse.KeyDown:connect(Zap)
  218. local Open = true
  219. local function Shield(key)
  220. if (key == "r") then
  221. if Enabled == true then
  222. if Open == true then
  223. Open = false
  224. if Tool.Name == ("Laser Blade - Active") then
  225. Player.Character.Humanoid.WalkSpeed = 0
  226. local Animation = Instance.new("Animation")
  227. Animation.AnimationId = ("http://www.roblox.com/asset/?id=235542946")
  228. local animTrack = Player.Character.Humanoid:LoadAnimation(Animation)
  229. animTrack:Play()
  230. local Part = Instance.new("Part")
  231. Part.Name = ("Shield")
  232. Part.Parent = game.Workspace
  233. Part.Rotation = Player.Character.Head.Rotation
  234. Part.Size = Vector3.new(12.04,14.15,0.2)
  235. Part.Anchored = true
  236. Part.CanCollide = false
  237. Part.BrickColor = BrickColor.new("Dark indigo")
  238. Part.Material = ("Neon")
  239. Part.Position = Wedge.Position + Player.Character.Head.CFrame.lookVector*10 - Vector3.new(0,5,0)
  240. Part.Anchored = true
  241. Part.Touched:connect(Hit2)
  242. local Sound1 = Instance.new("Sound")
  243. Sound1.Parent = Wedge
  244. Sound1.Volume = 1
  245. Sound1.Pitch = 1
  246. Sound1.SoundId = ("http://www.roblox.com/asset/?id=247718230")
  247. Sound1:Play()
  248. wait(0.5)
  249. local Sound2 = Instance.new("Sound")
  250. Sound2.Parent = Wedge
  251. Sound2.Volume = 1
  252. Sound2.Pitch = 1
  253. Sound2.SoundId = ("http://www.roblox.com/asset/?id=247718230")
  254. Sound2:Play()
  255. wait(0.5)
  256. local Sound3 = Instance.new("Sound")
  257. Sound3.Parent = Wedge
  258. Sound3.Volume = 1
  259. Sound3.Pitch = 1
  260. Sound3.SoundId = ("http://www.roblox.com/asset/?id=247718230")
  261. Sound3:Play()
  262. wait(1)
  263. Enabled = false
  264. Open = false
  265. if Enabled == false then
  266. game.Workspace.Shield:remove()
  267. Player.Character.Humanoid.WalkSpeed = 25
  268. animTrack:Stop()
  269. Open = true
  270. Enabled = true
  271. end
  272. end
  273. end
  274. end
  275. end
  276. end
  277. Mouse.KeyDown:connect(Shield)
  278. local function Effect()
  279. if Tool.Name == ("Laser Blade - Active") then
  280. repeat
  281. wait(0.1)
  282. local Effect1 = Instance.new("Part")
  283. Effect1.Parent = game.Workspace
  284. Effect1.Material = Handle.Material
  285. Effect1.Size = Handle.Size
  286. Effect1.CanCollide = false
  287. Effect1.Anchored = true
  288. Effect1.CFrame = Handle.CFrame
  289. Effect1.BrickColor = Handle.BrickColor
  290. local Effect2 = Instance.new("Part")
  291. Effect2.Parent = game.Workspace
  292. Effect2.Material = Part.Material
  293. Effect2.Size = Part.Size
  294. Effect2.CanCollide = false
  295. Effect2.Anchored = true
  296. Effect2.CFrame = Part.CFrame
  297. Effect2.BrickColor = Part.BrickColor
  298. local Effect3 = Instance.new("WedgePart")
  299. Effect3.Parent = game.Workspace
  300. Effect3.Material = Wedge.Material
  301. Effect3.Size = Wedge.Size
  302. Effect3.CanCollide = false
  303. Effect3.Anchored = true
  304. Effect3.CFrame = Wedge.CFrame
  305. Effect3.BrickColor = Wedge.BrickColor
  306. wait(0.1)
  307. local Effect7 = Instance.new("Part")
  308. Effect7.Parent = game.Workspace
  309. Effect7.Material = Handle.Material
  310. Effect7.Size = Handle.Size
  311. Effect7.CanCollide = false
  312. Effect7.Anchored = true
  313. Effect7.CFrame = Handle.CFrame
  314. Effect7.BrickColor = Handle.BrickColor
  315. local Effect8 = Instance.new("Part")
  316. Effect8.Parent = game.Workspace
  317. Effect8.Material = Part.Material
  318. Effect8.Size = Part.Size
  319. Effect8.CanCollide = false
  320. Effect8.Anchored = true
  321. Effect8.CFrame = Part.CFrame
  322. Effect8.BrickColor = Part.BrickColor
  323. local Effect9 = Instance.new("WedgePart")
  324. Effect9.Parent = game.Workspace
  325. Effect9.Material = Wedge.Material
  326. Effect9.Size = Wedge.Size
  327. Effect9.CanCollide = false
  328. Effect9.Anchored = true
  329. Effect9.CFrame = Wedge.CFrame
  330. Effect9.BrickColor = Wedge.BrickColor
  331. wait(0.1)
  332. local Effect4 = Instance.new("Part")
  333. Effect4.Parent = game.Workspace
  334. Effect4.Material = Handle.Material
  335. Effect4.Size = Handle.Size
  336. Effect4.CanCollide = false
  337. Effect4.Anchored = true
  338. Effect4.CFrame = Handle.CFrame
  339. Effect4.BrickColor = Handle.BrickColor
  340. local Effect5 = Instance.new("Part")
  341. Effect5.Parent = game.Workspace
  342. Effect5.Material = Part.Material
  343. Effect5.Size = Part.Size
  344. Effect5.CanCollide = false
  345. Effect5.Anchored = true
  346. Effect5.CFrame = Part.CFrame
  347. Effect5.BrickColor = Part.BrickColor
  348. local Effect6 = Instance.new("WedgePart")
  349. Effect6.Parent = game.Workspace
  350. Effect6.Material = Wedge.Material
  351. Effect6.Size = Wedge.Size
  352. Effect6.CanCollide = false
  353. Effect6.Anchored = true
  354. Effect6.CFrame = Wedge.CFrame
  355. Effect6.BrickColor = Wedge.BrickColor
  356. Effect1.Transparency = 0.1
  357. Effect2.Transparency = 0.1
  358. Effect3.Transparency = 0.1
  359. wait(0.035)
  360. Effect4.Transparency = 0.1
  361. Effect5.Transparency = 0.1
  362. Effect6.Transparency = 0.1
  363. wait(0.035)
  364. Effect7.Transparency = 0.1
  365. Effect8.Transparency = 0.1
  366. Effect9.Transparency = 0.1
  367. wait(0.035)
  368. Effect1.Transparency = 0.2
  369. Effect2.Transparency = 0.2
  370. Effect3.Transparency = 0.2
  371. wait(0.035)
  372. Effect4.Transparency = 0.2
  373. Effect5.Transparency = 0.2
  374. Effect6.Transparency = 0.2
  375. wait(0.035)
  376. Effect7.Transparency = 0.2
  377. Effect8.Transparency = 0.2
  378. Effect9.Transparency = 0.2
  379. wait(0.035)
  380. Effect1.Transparency = 0.3
  381. Effect2.Transparency = 0.3
  382. Effect3.Transparency = 0.3
  383. wait(0.035)
  384. Effect4.Transparency = 0.3
  385. Effect5.Transparency = 0.3
  386. Effect6.Transparency = 0.3
  387. wait(0.035)
  388. Effect7.Transparency = 0.3
  389. Effect8.Transparency = 0.3
  390. Effect9.Transparency = 0.3
  391. wait(0.035)
  392. Effect1.Transparency = 0.4
  393. Effect2.Transparency = 0.4
  394. Effect3.Transparency = 0.4
  395. wait(0.035)
  396. Effect4.Transparency = 0.4
  397. Effect5.Transparency = 0.4
  398. Effect6.Transparency = 0.4
  399. wait(0.035)
  400. Effect7.Transparency = 0.4
  401. Effect8.Transparency = 0.4
  402. Effect9.Transparency = 0.4
  403. wait(0.035)
  404. Effect1.Transparency = 0.5
  405. Effect2.Transparency = 0.5
  406. Effect3.Transparency = 0.5
  407. wait(0.035)
  408. Effect4.Transparency = 0.5
  409. Effect5.Transparency = 0.5
  410. Effect6.Transparency = 0.5
  411. wait(0.035)
  412. Effect7.Transparency = 0.5
  413. Effect8.Transparency = 0.5
  414. Effect9.Transparency = 0.5
  415. wait(0.035)
  416. Effect1.Transparency = 0.6
  417. Effect2.Transparency = 0.6
  418. Effect3.Transparency = 0.6
  419. wait(0.035)
  420. Effect4.Transparency = 0.6
  421. Effect5.Transparency = 0.6
  422. Effect6.Transparency = 0.6
  423. wait(0.035)
  424. Effect7.Transparency = 0.6
  425. Effect8.Transparency = 0.6
  426. Effect9.Transparency = 0.6
  427. wait(0.035)
  428. Effect1.Transparency = 0.7
  429. Effect2.Transparency = 0.7
  430. Effect3.Transparency = 0.7
  431. wait(0.035)
  432. Effect4.Transparency = 0.7
  433. Effect5.Transparency = 0.7
  434. Effect6.Transparency = 0.7
  435. wait(0.035)
  436. Effect7.Transparency = 0.7
  437. Effect8.Transparency = 0.7
  438. Effect9.Transparency = 0.7
  439. wait(0.035)
  440. Effect1.Transparency = 0.8
  441. Effect2.Transparency = 0.8
  442. Effect3.Transparency = 0.8
  443. wait(0.035)
  444. Effect4.Transparency = 0.8
  445. Effect5.Transparency = 0.8
  446. Effect6.Transparency = 0.8
  447. wait(0.035)
  448. Effect7.Transparency = 0.8
  449. Effect8.Transparency = 0.8
  450. Effect9.Transparency = 0.8
  451. wait(0.035)
  452. Effect1.Transparency = 0.9
  453. Effect2.Transparency = 0.9
  454. Effect3.Transparency = 0.9
  455. wait(0.035)
  456. Effect4.Transparency = 0.9
  457. Effect5.Transparency = 0.9
  458. Effect6.Transparency = 0.9
  459. wait(0.035)
  460. Effect7.Transparency = 0.9
  461. Effect8.Transparency = 0.9
  462. Effect9.Transparency = 0.9
  463. wait(0.035)
  464. Effect1.Transparency = 1
  465. Effect2.Transparency = 1
  466. Effect3.Transparency = 1
  467. wait(0.035)
  468. Effect4.Transparency = 1
  469. Effect5.Transparency = 1
  470. Effect6.Transparency = 1
  471. wait(0.035)
  472. Effect7.Transparency = 1
  473. Effect8.Transparency = 1
  474. Effect9.Transparency = 1
  475. wait(0.035)
  476. until Tool.Name == ("Laser Blade - Inactive")
  477. end
  478. end
  479. Tool.Equipped:connect(Effect)
  480. Tool.Equipped:connect(Draw)
  481. Tool.Equipped:connect(Active)
  482. Tool.Unequipped:connect(Inactive)
Add Comment
Please, Sign In to add comment