local Players = game:GetService("Players")
local UserInputService = game:GetService("UserInputService")
local RunService = game:GetService("RunService")
local Workspace = game:GetService("Workspace")
local player = Players.LocalPlayer
local camera = Workspace.CurrentCamera
local aimEnabled = false
local aimRadius = 200
-- GUI ANA
local screenGui = Instance.new("ScreenGui")
screenGui.Name = "AimUI"
screenGui.ResetOnSpawn = false
screenGui.Parent = player:WaitForChild("PlayerGui")
-- FOV รemberi
local circle = Instance.new("Frame")
circle.Size = UDim2.new(0, aimRadius * 2, 0, aimRadius * 2)
circle.Position = UDim2.new(0.5, -aimRadius, 0.5, -aimRadius)
circle.BackgroundTransparency = 1
circle.Visible = false
circle.Parent = screenGui
local stroke = Instance.new("UIStroke")
stroke.Thickness = 2
stroke.Color = Color3.fromRGB(255, 0, 0)
stroke.Parent = circle
local corner = Instance.new("UICorner")
corner.CornerRadius = UDim.new(1, 0)
corner.Parent = circle
-- Mobil Buton
local aimButton = Instance.new("TextButton")
aimButton.Size = UDim2.new(0, 120, 0, 50)
aimButton.Position = UDim2.new(1, -140, 0, 10)
aimButton.Text = "AIM OFF"
aimButton.TextScaled = true
aimButton.BackgroundColor3 = Color3.fromRGB(255, 0, 0)
aimButton.TextColor3 = Color3.fromRGB(255,255,255)
aimButton.Parent = screenGui
local buttonCorner = Instance.new("UICorner")
buttonCorner.CornerRadius = UDim.new(0, 12)
buttonCorner.Parent = aimButton
-- Toggle Fonksiyon
local function toggleAim()
aimEnabled = not aimEnabled
circle.Visible = aimEnabled
if aimEnabled then
aimButton.Text = "AIM ON"
aimButton.BackgroundColor3 = Color3.fromRGB(0, 170, 0)
warn("AIM AรIK")
else
aimButton.Text = "AIM OFF"
aimButton.BackgroundColor3 = Color3.fromRGB(255, 0, 0)
warn("AIM KAPALI")
end
end
-- Buton Tฤฑklama
aimButton.MouseButton1Click:Connect(toggleAim)
-- H Tuลu
UserInputService.InputBegan:Connect(function(input, processed)
if processed then return end
if input.KeyCode == Enum.KeyCode.H then
toggleAim()
end
end)
-- En yakฤฑn hedef
local function getClosestTarget()
local closest = nil
local shortest = aimRadius
local center = Vector2.new(camera.ViewportSize.X / 2, camera.ViewportSize.Y / 2)
-- Oyuncular
for _, target in ipairs(Players:GetPlayers()) do
if target ~= player and target.Character then
local head = target.Character:FindFirstChild("Head")
local humanoid = target.Character:FindFirstChild("Humanoid")
if head and humanoid and humanoid.Health > 0 then
local screenPos, visible = camera:WorldToViewportPoint(head.Position)
if visible then
local dist = (Vector2.new(screenPos.X, screenPos.Y) - center).Magnitude
if dist < shortest then
shortest = dist
closest = head
end
end
end
end
end
-- Dummy
local dummy = Workspace:FindFirstChild("Dummy")
if dummy and dummy:FindFirstChild("Head") then
local head = dummy.Head
local screenPos, visible = camera:WorldToViewportPoint(head.Position)
if visible then
local dist = (Vector2.new(screenPos.X, screenPos.Y) - center).Magnitude
if dist < shortest then
shortest = dist
closest = head
end
end
end
return closest
end
-- Aim Sistemi
RunService.RenderStepped:Connect(function()
if not aimEnabled then return end
local target = getClosestTarget()
if target then
local camPos = camera.CFrame.Position
camera.CFrame = CFrame.lookAt(camPos, target.Position)
end
end)