Message
Message
FOV = 175,
TeamCheck = true,
DistanceCheck = true,
VisibleCheck = true,
Smoothness = 0.975,
Prediction = {
Enabled = false,
Value = 0.185
}
}
_G.JALON_AIMCONFIG = _G.JALON_AIMCONFIG or aim_config
-- services
local input_service = game:GetService("UserInputService")
local players = game:GetService("Players")
local run_service = game:GetService("RunService")
-- objects
local camera = workspace.CurrentCamera
local player = players.LocalPlayer
local fovCircle, targetBox = Drawing.new("Circle"), Drawing.new("Square")
-- variables
local current_nearest_plr
-- functions
local function is_player_valid(plrArg)
local plrChar = plrArg.Character
local plrHumanoid, target_part = (plrChar and
plrChar:FindFirstChildWhichIsA("Humanoid")), (plrChar and
plrChar:FindFirstChild("HumanoidRootPart"))
return plrArg ~= player and (plrChar and (plrHumanoid and plrHumanoid.Health
~= 0)) and not plrArg.Character:FindFirstChildWhichIsA("ForceField") and (if
aim_config.TeamCheck then (plrArg.Neutral or plrArg.TeamColor ~= player.TeamColor)
else true), target_part
end
-- main
targetBox.Color = Color3.fromRGB(0, 185, 35)
targetBox.Filled = true
targetBox.Size = Vector2.new(20, 20)
targetBox.Thickness = 20
targetBox.Transparency = .6
run_service.PreSimulation:Connect(function()
current_nearest_plr = get_nearest_player()
fovCircle.Radius = aim_config.FOV
fovCircle.Position = input_service:GetMouseLocation()
if current_nearest_plr then
local screen_pos, on_screen =
camera:WorldToViewportPoint(current_nearest_plr.aimPart.Position)
targetBox.Visible = on_screen
targetBox.Position = (Vector2.new(screen_pos.X, screen_pos.Y) -
(targetBox.Size / 2))
if input_service:IsKeyDown(aim_config.KeyActivation) then
local target_position = (if aim_config.Prediction.Enabled then
get_camera_prediction(current_nearest_plr.aimPart) else
current_nearest_plr.aimPart)
local horizontal_look = CFrame.lookAt(camera.CFrame.Position,
target_position.Position)
camera.CFrame = camera.CFrame:Lerp(horizontal_look,
aim_config.Smoothness)
end
else
targetBox.Visible = false
targetBox.Position = Vector3.zero
end
end)