Advertisement
ADSKer380

Roblox Lazer Sword

Aug 27th, 2024
24
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.34 KB | Source Code | 0 0
  1. local plr = game.Players.LocalPlayer
  2. local tool = Instance.new("Tool",plr.Backpack)
  3. tool.Name = "Laser sword"
  4. tool.GripPos = Vector3.new(0,-0.2,0)
  5.  
  6. handle = Instance.new("Part",tool)
  7. handle.Name = "Handle"
  8. handle.Size = Vector3.new(0.55,1,0.55)
  9. handle.Color = Color3.fromRGB(0,0,0)
  10. handle.CanCollide = false
  11. handle.Material = Enum.Material.Metal
  12. handle.CFrame = plr.Character:FindFirstChild("Right Arm").CFrame
  13.  
  14. lazer = Instance.new("Part",handle)
  15. lazer.Name = "Handle"
  16. lazer.CanCollide = false
  17. lazer.Size = Vector3.new(0.55,2.5,0.55)
  18. lazer.Color = Color3.fromRGB(255,255,255)
  19. lazer.Material = Enum.Material.Neon
  20.  
  21. lazer.Touched:Connect(function(hit)
  22. humanoid = hit.Parent:FindFirstChildOfClass("Humanoid")
  23.  if humanoid and hit.Parent ~= plr.Character and humanoid.Health ~= 0 then
  24. humanoid:TakeDamage(5)
  25.    if humanoid.Health <= 0 then
  26.  humanoid.RootPart.Velocity = humanoid.RootPart.CFrame.LookVector * -50
  27.  for _, part in pairs(humanoid.Parent:GetChildren()) do
  28.                         if part:IsA("BasePart") then
  29.                             part.Color = Color3.fromRGB(255, 255, 255)
  30.                             part.Material = Enum.Material.Neon
  31.    fire = Instance.new("Fire", part)
  32.            fire.Color = Color3.fromRGB(255, 255, 255)
  33.            fire.SecondaryColor = fire.Color
  34.            fire.Heat = 0
  35.            fire.Size = 6
  36.                         end
  37.                     end
  38.    end
  39.  end
  40. end)
  41.  
  42. slash = Instance.new("Sound", handle)
  43. slash.Name = "Saber Slash"
  44. slash.Volume = 1
  45. slash.PlaybackSpeed = 1
  46. slash.Looped = false
  47.  
  48. local lastPressTime = 0
  49. tool.Activated:Connect(function()
  50.   local currentTime = tick()
  51.             if currentTime - lastPressTime >= 1 then
  52.                 lastPressTime = currentTime
  53.           ran = math.random(1, 2)
  54.         if ran == 1 then
  55.     local Anim = Instance.new("Animation")
  56.     Anim.AnimationId = "rbxassetid://203875401"
  57.     local k = game:GetService("Players").LocalPlayer.Character.Humanoid:LoadAnimation(Anim)
  58. k.Looped = false
  59. k:AdjustSpeed(1)
  60.     k:Play()
  61.     slash.SoundId = "rbxassetid://89357738"
  62.     slash:Play()
  63.         else
  64.    local Anim = Instance.new("Animation")
  65.     Anim.AnimationId = "rbxassetid://203876950"
  66.    local k = game:GetService("Players").LocalPlayer.Character.Humanoid:LoadAnimation(Anim)
  67. k.Looped = false
  68. k:AdjustSpeed(1)
  69.     k:Play()
  70.     slash.SoundId = "rbxassetid://89357340"
  71.     slash:Play()
  72.         end
  73.             end
  74. end)
  75.  
  76. tool.Equipped:Connect(function()
  77. local Anim = Instance.new("Animation")
  78. Anim.AnimationId = "rbxassetid://94160581"
  79. local k = game:GetService("Players").LocalPlayer.Character.Humanoid:LoadAnimation(Anim)
  80. k:Play()
  81. k:AdjustSpeed(1)
  82.  
  83. S1 = Instance.new("Sound", lazer)
  84. S1.Name = "Equip Sound"
  85. S1.SoundId = "rbxassetid://1194454803"
  86. S1.Volume = 1
  87. S1.PlaybackSpeed = 1
  88. S1.Looped = false
  89. S1:Play()
  90.  
  91. S2 = Instance.new("Sound", lazer)
  92. S2.Name = "Loop Lazer"
  93. S2.SoundId = "rbxassetid://89357191"
  94. S2.Volume = 1
  95. S2.PlaybackSpeed = 1
  96. S2.Looped = true
  97. S2:Play()
  98. end)
  99.  
  100. tool.Unequipped:Connect(function()
  101. S2:Stop()
  102.  
  103. S3 = Instance.new("Sound", plr.Character.HumanoidRootPart)
  104. S3.Name = "Unequip"
  105. S3.SoundId = "rbxassetid://1194453600"
  106. S3.Volume = 1
  107. S3.PlaybackSpeed = 1
  108. S3.Looped = false
  109. S3:Play()
  110. end)
  111.  
  112. game:GetService("RunService").Heartbeat:Connect(function()
  113. lazer.CFrame = handle.CFrame * CFrame.new(0, 1.76, 0)
  114. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement