Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --This is needs to be in a local script
- local player = game:GetService('Players').LocalPlayer
- local char = player.Character
- local mouse = player:GetMouse()
- --Beam source
- local b = Instance.new('Part')
- b.Parent = game.Workspace
- b.Size = Vector3.new(10,10,10)
- b.CanCollide = false
- b.Name = 'Cube'
- b.Color = Color3.new(BrickColor.White(255,255,255))
- b.Locked = true
- --thrust
- local rok = Instance.new('BodyPosition')
- rok.Parent = b
- rok.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
- rok.P = 9999
- b.BodyPosition.Position = Vector3.new(char.Torso.Position.X,15,char.Torso.Position.Z)
- b.Material = 'Neon'
- mouse.Button1Down:connect(function (clickdown)
- local ray = Ray.new(b.CFrame.p, (mouse.Hit.p - b.CFrame.p).unit * 300)
- local part, position = workspace:FindPartOnRay(ray, player.Character, false, true)
- local beam = Instance.new("Part", workspace)
- beam.BrickColor = BrickColor.new("Really black")
- beam.FormFactor = "Custom"
- beam.Material = "Neon"
- beam.Transparency = 0
- beam.Anchored = true
- beam.Locked = true
- beam.CanCollide = false
- beam.Name = 'b09'
- local distance = (b.CFrame.p - position).magnitude
- beam.Size = Vector3.new(3, 3, distance)
- mouse.Target.Anchored = true
- if mouse.Target.Name ~= 'Base' then
- print(mouse.Target.Name)
- mouse.Target:Destroy()
- end
- while true do
- local ray = Ray.new(b.CFrame.p, (
- mouse.Hit.p - b.CFrame.p).unit * 300)
- local distance = (b.CFrame.p - position).magnitude
- beam.Size = Vector3.new(3, 3, distance)
- beam.CFrame = CFrame.new(b.CFrame.p, position) * CFrame.new(0, 0, -distance / 2)
- wait()
- end
- end)
- mouse.Button1Up:connect(function (clickup)
- game.Workspace.b09:Destroy()
- end)
- while true do
- b.BodyPosition.Position = Vector3.new(char.Torso.Position.X,15,char.Torso.Position.Z)
- wait(.1)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement