Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- this is my script so far
- -------------CREATES THE POINT I WANNA AIM AT-----------------
- Instance.new("Part",game.Workspace)
- game.Workspace.Part.Name="Green"
- game.Workspace.Green.CFrame=CFrame.new(35.7394753, 3, -23.1335964, -0.0204065256, 0, -0.999793291, 0, 1, 0, 0.999793291, 0, -0.0204065256)
- game.Workspace.Green.Anchored=true
- game.Workspace.Green.Size=Vector3.new(1,1,1)
- game.Workspace.Green.BrickColor=BrickColor.Green()
- ---------------------------------------------------------------------
- -------------------------------Creates a wall--------------------------
- Instance.new("Part",game.Workspace)
- game.Workspace.Part.Name="Wall"
- game.Workspace.Wall.CFrame=CFrame.new(-7.33410549, 3, -24.0379162, -0.0346626081, -3.2247442e-08, -0.99939847, -6.16503897e-08, 0.99999994, -3.0128664e-08, 0.99939847, 6.05688868e-08, -0.0346626081)
- game.Workspace.Wall.Anchored=true
- game.Workspace.Wall.Size=Vector3.new(30,30,1)
- game.Workspace.Wall.Transparency=0.5
- ---------------------------------------------------------------------
- wait()
- ------------------------Toggles the aim------------------------------
- local UserInputService = game:GetService("UserInputService");
- UserInputService.InputBegan:Connect(function(input, gameProcessed)
- if input.KeyCode == Enum.KeyCode.Q then
- if game.Workspace:FindFirstChild("Green") then
- game.Workspace.Green.Name="Green2"
- else
- game.Workspace.Green2.Name="Green"
- end
- end
- end)
- ---------------------------------------------------------------------
- -- THE GUD PART--
- while true do
- wait()
- if game.Workspace:FindFirstChild("Green") then
- local point1 = game.workspace.ZetaIsBack.Head
- local point2 = game.workspace.Green
- local camera = workspace.CurrentCamera
- local worldPoint = Vector3.new(point2.Position)
- local vector, inViewport = camera:WorldToViewportPoint(worldPoint)
- local distance = math.floor((point1.Position - point2.Position).Magnitude)
- print(distance)
- local ray = Ray.new(point1.CFrame.Position, (point2.CFrame.Position - point1.CFrame.Position) )
- local part,position = game.workspace:FindPartOnRay(ray,point2,false,true)
- if not part then -- if the ray is colliding with any part then
- if inViewport == true then
- if distance<100 then
- game.Workspace.CurrentCamera.CFrame=CFrame.new(game.workspace.CurrentCamera.CFrame.Position,game.workspace.Green.CFrame.Position)
- end
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement