Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local player = game.Players.LocalPlayer
- local mouse = player:GetMouse()
- local targeting = 0
- local targetingpart = 0
- local targetingobject = nil
- local targetselection = nil
- local beam = nil
- mouse.Button1Down:connect(function()
- local target = mouse.Target
- if mouse.Target ~= nil then
- if mouse.Target.ClassName == ("Part") then
- if target.Parent:FindFirstChild("Humanoid") ~= nil then
- targeting = 1
- targetingobject = target
- for i,v in pairs(targetingobject.Parent:GetChildren()) do
- if v.ClassName == ("Part") then
- v.Anchored = false
- v.CanCollide = false
- end
- end
- t = Instance.new("Part")
- t.Anchored = true
- t.BrickColor = BrickColor.new("Electric blue")
- t.CanCollide = false
- t.Parent = game.Workspace
- t.Shape = ("Ball")
- t.Transparency = 0.5
- t.Reflectance = 0.5
- t.Size = Vector3.new(3,3,3)
- t.TopSurface = ("Smooth")
- t.BottomSurface = ("Smooth")
- t.Material = ("Neon")
- targetselection = t
- local a1 = Instance.new("Attachment")
- a1.Parent = player.Character["Right Arm"]
- local a2 = Instance.new("Attachment")
- a2.Parent = t
- local b = Instance.new("Beam")
- beam = b
- beam.Color = Color3.fromRGB(0, 166, 255)
- beam.Attachment0 = a1
- beam.Attachment1 = a2
- beam.Texture = ("rbxassetid://1196410051")
- beam.FaceCamera = true
- beam.CurveSize1 = 5
- beam.Segments = 100
- beam.Parent = player.Character
- end
- else
- if target.Name ~= ("Base") then
- targetingpart = 1
- t = Instance.new("Part")
- t.Anchored = true
- t.BrickColor = BrickColor.new("Electric blue")
- t.CanCollide = false
- t.Parent = game.Workspace
- t.Shape = ("Ball")
- t.Transparency = 0.5
- t.Reflectance = 0.5
- t.Size = Vector3.new(3,3,3)
- t.TopSurface = ("Smooth")
- t.BottomSurface = ("Smooth")
- t.Material = ("Neon")
- targetselection = t
- targetingobject = target
- end
- end
- end
- end)
- mouse.Button1Up:connect(function()
- if targeting == 1 then
- targeting = 0
- for i,v in pairs(targetingobject.Parent:GetChildren()) do
- if v.ClassName == ("Part") then
- v.Anchored = false
- v.CanCollide = true
- end
- end
- if beam ~= nil then
- beam:Destroy()
- beam = nil
- end
- if targetselection ~= nil then
- targetselection:Destroy()
- targetselection = nil
- end
- end
- if targetingpart == 1 then
- targetingpart = 0
- if targetselection ~= nil then
- targetselection:Destroy()
- targetselection = nil
- end
- end
- end)
- while true do
- if targeting == 1 then
- if targetingobject ~= nil then
- if targetingobject.Parent:FindFirstChild("HumanoidRootPart") ~= nil then
- targetingobject.Parent.HumanoidRootPart.CFrame = mouse.Hit
- if targetselection ~= nil then
- targetselection.CFrame = targetingobject.Parent.HumanoidRootPart.CFrame
- end
- end
- end
- end
- if targetingpart == 1 then
- if targetingobject ~= nil then
- if targetingobject.ClassName == ("Part") then
- targetingobject.CFrame = mouse.Hit
- if targetselection ~= nil then
- targetselection.CFrame = targetingobject.CFrame
- end
- end
- end
- end
- wait(0.01)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement