-- LocalScript -- StarterPlayer > StarterPlayerScripts local Players = game:GetService("Players") local UserInputService = game:GetService("UserInputService") local RunService = game:GetService("RunService") local player = Players.LocalPlayer local camera = workspace.CurrentCamera -- Einstellungen local AIM_ENABLED = false local AIM_KEY = Enum.KeyCode.Q local FOV_RADIUS = 150 local MAX_DISTANCE = 500 local SMOOTHNESS = 0.15 -------------------------------------------------- -- FOV Kreis -------------------------------------------------- local circle = Drawing.new("Circle") circle.Visible = true circle.Radius = FOV_RADIUS circle.Thickness = 2 circle.NumSides = 64 circle.Filled = false circle.Transparency = 1 -------------------------------------------------- -- FOV Position aktualisieren -------------------------------------------------- local function updateFOV() circle.Position = Vector2.new( camera.ViewportSize.X / 2, camera.ViewportSize.Y / 2 ) circle.Radius = FOV_RADIUS end -------------------------------------------------- -- Wallcheck -------------------------------------------------- local function canSeeTarget(targetPart) local origin = camera.CFrame.Position local direction = targetPart.Position - origin local params = RaycastParams.new() params.FilterType = Enum.RaycastFilterType.Exclude params.FilterDescendantsInstances = { player.Character } local result = workspace:Raycast( origin, direction, params ) if not result then return true end return result.Instance:IsDescendantOf(targetPart.Parent) end -------------------------------------------------- -- Bestes Ziel finden -------------------------------------------------- local function getClosestTarget() local center = Vector2.new( camera.ViewportSize.X / 2, camera.ViewportSize.Y / 2 ) local closestTarget = nil local closestDistance = FOV_RADIUS for _, target in ipairs(Players:GetPlayers()) do if target ~= player and target.Character then local character = target.Character local humanoid = character:FindFirstChildOfClass("Humanoid") local head = character:FindFirstChild("Head") local root = character:FindFirstChild("HumanoidRootPart") if humanoid and head and root and humanoid.Health > 0 then local distance = (root.Position - camera.CFrame.Position).Magnitude if distance <= MAX_DISTANCE then local screenPosition, onScreen = camera:WorldToViewportPoint(head.Position) if onScreen then local screenDistance = (Vector2.new( screenPosition.X, screenPosition.Y ) - center).Magnitude if screenDistance < closestDistance then if canSeeTarget(head) then closestDistance = screenDistance closestTarget = head end end end end end end end return closestTarget end -------------------------------------------------- -- Aim -------------------------------------------------- RunService.RenderStepped:Connect(function() updateFOV() circle.Visible = AIM_ENABLED if not AIM_ENABLED then return end local target = getClosestTarget() if target then local cameraPosition = camera.CFrame.Position local targetCFrame = CFrame.lookAt( cameraPosition, target.Position ) camera.CFrame = camera.CFrame:Lerp( targetCFrame, SMOOTHNESS ) end end) -------------------------------------------------- -- Aktivieren / Deaktivieren -------------------------------------------------- UserInputService.InputBegan:Connect(function(input, processed) if processed then return end if input.KeyCode == AIM_KEY then AIM_ENABLED = not AIM_ENABLED end end)