Professional Documents
Culture Documents
return target
end
loop = RunService.RenderStepped:Connect(function()
local UserInputService = game:GetService("UserInputService")
local pressed = --[[UserInputService:IsKeyDown(Enum.KeyCode.E)]]
UserInputService:IsMouseButtonPressed(Enum.UserInputType.MouseButton2) --
Enum.UserInputType.MouseButton2
local localPlay = game.Players.localPlayer.Character
local cam = workspace.CurrentCamera
local zz = workspace.CurrentCamera.ViewportSize/2
if pressed then
local Line = Drawing.new("Line")
local curTar = getClosest(cam.CFrame)
local ssHeadPoint = cam:WorldToScreenPoint(curTar.Character.Head.Position)
ssHeadPoint = Vector2.new(ssHeadPoint.X, ssHeadPoint.Y)
if (ssHeadPoint - zz).Magnitude < fov then
workspace.CurrentCamera.CFrame =
workspace.CurrentCamera.CFrame:Lerp(CFrame.new(cam.CFrame.Position,
curTar.Character.Head.Position), smoothing)
end
end
if UserInputService:IsKeyDown(Enum.KeyCode.Delete) then
loop:Disconnect()
FOVring:Remove()
end
end)