Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local tool = Instance.new("Tool")
- tool.RequiresHandle = false
- tool.Name = "BeamTool"
- tool.Activated:Connect(function()
- local mouse = owner:GetMouse()
- local beam = Instance.new("Beam", game.Workspace)
- beam.FaceCamera = true
- beam.Color = ColorSequence.new(Color3.new(1, 0, 0))
- beam.Transparency = NumberSequence.new(0, 1)
- beam.Width0 = 1
- beam.Width1 = 5
- beam.Segments = 10
- local startPos = mouse.Hit.p
- while true do
- local endPos = mouse.Hit.p
- local distance = (startPos - endPos).magnitude
- if distance > 4 then
- beam.Attachment0 = Instance.new("Attachment", game.Workspace.Terrain)
- beam.Attachment0.Position = startPos
- beam.Attachment1 = Instance.new("Attachment", game.Workspace.Terrain)
- beam.Attachment1.Position = endPos
- break
- end
- wait()
- end
- local duration = 1 -- Change the duration as required
- local tweenInfo = TweenInfo.new(duration, Enum.EasingStyle.Linear, Enum.EasingDirection.Out)
- local transparencyGoal = {Transparency = 1}
- local tween = game:GetService("TweenService"):Create(beam, tweenInfo, transparencyGoal)
- tween:Play()
- tween.Completed:Connect(function()
- beam:Destroy()
- end)
- end)
- tool.Parent = owner.Backpack
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement