script made by ai 2
Key Required

script made by ai 2

[FPS] Flicksmertni*qqsmertni*qq 701 views 17 executesUpdated Feb 22, 2026
Unrated
00
Lua Script•1998 lines (91205 chars)
local Library = loadstring(game:HttpGet("https://raw.githubusercontent.com/ImInsane-1337/neverlose-ui/refs/heads/main/source/library.lua"))()

-- [СЕРВИСЫ]
local UIS = game:GetService("UserInputService")
local RunService = game:GetService("RunService")
local Players = game:GetService("Players")
local Lighting = game:GetService("Lighting")
local TeleportService = game:GetService("TeleportService")
local HttpService = game:GetService("HttpService")
local Camera = workspace.CurrentCamera
local Player = Players.LocalPlayer

-- [ВСЕ НАСТРОЙКИ]
local Settings = {
    -- Aimbot
    Enabled = false, FOV = 150, HitPart = "Head", ShotDelay = 0.01,
    WallCheck = false, TeamCheck = false, Smoothing = false, SmoothFactor = 5,
    Prediction = false, PredictionAmount = 0.13, SilentAim = true,
    AutoFire = false, TriggerBot = false, TriggerDelay = 0.05,

    -- Hitbox
    HitboxSink = false, HitboxSinkDepth = 15, HitboxDesync = false, HitboxDesyncOffset = 10,

    -- Target visuals
    TargetESP = false, TargetTracer = false, TargetColor = Color3.fromRGB(255, 0, 0),
    ShowFOV = true, FOVColor = Color3.fromRGB(255, 255, 255),

    -- Player Visuals
    ChamsEnabled = false, GlowEnabled = false, RainbowGlow = false,
    ChamColor = Color3.fromRGB(255, 0, 0), GlowColor = Color3.fromRGB(255, 255, 255),
    ChamTransparency = 0.5,

    -- ESP Drawing
    Boxes = false, BoxColor = Color3.fromRGB(255, 255, 255),
    Names = false, NameColor = Color3.fromRGB(255, 255, 255),
    Distance = false, DistanceColor = Color3.fromRGB(200, 200, 200),
    Tracers = false, TracerColor = Color3.fromRGB(255, 255, 255),
    HealthBar = false, HealthBarColor = Color3.fromRGB(0, 255, 0),
    SkeletonESP = false, SkeletonColor = Color3.fromRGB(255, 255, 255),

    -- Hands
    HandsEnabled = false, HandGlow = false, HandColor = Color3.fromRGB(0, 255, 255),

    -- Crosshair
    CrosshairEnabled = false, CrosshairColor = Color3.fromRGB(0, 255, 0),
    CrosshairSize = 10, CrosshairThickness = 1, CrosshairGap = 4,
    DotEnabled = false,

    -- World
    Fullbright = false, NoFog = false, CustomTime = false, TimeValue = 14,
    AmbientColor = Color3.fromRGB(178, 178, 178),

    -- Particles
    SparklesEnabled = false, SparkleColor = Color3.fromRGB(255, 255, 100),
    FireEnabled = false, FireSize = 5, FireColor = Color3.fromRGB(255, 80, 20),
    SmokeEnabled = false, SmokeOpacity = 0.3, SmokeColor = Color3.fromRGB(100, 100, 100),
    ParticlesEnabled = false, ParticleTexture = "rbxassetid://241685484",
    ParticleColor = Color3.fromRGB(170, 85, 255), ParticleRate = 30, ParticleSpeed = 3,
    ParticleSize = 0.5, RainbowParticles = false,
    TrailEnabled = false, TrailColor = Color3.fromRGB(0, 200, 255), TrailLifetime = 0.5,
    AuraEnabled = false, AuraColor = Color3.fromRGB(85, 170, 255),

    -- Movement
    SpeedEnabled = false, SpeedValue = 32,
    FlyEnabled = false, FlySpeed = 50,
    NoclipEnabled = false, InfJumpEnabled = false,
    JumpPower = false, JumpValue = 50,

    -- HUD
    HUDEnabled = true, HUDWatermark = true,
    HUDHealth = true, HUDSpeed = true, HUDCoords = true,
    HUDTarget = true, HUDPlayers = true, HUDFPS = true,
    HUDColor = Color3.fromRGB(170, 85, 255),

    -- Misc
    AntiAFK = true, ClickTP = false, Notifications = true,

    -- Hit Marker
    HitMarker = false, HitMarkerColor = Color3.fromRGB(255, 50, 50),
    HitMarkerSize = 8, HitMarkerDuration = 0.2, HitMarkerThickness = 1.5,

    -- Off-Screen Arrows
    ArrowsEnabled = false, ArrowColor = Color3.fromRGB(255, 255, 255),
    ArrowSize = 20, ArrowRadius = 120,

    -- Radar
    RadarEnabled = false, RadarSize = 150, RadarScale = 0.05,
    RadarBGColor = Color3.fromRGB(15, 15, 20),
    RadarDotColor = Color3.fromRGB(255, 50, 50),
    RadarSelfColor = Color3.fromRGB(0, 255, 100),

    -- Hit Chams (shot trace)
    -- Hit Chams 2D (shot trace on screen)
    HitChamsEnabled = false,
    HitChamsLineColor = Color3.fromRGB(255, 50, 50),
    HitChamsCircleColor = Color3.fromRGB(255, 150, 0),
    HitChamsDuration = 0.4, HitChamsThickness = 1.5,

    -- Hit Chams 3D (world space effects)
    HitChams3D = false,
    HitChams3DHighlight = true,   -- вспышка Highlight на персонаже
    HitChams3DBlood = true,        -- кровяные частицы на месте попадания
    HitChams3DBeam = true,         -- 3D луч от тебя до врага
    HitChams3DBillboard = true,    -- урон над головой (-HP)
    HitChams3DColor = Color3.fromRGB(255, 30, 30),
    HitChams3DDuration = 0.5,

    -- BunnyHop
    BHopEnabled = false,

    -- Panic Key
    PanicKey = Enum.KeyCode.Delete,

    -- Keybinds
    KeybindAimbot = Enum.KeyCode.Unknown,
    KeybindSpeed = Enum.KeyCode.Unknown,
    KeybindFly = Enum.KeyCode.Unknown,
    KeybindNoclip = Enum.KeyCode.Unknown,
    KeybindRadar = Enum.KeyCode.Unknown,
}

-- ══════════════════════════════════════════
--  СИСТЕМА КОНФИГОВ
-- ══════════════════════════════════════════
local ConfigSystem = {}
local CONFIG_FOLDER = "FlickSpeed"
local CONFIG_EXT = ".json"

-- Список ключей, которые НЕ сериализуются напрямую (Color3 → таблица)
local COLOR_KEYS = {
    "TargetColor", "FOVColor", "ChamColor", "GlowColor",
    "BoxColor", "NameColor", "DistanceColor", "TracerColor",
    "HealthBarColor", "SkeletonColor", "HandColor", "CrosshairColor",
    "AmbientColor", "SparkleColor", "FireColor", "SmokeColor",
    "ParticleColor", "TrailColor", "AuraColor", "HUDColor",
    "HitMarkerColor", "ArrowColor", "RadarBGColor", "RadarDotColor", "RadarSelfColor",
    "HitChamsLineColor", "HitChamsCircleColor", "HitChams3DColor",
}

local function IsColorKey(k)
    for _, v in pairs(COLOR_KEYS) do if v == k then return true end end
    return false
end

local function Color3ToTable(c)
    return {r = c.R, g = c.G, b = c.B}
end

local function TableToColor3(t)
    return Color3.new(t.r, t.g, t.b)
end

-- Создать папку если не существует
local function EnsureFolder()
    if not isfolder(CONFIG_FOLDER) then
        makefolder(CONFIG_FOLDER)
    end
end

-- Получить список конфигов
function ConfigSystem:GetList()
    EnsureFolder()
    local list = {}
    for _, f in pairs(listfiles(CONFIG_FOLDER)) do
        local name = f:match("([^/\\]+)" .. CONFIG_EXT .. "$")
        if name then
            table.insert(list, name)
        end
    end
    if #list == 0 then
        table.insert(list, "default")
    end
    return list
end

-- Сохранить конфиг
function ConfigSystem:Save(name)
    EnsureFolder()
    local data = {}
    for k, v in pairs(Settings) do
        if IsColorKey(k) then
            data[k] = Color3ToTable(v)
        else
            data[k] = v
        end
    end
    local encoded = HttpService:JSONEncode(data)
    writefile(CONFIG_FOLDER .. "/" .. name .. CONFIG_EXT, encoded)
    return true
end

-- Загрузить конфиг
function ConfigSystem:Load(name)
    EnsureFolder()
    local path = CONFIG_FOLDER .. "/" .. name .. CONFIG_EXT
    if not isfile(path) then
        warn("[FlickSpeed] Конфиг не найден: " .. name)
        return false
    end
    local ok, data = pcall(function()
        return HttpService:JSONDecode(readfile(path))
    end)
    if not ok or not data then
        warn("[FlickSpeed] Ошибка парсинга конфига: " .. name)
        return false
    end
    for k, v in pairs(data) do
        if Settings[k] ~= nil then
            if IsColorKey(k) and type(v) == "table" then
                Settings[k] = TableToColor3(v)
            else
                Settings[k] = v
            end
        end
    end
    return true
end

-- Удалить конфиг
function ConfigSystem:Delete(name)
    local path = CONFIG_FOLDER .. "/" .. name .. CONFIG_EXT
    if isfile(path) then
        delfile(path)
        return true
    end
    return false
end

-- Автосохранение при выходе (клиентский аналог BindToClose)
Player.AncestryChanged:Connect(function()
    if not Player:IsDescendantOf(game) then
        pcall(function() ConfigSystem:Save("autosave") end)
    end
end)

-- [СОХРАНЕНИЕ ОРИГИНАЛЬНЫХ ЗНАЧЕНИЙ]
local OriginalLighting = {
    Brightness = Lighting.Brightness,
    ClockTime = Lighting.ClockTime,
    FogEnd = Lighting.FogEnd,
    FogStart = Lighting.FogStart,
    GlobalShadows = Lighting.GlobalShadows,
    Ambient = Lighting.Ambient,
    OutdoorAmbient = Lighting.OutdoorAmbient,
}

-- ══════════════════════════════════════════
--  UI WINDOW
-- ══════════════════════════════════════════
local Window = Library:Window({
    Name = "FlickSpeed",
    SubName = "Private | v3.0",
    Logo = "120959262762131"
})

-- ══════════════════════════════════════════
--  PAGE 1: COMBAT
-- ══════════════════════════════════════════
local CombatPage = Window:Page({Name = "Combat"})

-- Silent Aim
local AimSec = CombatPage:Section({Name = "Silent Aim"})
AimSec:Toggle({Name = "Enable", Default = false, Callback = function(v) Settings.Enabled = v end})
AimSec:Toggle({Name = "Silent Aim Mode", Default = true, Callback = function(v) Settings.SilentAim = v end})
AimSec:Toggle({Name = "Wall Check", Default = false, Callback = function(v) Settings.WallCheck = v end})
AimSec:Toggle({Name = "Team Check", Default = false, Callback = function(v) Settings.TeamCheck = v end})
AimSec:Slider({Name = "FOV Radius", Min = 30, Max = 1000, Default = 150, Callback = function(v) Settings.FOV = v end})
AimSec:Dropdown({Name = "Hit Part", Default = "Head", Options = {"Head", "HumanoidRootPart", "UpperTorso", "LowerTorso"}, Callback = function(v) Settings.HitPart = v end})
AimSec:Slider({Name = "Shot Delay", Min = 0, Max = 0.3, Default = 0.01, Increment = 0.01, Callback = function(v) Settings.ShotDelay = v end})

-- Hitbox Manipulation
local HitboxSec = CombatPage:Section({Name = "Hitbox Sink (Anti-Aim)"})
HitboxSec:Toggle({Name = "Hitbox Sink", Default = false, Callback = function(v) Settings.HitboxSink = v
    if not v then
        pcall(function()
            local char = Player.Character
            if char then
                for _, part in pairs(char:GetDescendants()) do
                    if part:IsA("BasePart") and part.Name ~= "HumanoidRootPart" then
                        part.LocalTransparencyModifier = 0
                    end
                end
            end
        end)
    end
end})
HitboxSec:Slider({Name = "Sink Depth (studs)", Min = 5, Max = 50, Default = 15, Callback = function(v) Settings.HitboxSinkDepth = v end})
HitboxSec:Toggle({Name = "Hitbox Desync (Jitter)", Default = false, Callback = function(v) Settings.HitboxDesync = v end})
HitboxSec:Slider({Name = "Desync Offset", Min = 3, Max = 30, Default = 10, Callback = function(v) Settings.HitboxDesyncOffset = v end})

-- Smoothing
local SmoothSec = CombatPage:Section({Name = "Aim Assist (Legit)"})
SmoothSec:Toggle({Name = "Smoothing", Default = false, Callback = function(v) Settings.Smoothing = v end})
SmoothSec:Slider({Name = "Smooth Factor", Min = 1, Max = 20, Default = 5, Callback = function(v) Settings.SmoothFactor = v end})
SmoothSec:Toggle({Name = "Prediction", Default = false, Callback = function(v) Settings.Prediction = v end})
SmoothSec:Slider({Name = "Prediction Amount", Min = 0.05, Max = 0.5, Default = 0.13, Increment = 0.01, Callback = function(v) Settings.PredictionAmount = v end})

-- Triggerbot
local TriggerSec = CombatPage:Section({Name = "Triggerbot"})
TriggerSec:Toggle({Name = "Auto Fire", Default = false, Callback = function(v) Settings.AutoFire = v end})
TriggerSec:Toggle({Name = "Triggerbot", Default = false, Callback = function(v) Settings.TriggerBot = v end})
TriggerSec:Slider({Name = "Trigger Delay", Min = 0, Max = 0.3, Default = 0.05, Increment = 0.01, Callback = function(v) Settings.TriggerDelay = v end})

-- Target Visuals
local TargetVisSec = CombatPage:Section({Name = "Target Visuals"})
TargetVisSec:Toggle({Name = "Show FOV Circle", Default = true, Callback = function(v) Settings.ShowFOV = v end})
TargetVisSec:Label("FOV Color"):Colorpicker({Default = Settings.FOVColor, Callback = function(v) Settings.FOVColor = v end})
TargetVisSec:Toggle({Name = "Target ESP (Circle)", Default = false, Callback = function(v) Settings.TargetESP = v end})
TargetVisSec:Toggle({Name = "Target Tracer", Default = false, Callback = function(v) Settings.TargetTracer = v end})
TargetVisSec:Label("Target Color"):Colorpicker({Default = Settings.TargetColor, Callback = function(v) Settings.TargetColor = v end})

-- ══════════════════════════════════════════
--  PAGE 2: VISUALS
-- ══════════════════════════════════════════
local VisualPage = Window:Page({Name = "Visuals"})

local PlayerSec = VisualPage:Section({Name = "Player Chams"})
PlayerSec:Toggle({Name = "Chams", Callback = function(v) Settings.ChamsEnabled = v end})
PlayerSec:Slider({Name = "Fill Transparency", Min = 0, Max = 1, Default = 0.5, Increment = 0.1, Callback = function(v) Settings.ChamTransparency = v end})
PlayerSec:Label("Chams Color"):Colorpicker({Default = Settings.ChamColor, Callback = function(v) Settings.ChamColor = v end})
PlayerSec:Toggle({Name = "Glow (Outline)", Callback = function(v) Settings.GlowEnabled = v end})
PlayerSec:Toggle({Name = "Rainbow Glow", Callback = function(v) Settings.RainbowGlow = v end})
PlayerSec:Label("Glow Color"):Colorpicker({Default = Settings.GlowColor, Callback = function(v) Settings.GlowColor = v end})

local ESPSec = VisualPage:Section({Name = "ESP (Drawing)"})
ESPSec:Toggle({Name = "Boxes", Callback = function(v) Settings.Boxes = v end})
ESPSec:Label("Box Color"):Colorpicker({Default = Settings.BoxColor, Callback = function(v) Settings.BoxColor = v end})
ESPSec:Toggle({Name = "Names", Callback = function(v) Settings.Names = v end})
ESPSec:Label("Name Color"):Colorpicker({Default = Settings.NameColor, Callback = function(v) Settings.NameColor = v end})
ESPSec:Toggle({Name = "Distance", Callback = function(v) Settings.Distance = v end})
ESPSec:Label("Distance Color"):Colorpicker({Default = Settings.DistanceColor, Callback = function(v) Settings.DistanceColor = v end})
ESPSec:Toggle({Name = "Tracers", Callback = function(v) Settings.Tracers = v end})
ESPSec:Label("Tracer Color"):Colorpicker({Default = Settings.TracerColor, Callback = function(v) Settings.TracerColor = v end})
ESPSec:Toggle({Name = "Health Bar", Callback = function(v) Settings.HealthBar = v end})
ESPSec:Toggle({Name = "Skeleton ESP", Callback = function(v) Settings.SkeletonESP = v end})
ESPSec:Label("Skeleton Color"):Colorpicker({Default = Settings.SkeletonColor, Callback = function(v) Settings.SkeletonColor = v end})

local HandSec = VisualPage:Section({Name = "Hands"})
HandSec:Toggle({Name = "Hand Chams", Callback = function(v) Settings.HandsEnabled = v end})
HandSec:Toggle({Name = "Hand Glow (ForceField)", Callback = function(v) Settings.HandGlow = v end})
HandSec:Label("Hand Color"):Colorpicker({Default = Settings.HandColor, Callback = function(v) Settings.HandColor = v end})

-- Crosshair
local CrossSec = VisualPage:Section({Name = "Crosshair"})
CrossSec:Toggle({Name = "Custom Crosshair", Callback = function(v) Settings.CrosshairEnabled = v end})
CrossSec:Toggle({Name = "Center Dot", Callback = function(v) Settings.DotEnabled = v end})
CrossSec:Label("Crosshair Color"):Colorpicker({Default = Settings.CrosshairColor, Callback = function(v) Settings.CrosshairColor = v end})
CrossSec:Slider({Name = "Size", Min = 4, Max = 30, Default = 10, Callback = function(v) Settings.CrosshairSize = v end})
CrossSec:Slider({Name = "Gap", Min = 0, Max = 15, Default = 4, Callback = function(v) Settings.CrosshairGap = v end})
CrossSec:Slider({Name = "Thickness", Min = 1, Max = 4, Default = 1, Callback = function(v) Settings.CrosshairThickness = v end})

-- Hit Marker
local HitSec = VisualPage:Section({Name = "Hit Marker"})
HitSec:Toggle({Name = "Hit Marker", Callback = function(v) Settings.HitMarker = v end})
HitSec:Slider({Name = "Size", Min = 4, Max = 20, Default = 8, Callback = function(v) Settings.HitMarkerSize = v end})
HitSec:Slider({Name = "Thickness", Min = 1, Max = 4, Default = 1, Increment = 0.5, Callback = function(v) Settings.HitMarkerThickness = v end})
HitSec:Slider({Name = "Duration", Min = 0.05, Max = 1, Default = 0.2, Increment = 0.05, Callback = function(v) Settings.HitMarkerDuration = v end})
HitSec:Label("Hit Marker Color"):Colorpicker({Default = Settings.HitMarkerColor, Callback = function(v) Settings.HitMarkerColor = v end})

-- Hit Chams
local HitChamsSec = VisualPage:Section({Name = "Hit Chams (Shot Trace)"})
HitChamsSec:Toggle({Name = "Hit Chams", Callback = function(v) Settings.HitChamsEnabled = v end})
HitChamsSec:Slider({Name = "Duration", Min = 0.1, Max = 2, Default = 0.4, Increment = 0.1, Callback = function(v) Settings.HitChamsDuration = v end})
HitChamsSec:Slider({Name = "Line Thickness", Min = 1, Max = 5, Default = 1, Increment = 0.5, Callback = function(v) Settings.HitChamsThickness = v end})
HitChamsSec:Label("Line Color"):Colorpicker({Default = Settings.HitChamsLineColor, Callback = function(v) Settings.HitChamsLineColor = v end})
HitChamsSec:Label("Circle Color"):Colorpicker({Default = Settings.HitChamsCircleColor, Callback = function(v) Settings.HitChamsCircleColor = v end})

-- 3D Hit Chams
local HitChams3DSec = VisualPage:Section({Name = "Hit Chams 3D (World)"})
HitChams3DSec:Toggle({Name = "Enable 3D Hit Chams", Callback = function(v) Settings.HitChams3D = v end})
HitChams3DSec:Toggle({Name = "Highlight Flash (вспышка)", Default = true, Callback = function(v) Settings.HitChams3DHighlight = v end})
HitChams3DSec:Toggle({Name = "Blood Particles (кровь)", Default = true, Callback = function(v) Settings.HitChams3DBlood = v end})
HitChams3DSec:Toggle({Name = "3D Beam (луч в мире)", Default = true, Callback = function(v) Settings.HitChams3DBeam = v end})
HitChams3DSec:Toggle({Name = "Damage Billboard (-HP)", Default = true, Callback = function(v) Settings.HitChams3DBillboard = v end})
HitChams3DSec:Slider({Name = "Duration", Min = 0.1, Max = 2, Default = 0.5, Increment = 0.1, Callback = function(v) Settings.HitChams3DDuration = v end})
HitChams3DSec:Label("Effect Color"):Colorpicker({Default = Settings.HitChams3DColor, Callback = function(v) Settings.HitChams3DColor = v end})

-- Off-Screen Arrows
local ArrowSec = VisualPage:Section({Name = "Off-Screen Arrows"})
ArrowSec:Toggle({Name = "Arrows", Callback = function(v) Settings.ArrowsEnabled = v end})
ArrowSec:Slider({Name = "Arrow Size", Min = 8, Max = 40, Default = 20, Callback = function(v) Settings.ArrowSize = v end})
ArrowSec:Slider({Name = "Radius from Center", Min = 60, Max = 250, Default = 120, Callback = function(v) Settings.ArrowRadius = v end})
ArrowSec:Label("Arrow Color"):Colorpicker({Default = Settings.ArrowColor, Callback = function(v) Settings.ArrowColor = v end})

-- Radar
local RadarSec = VisualPage:Section({Name = "Radar"})
RadarSec:Toggle({Name = "Radar", Callback = function(v) Settings.RadarEnabled = v end})
RadarSec:Slider({Name = "Radar Size", Min = 80, Max = 300, Default = 150, Callback = function(v) Settings.RadarSize = v end})
RadarSec:Slider({Name = "Radar Scale", Min = 0.01, Max = 0.15, Default = 0.05, Increment = 0.01, Callback = function(v) Settings.RadarScale = v end})
RadarSec:Label("Background Color"):Colorpicker({Default = Settings.RadarBGColor, Callback = function(v) Settings.RadarBGColor = v end})
RadarSec:Label("Enemy Dot Color"):Colorpicker({Default = Settings.RadarDotColor, Callback = function(v) Settings.RadarDotColor = v end})
RadarSec:Label("Self Dot Color"):Colorpicker({Default = Settings.RadarSelfColor, Callback = function(v) Settings.RadarSelfColor = v end})

-- ══════════════════════════════════════════
--  PAGE 3: WORLD
-- ══════════════════════════════════════════
local WorldPage = Window:Page({Name = "World"})

local LightSec = WorldPage:Section({Name = "Lighting"})
LightSec:Toggle({Name = "Fullbright", Callback = function(v)
    Settings.Fullbright = v
    if not v then
        Lighting.Brightness = OriginalLighting.Brightness
        Lighting.ClockTime = OriginalLighting.ClockTime
        Lighting.GlobalShadows = OriginalLighting.GlobalShadows
        Lighting.Ambient = OriginalLighting.Ambient
    end
end})
LightSec:Toggle({Name = "No Fog", Callback = function(v)
    Settings.NoFog = v
    if not v then
        Lighting.FogEnd = OriginalLighting.FogEnd
        Lighting.FogStart = OriginalLighting.FogStart
    end
end})
LightSec:Toggle({Name = "Custom Time", Callback = function(v) Settings.CustomTime = v if not v then Lighting.ClockTime = OriginalLighting.ClockTime end end})
LightSec:Slider({Name = "Time of Day", Min = 0, Max = 24, Default = 14, Increment = 0.5, Callback = function(v) Settings.TimeValue = v end})
LightSec:Label("Ambient Color"):Colorpicker({Default = Settings.AmbientColor, Callback = function(v) Settings.AmbientColor = v end})

-- ── PARTICLES ──
local PartSec = WorldPage:Section({Name = "Character Particles"})
PartSec:Toggle({Name = "Sparkles", Callback = function(v) Settings.SparklesEnabled = v
    if not v then pcall(function() for _,obj in pairs(Player.Character:GetChildren()) do if obj.Name == "FlickSparkle" then obj:Destroy() end end end) end
end})
PartSec:Label("Sparkle Color"):Colorpicker({Default = Settings.SparkleColor, Callback = function(v) Settings.SparkleColor = v end})

PartSec:Toggle({Name = "Fire", Callback = function(v) Settings.FireEnabled = v
    if not v then pcall(function() for _,obj in pairs(Player.Character:GetChildren()) do if obj.Name == "FlickFire" then obj:Destroy() end end end) end
end})
PartSec:Slider({Name = "Fire Size", Min = 1, Max = 20, Default = 5, Callback = function(v) Settings.FireSize = v end})
PartSec:Label("Fire Color"):Colorpicker({Default = Settings.FireColor, Callback = function(v) Settings.FireColor = v end})

PartSec:Toggle({Name = "Smoke", Callback = function(v) Settings.SmokeEnabled = v
    if not v then pcall(function() for _,obj in pairs(Player.Character:GetChildren()) do if obj.Name == "FlickSmoke" then obj:Destroy() end end end) end
end})
PartSec:Slider({Name = "Smoke Opacity", Min = 0.1, Max = 1, Default = 0.3, Increment = 0.1, Callback = function(v) Settings.SmokeOpacity = v end})
PartSec:Label("Smoke Color"):Colorpicker({Default = Settings.SmokeColor, Callback = function(v) Settings.SmokeColor = v end})

local PartSec2 = WorldPage:Section({Name = "Advanced Particles"})
PartSec2:Toggle({Name = "Particle Emitter", Callback = function(v) Settings.ParticlesEnabled = v
    if not v then pcall(function() for _,obj in pairs(Player.Character:GetDescendants()) do if obj.Name == "FlickParticle" then obj:Destroy() end end end) end
end})
PartSec2:Toggle({Name = "Rainbow Particles", Callback = function(v) Settings.RainbowParticles = v end})
PartSec2:Slider({Name = "Rate", Min = 5, Max = 100, Default = 30, Callback = function(v) Settings.ParticleRate = v end})
PartSec2:Slider({Name = "Speed", Min = 1, Max = 20, Default = 3, Callback = function(v) Settings.ParticleSpeed = v end})
PartSec2:Slider({Name = "Size", Min = 0.2, Max = 3, Default = 0.5, Increment = 0.1, Callback = function(v) Settings.ParticleSize = v end})
PartSec2:Label("Particle Color"):Colorpicker({Default = Settings.ParticleColor, Callback = function(v) Settings.ParticleColor = v end})

PartSec2:Toggle({Name = "Character Trail", Callback = function(v) Settings.TrailEnabled = v
    if not v then pcall(function() for _,obj in pairs(Player.Character:GetDescendants()) do if obj.Name == "FlickTrail" or obj.Name == "FlickTrailA" then obj:Destroy() end end end) end
end})
PartSec2:Slider({Name = "Trail Lifetime", Min = 0.1, Max = 3, Default = 0.5, Increment = 0.1, Callback = function(v) Settings.TrailLifetime = v end})
PartSec2:Label("Trail Color"):Colorpicker({Default = Settings.TrailColor, Callback = function(v) Settings.TrailColor = v end})

PartSec2:Toggle({Name = "Aura Effect", Callback = function(v) Settings.AuraEnabled = v
    if not v then pcall(function() for _,obj in pairs(Player.Character:GetDescendants()) do if obj.Name == "FlickAura" then obj:Destroy() end end end) end
end})
PartSec2:Label("Aura Color"):Colorpicker({Default = Settings.AuraColor, Callback = function(v) Settings.AuraColor = v end})

-- ══════════════════════════════════════════
--  PAGE 4: MOVEMENT
-- ══════════════════════════════════════════
local MovePage = Window:Page({Name = "Movement"})

local SpeedSec = MovePage:Section({Name = "Speed"})
SpeedSec:Toggle({Name = "Speed Hack", Callback = function(v) Settings.SpeedEnabled = v
    if not v then pcall(function() local h = Player.Character and Player.Character:FindFirstChildOfClass("Humanoid") if h then h.WalkSpeed = 16 end end) end
end})
SpeedSec:Slider({Name = "Walk Speed", Min = 16, Max = 200, Default = 32, Callback = function(v) Settings.SpeedValue = v end})

local JumpSec = MovePage:Section({Name = "Jump"})
JumpSec:Toggle({Name = "Custom Jump Power", Callback = function(v) Settings.JumpPower = v
    if not v then pcall(function() local h = Player.Character and Player.Character:FindFirstChildOfClass("Humanoid") if h then h.JumpPower = 50 end end) end
end})
JumpSec:Slider({Name = "Jump Power", Min = 50, Max = 300, Default = 50, Callback = function(v) Settings.JumpValue = v end})
JumpSec:Toggle({Name = "Infinite Jump", Callback = function(v) Settings.InfJumpEnabled = v end})

local FlySec = MovePage:Section({Name = "Fly & Noclip"})
FlySec:Toggle({Name = "Fly (Space + WASD)", Callback = function(v) Settings.FlyEnabled = v
    if not v then pcall(function() local hrp = Player.Character:FindFirstChild("HumanoidRootPart")
        for _, obj in pairs(hrp:GetChildren()) do if obj.Name == "FlickBP" or obj.Name == "FlickBG" then obj:Destroy() end end
    end) end
end})
FlySec:Slider({Name = "Fly Speed", Min = 10, Max = 200, Default = 50, Callback = function(v) Settings.FlySpeed = v end})
FlySec:Toggle({Name = "Noclip", Callback = function(v) Settings.NoclipEnabled = v end})

local BHopSec = MovePage:Section({Name = "BunnyHop"})
BHopSec:Toggle({Name = "BunnyHop (Space)", Callback = function(v) Settings.BHopEnabled = v end})

-- ══════════════════════════════════════════
--  PAGE 5: MISC
-- ══════════════════════════════════════════
local MiscPage = Window:Page({Name = "Misc"})

local UtilSec = MiscPage:Section({Name = "Utility"})
UtilSec:Toggle({Name = "Anti-AFK", Default = true, Callback = function(v) Settings.AntiAFK = v end})
UtilSec:Toggle({Name = "Click TP (Ctrl+Click)", Callback = function(v) Settings.ClickTP = v end})
UtilSec:Button({Name = "Rejoin Server", Callback = function() pcall(function() TeleportService:Teleport(game.PlaceId, Player) end) end})
UtilSec:Button({Name = "Server Hop", Callback = function()
    pcall(function()
        local data = HttpService:JSONDecode(game:HttpGet("https://games.roblox.com/v1/games/"..game.PlaceId.."/servers/Public?sortOrder=Asc&limit=100"))
        for _, s in pairs(data.data) do
            if s.id ~= game.JobId then TeleportService:TeleportToPlaceInstance(game.PlaceId, s.id, Player) break end
        end
    end)
end})
UtilSec:Button({Name = "Copy Place ID", Callback = function() pcall(function() setclipboard(tostring(game.PlaceId)) end) end})
UtilSec:Button({Name = "Reset Character", Callback = function() pcall(function() Player.Character:FindFirstChildOfClass("Humanoid").Health = 0 end) end})

-- ── HUD ──
local HUDSec = MiscPage:Section({Name = "HUD (On-Screen)"})
HUDSec:Toggle({Name = "Enable HUD", Default = true, Callback = function(v) Settings.HUDEnabled = v end})
HUDSec:Toggle({Name = "Watermark", Default = true, Callback = function(v) Settings.HUDWatermark = v end})
HUDSec:Toggle({Name = "FPS Counter", Default = true, Callback = function(v) Settings.HUDFPS = v end})
HUDSec:Toggle({Name = "Health Bar", Default = true, Callback = function(v) Settings.HUDHealth = v end})
HUDSec:Toggle({Name = "Speed Display", Default = true, Callback = function(v) Settings.HUDSpeed = v end})
HUDSec:Toggle({Name = "Coordinates", Default = true, Callback = function(v) Settings.HUDCoords = v end})
HUDSec:Toggle({Name = "Target Info", Default = true, Callback = function(v) Settings.HUDTarget = v end})
HUDSec:Toggle({Name = "Player Count", Default = true, Callback = function(v) Settings.HUDPlayers = v end})
HUDSec:Label("HUD Accent Color"):Colorpicker({Default = Settings.HUDColor, Callback = function(v) Settings.HUDColor = v end})

local KeybindSec = MiscPage:Section({Name = "Keybinds"})
KeybindSec:Label("Нажми кнопку и потом назначь клавишу")
KeybindSec:Keybind({Name = "Toggle Aimbot", Default = Enum.KeyCode.Unknown, Callback = function(v) Settings.KeybindAimbot = v end})
KeybindSec:Keybind({Name = "Toggle Speed", Default = Enum.KeyCode.Unknown, Callback = function(v) Settings.KeybindSpeed = v end})
KeybindSec:Keybind({Name = "Toggle Fly", Default = Enum.KeyCode.Unknown, Callback = function(v) Settings.KeybindFly = v end})
KeybindSec:Keybind({Name = "Toggle Noclip", Default = Enum.KeyCode.Unknown, Callback = function(v) Settings.KeybindNoclip = v end})
KeybindSec:Keybind({Name = "Toggle Radar", Default = Enum.KeyCode.Unknown, Callback = function(v) Settings.KeybindRadar = v end})
KeybindSec:Keybind({Name = "Panic Key (выкл всё)", Default = Enum.KeyCode.Delete, Callback = function(v) Settings.PanicKey = v end})

local InfoSec = MiscPage:Section({Name = "Info"})
InfoSec:Label("Player: " .. Player.DisplayName .. " (@" .. Player.Name .. ")")
InfoSec:Label("UserID: " .. Player.UserId)
InfoSec:Label("PlaceID: " .. game.PlaceId)
InfoSec:Label("Executor: Velocity 0.8.0")
InfoSec:Label("Script: FlickSpeed v3.5")

-- ══════════════════════════════════════════
--  PAGE 6: CONFIGS
-- ══════════════════════════════════════════
local ConfigPage = Window:Page({Name = "Configs"})

-- Переменная для хранения текущего выбранного конфига
local selectedConfig = "default"

-- ── Менеджер конфигов ──
local CfgSec = ConfigPage:Section({Name = "Config Manager"})

-- Поле для ввода имени конфига (через Label + кнопки)
-- Дропдаун со списком конфигов
local configDropdown
local function RefreshDropdown()
    local list = ConfigSystem:GetList()
    if configDropdown then
        configDropdown:Refresh(list, true)
    end
end

configDropdown = CfgSec:Dropdown({
    Name = "Select Config",
    Default = selectedConfig,
    Options = ConfigSystem:GetList(),
    Callback = function(v)
        selectedConfig = v
    end
})

-- Текстбокс для имени нового конфига
local newConfigName = "myconfig"
CfgSec:Textbox({
    Name = "Config Name",
    Default = "myconfig",
    Placeholder = "Введи имя конфига...",
    Callback = function(v)
        if v and v ~= "" then
            newConfigName = v
        end
    end
})

-- ── Сохранение / Загрузка / Удаление ──
local CfgBtnSec = ConfigPage:Section({Name = "Actions"})

CfgBtnSec:Button({Name = "💾  Save Config", Callback = function()
    local name = newConfigName ~= "" and newConfigName or selectedConfig
    local ok = pcall(function() ConfigSystem:Save(name) end)
    if ok then
        RefreshDropdown()
        -- Уведомление
        if Settings.Notifications then
            game:GetService("StarterGui"):SetCore("SendNotification", {
                Title = "FlickSpeed",
                Text = "Конфиг сохранён: " .. name,
                Duration = 3,
            })
        end
        print("[FlickSpeed] Конфиг сохранён: " .. name)
    else
        warn("[FlickSpeed] Ошибка сохранения конфига!")
    end
end})

CfgBtnSec:Button({Name = "📂  Load Config", Callback = function()
    local ok = pcall(function() ConfigSystem:Load(selectedConfig) end)
    if ok then
        if Settings.Notifications then
            game:GetService("StarterGui"):SetCore("SendNotification", {
                Title = "FlickSpeed",
                Text = "Конфиг загружен: " .. selectedConfig,
                Duration = 3,
            })
        end
        print("[FlickSpeed] Конфиг загружен: " .. selectedConfig)
    else
        warn("[FlickSpeed] Ошибка загрузки конфига: " .. selectedConfig)
    end
end})

CfgBtnSec:Button({Name = "🗑️  Delete Config", Callback = function()
    if selectedConfig == "default" or selectedConfig == "autosave" then
        warn("[FlickSpeed] Нельзя удалить системный конфиг!")
        return
    end
    local deleted = pcall(function() ConfigSystem:Delete(selectedConfig) end)
    if deleted then
        RefreshDropdown()
        if Settings.Notifications then
            game:GetService("StarterGui"):SetCore("SendNotification", {
                Title = "FlickSpeed",
                Text = "Конфиг удалён: " .. selectedConfig,
                Duration = 3,
            })
        end
        print("[FlickSpeed] Конфиг удалён: " .. selectedConfig)
    end
end})

CfgBtnSec:Button({Name = "🔄  Refresh List", Callback = function()
    RefreshDropdown()
    print("[FlickSpeed] Список конфигов обновлён.")
end})

-- ── Быстрые пресеты ──
local PresetSec = ConfigPage:Section({Name = "Quick Presets"})

-- Пресет: Rage (агрессивные настройки)
PresetSec:Button({Name = "🔴  Preset: Rage", Callback = function()
    Settings.Enabled = true
    Settings.SilentAim = true
    Settings.FOV = 500
    Settings.HitPart = "Head"
    Settings.ShotDelay = 0
    Settings.WallCheck = false
    Settings.TeamCheck = true
    Settings.Prediction = true
    Settings.PredictionAmount = 0.2
    Settings.Smoothing = false
    Settings.AutoFire = true
    Settings.TriggerBot = true
    Settings.TriggerDelay = 0
    Settings.HitboxSink = true
    Settings.HitboxSinkDepth = 25
    -- ESP
    Settings.Boxes = true
    Settings.Names = true
    Settings.Distance = true
    Settings.Tracers = true
    Settings.HealthBar = true
    Settings.ChamsEnabled = true
    Settings.GlowEnabled = true
    Settings.RainbowGlow = true
    -- HUD
    Settings.HUDEnabled = true
    if Settings.Notifications then
        game:GetService("StarterGui"):SetCore("SendNotification", {
            Title = "FlickSpeed",
            Text = "Пресет: Rage загружен!",
            Duration = 3,
        })
    end
    print("[FlickSpeed] Пресет Rage применён.")
end})

-- Пресет: Legit (легит настройки)
PresetSec:Button({Name = "🟢  Preset: Legit", Callback = function()
    Settings.Enabled = true
    Settings.SilentAim = false
    Settings.FOV = 80
    Settings.HitPart = "Head"
    Settings.ShotDelay = 0.05
    Settings.WallCheck = true
    Settings.TeamCheck = true
    Settings.Prediction = true
    Settings.PredictionAmount = 0.1
    Settings.Smoothing = true
    Settings.SmoothFactor = 8
    Settings.AutoFire = false
    Settings.TriggerBot = false
    Settings.HitboxSink = false
    Settings.HitboxDesync = false
    -- ESP (минимальное)
    Settings.Boxes = false
    Settings.Names = true
    Settings.Distance = true
    Settings.Tracers = false
    Settings.HealthBar = true
    Settings.ChamsEnabled = false
    Settings.GlowEnabled = false
    -- HUD
    Settings.HUDEnabled = true
    if Settings.Notifications then
        game:GetService("StarterGui"):SetCore("SendNotification", {
            Title = "FlickSpeed",
            Text = "Пресет: Legit загружен!",
            Duration = 3,
        })
    end
    print("[FlickSpeed] Пресет Legit применён.")
end})

-- Пресет: Visual Only (только визуалы)
PresetSec:Button({Name = "🟣  Preset: Visual", Callback = function()
    Settings.Enabled = false
    Settings.Boxes = true
    Settings.Names = true
    Settings.Distance = true
    Settings.Tracers = true
    Settings.HealthBar = true
    Settings.SkeletonESP = true
    Settings.ChamsEnabled = true
    Settings.GlowEnabled = true
    Settings.CrosshairEnabled = true
    Settings.HUDEnabled = true
    Settings.Fullbright = true
    if Settings.Notifications then
        game:GetService("StarterGui"):SetCore("SendNotification", {
            Title = "FlickSpeed",
            Text = "Пресет: Visual загружен!",
            Duration = 3,
        })
    end
    print("[FlickSpeed] Пресет Visual применён.")
end})

-- Пресет: Reset (сброс всего)
PresetSec:Button({Name = "⚪  Reset All", Callback = function()
    Settings.Enabled = false
    Settings.SilentAim = true
    Settings.FOV = 150
    Settings.HitPart = "Head"
    Settings.ShotDelay = 0.01
    Settings.WallCheck = false
    Settings.TeamCheck = false
    Settings.Smoothing = false
    Settings.SmoothFactor = 5
    Settings.Prediction = false
    Settings.PredictionAmount = 0.13
    Settings.AutoFire = false
    Settings.TriggerBot = false
    Settings.TriggerDelay = 0.05
    Settings.HitboxSink = false
    Settings.HitboxSinkDepth = 15
    Settings.HitboxDesync = false
    Settings.HitboxDesyncOffset = 10
    Settings.Boxes = false
    Settings.Names = false
    Settings.Distance = false
    Settings.Tracers = false
    Settings.HealthBar = false
    Settings.SkeletonESP = false
    Settings.ChamsEnabled = false
    Settings.GlowEnabled = false
    Settings.RainbowGlow = false
    Settings.CrosshairEnabled = false
    Settings.ShowFOV = true
    Settings.Fullbright = false
    Settings.NoFog = false
    Settings.CustomTime = false
    Settings.SpeedEnabled = false
    Settings.FlyEnabled = false
    Settings.NoclipEnabled = false
    Settings.InfJumpEnabled = false
    Settings.JumpPower = false
    Settings.SparklesEnabled = false
    Settings.FireEnabled = false
    Settings.SmokeEnabled = false
    Settings.ParticlesEnabled = false
    Settings.TrailEnabled = false
    Settings.AuraEnabled = false
    Settings.ClickTP = false
    Settings.HUDEnabled = true
    -- Восстановить Lighting
    Lighting.Brightness = OriginalLighting.Brightness
    Lighting.ClockTime = OriginalLighting.ClockTime
    Lighting.FogEnd = OriginalLighting.FogEnd
    Lighting.FogStart = OriginalLighting.FogStart
    Lighting.GlobalShadows = OriginalLighting.GlobalShadows
    Lighting.Ambient = OriginalLighting.Ambient
    if Settings.Notifications then
        game:GetService("StarterGui"):SetCore("SendNotification", {
            Title = "FlickSpeed",
            Text = "Все настройки сброшены!",
            Duration = 3,
        })
    end
    print("[FlickSpeed] Настройки сброшены.")
end})

-- ── Автозагрузка при старте ──
local AutoloadSec = ConfigPage:Section({Name = "Autoload"})
AutoloadSec:Label("Автосохранение при выходе: ON")
AutoloadSec:Button({Name = "📥  Load Autosave", Callback = function()
    local ok = pcall(function() ConfigSystem:Load("autosave") end)
    if ok then
        print("[FlickSpeed] Автосохранение загружено.")
        if Settings.Notifications then
            game:GetService("StarterGui"):SetCore("SendNotification", {
                Title = "FlickSpeed",
                Text = "Автосохранение загружено!",
                Duration = 3,
            })
        end
    else
        warn("[FlickSpeed] Автосохранение не найдено.")
    end
end})

-- ══════════════════════════════════════════
--  DRAWING OBJECTS
-- ══════════════════════════════════════════
local FOVCircle = Drawing.new("Circle")
FOVCircle.Thickness = 1; FOVCircle.Filled = false; FOVCircle.NumSides = 64

local TargetLine = Drawing.new("Line")
TargetLine.Thickness = 1.5

local TargetCircle = Drawing.new("Circle")
TargetCircle.Thickness = 1.5; TargetCircle.Filled = false; TargetCircle.Radius = 15

-- Crosshair lines
local CrossLines = {}
for i = 1, 4 do
    CrossLines[i] = Drawing.new("Line")
    CrossLines[i].Thickness = 1; CrossLines[i].Visible = false
end
local CrossDot = Drawing.new("Circle")
CrossDot.Filled = true; CrossDot.Radius = 2; CrossDot.Visible = false

-- Hit Marker drawings (4 lines)
local HitMarkerLines = {}
for i = 1, 4 do
    HitMarkerLines[i] = Drawing.new("Line")
    HitMarkerLines[i].Thickness = 1.5
    HitMarkerLines[i].Visible = false
end
local hitMarkerTimer = 0
local hitMarkerActive = false

-- Off-Screen Arrow pool (max 20 players)
local ArrowPool = {}
for i = 1, 20 do
    ArrowPool[i] = {
        tri = Drawing.new("Triangle"),
    }
    ArrowPool[i].tri.Filled = true
    ArrowPool[i].tri.Visible = false
end

-- Radar drawings
local RadarBG = Drawing.new("Square")
RadarBG.Filled = true; RadarBG.Transparency = 0.4; RadarBG.Visible = false
local RadarBorder = Drawing.new("Square")
RadarBorder.Filled = false; RadarBorder.Thickness = 1.5; RadarBorder.Visible = false
local RadarSelfDot = Drawing.new("Circle")
RadarSelfDot.Filled = true; RadarSelfDot.Radius = 4; RadarSelfDot.Visible = false
local RadarLabel = Drawing.new("Text")
RadarLabel.Size = 12; RadarLabel.Text = "RADAR"; RadarLabel.Outline = true; RadarLabel.Visible = false
-- Radar enemy dots pool
local RadarDots = {}
for i = 1, 20 do
    RadarDots[i] = Drawing.new("Circle")
    RadarDots[i].Filled = true; RadarDots[i].Radius = 3; RadarDots[i].Visible = false
end

-- ESP Cache
local ESPCache = {}
local CurrentTarget = nil
local Connections = {}

local function GetESP(plr)
    if not ESPCache[plr] then
        local e = {
            Box = Drawing.new("Square"),
            BoxOutline = Drawing.new("Square"),
            Name = Drawing.new("Text"),
            Distance = Drawing.new("Text"),
            Tracer = Drawing.new("Line"),
            HealthBarBG = Drawing.new("Square"),
            HealthBar = Drawing.new("Square"),
            Skeleton = {},
        }
        e.Box.Thickness = 1; e.Box.Filled = false
        e.BoxOutline.Thickness = 3; e.BoxOutline.Filled = false; e.BoxOutline.Color = Color3.new(0, 0, 0)
        e.Name.Center = true; e.Name.Size = 14; e.Name.Outline = true
        e.Distance.Center = true; e.Distance.Size = 13; e.Distance.Outline = true
        e.Tracer.Thickness = 1
        e.HealthBarBG.Filled = true; e.HealthBarBG.Color = Color3.new(0, 0, 0)
        e.HealthBar.Filled = true
        for i = 1, 5 do e.Skeleton[i] = Drawing.new("Line"); e.Skeleton[i].Thickness = 1.5 end
        ESPCache[plr] = e
    end
    return ESPCache[plr]
end

Players.PlayerRemoving:Connect(function(plr)
    if ESPCache[plr] then
        for _, v in pairs(ESPCache[plr]) do
            if type(v) == "table" then
                for _, line in pairs(v) do pcall(function() line:Remove() end) end
            else pcall(function() v:Remove() end) end
        end
        ESPCache[plr] = nil
    end
end)

-- ══════════════════════════════════════════
--  CORE FUNCTIONS
-- ══════════════════════════════════════════
local function IsVisible(targetPart)
    if not Settings.WallCheck then return true end
    local params = RaycastParams.new()
    params.FilterDescendantsInstances = {Camera, Player.Character}
    params.FilterType = Enum.RaycastFilterType.Exclude
    params.IgnoreWater = true
    local cast = workspace:Raycast(Camera.CFrame.Position, targetPart.Position - Camera.CFrame.Position, params)
    if cast and cast.Instance then return cast.Instance:IsDescendantOf(targetPart.Parent) end
    return true
end

local function IsEnemy(plr)
    if not Settings.TeamCheck then return true end
    return plr.Team ~= Player.Team
end

local function UpdateTarget()
    local target, dist = nil, Settings.FOV
    local mouse = UIS:GetMouseLocation()
    for _, p in pairs(Players:GetPlayers()) do
        if p ~= Player and p.Character and IsEnemy(p) then
            local part = p.Character:FindFirstChild(Settings.HitPart)
            local hum = p.Character:FindFirstChildOfClass("Humanoid")
            if part and hum and hum.Health > 0 then
                local pos, vis = Camera:WorldToViewportPoint(part.Position)
                if vis then
                    local mDist = (Vector2.new(pos.X, pos.Y) - mouse).Magnitude
                    if mDist < dist and IsVisible(part) then
                        dist = mDist; target = part
                    end
                end
            end
        end
    end
    return target
end

-- ══════════════════════════════════════════
--  AIMBOT INPUT
-- ══════════════════════════════════════════
UIS.InputBegan:Connect(function(input, proc)
    if proc or not Settings.Enabled then return end
    if input.UserInputType == Enum.UserInputType.MouseButton1 and Settings.SilentAim then
        if CurrentTarget then
            local targetPos = CurrentTarget.Position
            if Settings.Prediction then
                local vel = CurrentTarget.AssemblyLinearVelocity or CurrentTarget.Velocity or Vector3.new()
                targetPos = targetPos + vel * Settings.PredictionAmount
            end
            local oldCF = Camera.CFrame
            Camera.CFrame = CFrame.new(Camera.CFrame.Position, targetPos)
            task.wait(Settings.ShotDelay)
            Camera.CFrame = oldCF
        end
    end
    if Settings.ClickTP and input.UserInputType == Enum.UserInputType.MouseButton1 and UIS:IsKeyDown(Enum.KeyCode.LeftControl) then
        pcall(function()
            local mouse = Player:GetMouse()
            if mouse.Target then
                Player.Character.HumanoidRootPart.CFrame = CFrame.new(mouse.Hit.Position + Vector3.new(0, 3, 0))
            end
        end)
    end
end)

UIS.JumpRequest:Connect(function()
    if Settings.InfJumpEnabled then
        pcall(function() Player.Character:FindFirstChildOfClass("Humanoid"):ChangeState(Enum.HumanoidStateType.Jumping) end)
    end
end)

Player.Idled:Connect(function()
    if Settings.AntiAFK then
        pcall(function()
            local VU = game:GetService("VirtualUser")
            VU:Button2Down(Vector2.new(), workspace.CurrentCamera.CFrame)
            task.wait(1)
            VU:Button2Up(Vector2.new(), workspace.CurrentCamera.CFrame)
        end)
    end
end)

-- ══════════════════════════════════════════
--  MAIN RENDER LOOP
-- ══════════════════════════════════════════
RunService.RenderStepped:Connect(function()
    Camera = workspace.CurrentCamera
    CurrentTarget = UpdateTarget()
    local RGB = Color3.fromHSV(tick() % 5 / 5, 1, 1)
    local VP = Camera.ViewportSize
    local center = Vector2.new(VP.X / 2, VP.Y / 2)
    local mousePos = UIS:GetMouseLocation()

    FOVCircle.Visible = Settings.Enabled and Settings.ShowFOV
    FOVCircle.Radius = Settings.FOV
    FOVCircle.Position = mousePos
    FOVCircle.Color = Settings.FOVColor

    if CurrentTarget and Settings.Enabled then
        local pos, vis = Camera:WorldToViewportPoint(CurrentTarget.Position)
        if vis then
            local tPos = Vector2.new(pos.X, pos.Y)
            TargetLine.Visible = Settings.TargetTracer
            TargetLine.From = center
            TargetLine.To = tPos
            TargetLine.Color = Settings.TargetColor
            TargetCircle.Visible = Settings.TargetESP
            TargetCircle.Position = tPos
            TargetCircle.Color = Settings.TargetColor
        else TargetLine.Visible = false; TargetCircle.Visible = false end
    else TargetLine.Visible = false; TargetCircle.Visible = false end

    if Settings.Smoothing and Settings.Enabled and CurrentTarget then
        local targetPos = CurrentTarget.Position
        if Settings.Prediction then
            local vel = CurrentTarget.AssemblyLinearVelocity or CurrentTarget.Velocity or Vector3.new()
            targetPos = targetPos + vel * Settings.PredictionAmount
        end
        local targetCF = CFrame.new(Camera.CFrame.Position, targetPos)
        Camera.CFrame = Camera.CFrame:Lerp(targetCF, 1 / Settings.SmoothFactor)
    end

    if Settings.AutoFire and Settings.Enabled and CurrentTarget then
        task.spawn(function()
            pcall(function()
                local pos, vis = Camera:WorldToViewportPoint(CurrentTarget.Position)
                if vis and (Vector2.new(pos.X, pos.Y) - mousePos).Magnitude < 15 then
                    task.wait(Settings.TriggerDelay)
                    mouse1click()
                end
            end)
        end)
    end

    -- HITBOX SINK
    pcall(function()
        local char = Player.Character
        if not char then return end
        local hrp = char:FindFirstChild("HumanoidRootPart")
        local hum = char:FindFirstChildOfClass("Humanoid")
        if not hrp or not hum then return end

        if Settings.HitboxSink then
            local depth = Settings.HitboxSinkDepth
            if not hrp:FindFirstChild("FlickSinkAnchor") then
                local marker = Instance.new("NumberValue")
                marker.Name = "FlickSinkAnchor"
                marker.Value = hum.HipHeight
                marker.Parent = hrp
                for _, motor in pairs(char:GetDescendants()) do
                    if motor:IsA("Motor6D") and motor.Part0 == hrp then
                        motor:SetAttribute("OrigC0Y", motor.C0.Position.Y)
                    end
                end
            end
            hum.HipHeight = -depth
            for _, motor in pairs(char:GetDescendants()) do
                if motor:IsA("Motor6D") and motor.Part0 == hrp then
                    local origY = motor:GetAttribute("OrigC0Y") or 0
                    local pos3 = motor.C0.Position
                    motor.C0 = CFrame.new(pos3.X, origY + depth, pos3.Z) * (motor.C0 - motor.C0.Position)
                end
            end
        elseif hrp:FindFirstChild("FlickSinkAnchor") then
            local origHH = hrp:FindFirstChild("FlickSinkAnchor").Value
            hum.HipHeight = origHH
            for _, motor in pairs(char:GetDescendants()) do
                if motor:IsA("Motor6D") and motor.Part0 == hrp then
                    local origY = motor:GetAttribute("OrigC0Y")
                    if origY then
                        local pos3 = motor.C0.Position
                        motor.C0 = CFrame.new(pos3.X, origY, pos3.Z) * (motor.C0 - motor.C0.Position)
                    end
                end
            end
            hrp:FindFirstChild("FlickSinkAnchor"):Destroy()
        end

        if Settings.HitboxDesync and not Settings.HitboxSink then
            local offset = Settings.HitboxDesyncOffset
            local jitter = math.abs(math.sin(tick() * 15)) * offset
            hum.HipHeight = -jitter
        elseif not Settings.HitboxSink and not Settings.HitboxDesync then
            if hrp:GetAttribute("OrigHipHeight") then
                hum.HipHeight = hrp:GetAttribute("OrigHipHeight")
            end
        end
    end)

    -- Crosshair
    if Settings.CrosshairEnabled then
        local sz, gap, clr, thk = Settings.CrosshairSize, Settings.CrosshairGap, Settings.CrosshairColor, Settings.CrosshairThickness
        CrossLines[1].Visible = true; CrossLines[1].From = center - Vector2.new(0, gap); CrossLines[1].To = center - Vector2.new(0, gap + sz); CrossLines[1].Color = clr; CrossLines[1].Thickness = thk
        CrossLines[2].Visible = true; CrossLines[2].From = center + Vector2.new(0, gap); CrossLines[2].To = center + Vector2.new(0, gap + sz); CrossLines[2].Color = clr; CrossLines[2].Thickness = thk
        CrossLines[3].Visible = true; CrossLines[3].From = center - Vector2.new(gap, 0); CrossLines[3].To = center - Vector2.new(gap + sz, 0); CrossLines[3].Color = clr; CrossLines[3].Thickness = thk
        CrossLines[4].Visible = true; CrossLines[4].From = center + Vector2.new(gap, 0); CrossLines[4].To = center + Vector2.new(gap + sz, 0); CrossLines[4].Color = clr; CrossLines[4].Thickness = thk
        CrossDot.Visible = Settings.DotEnabled; CrossDot.Position = center; CrossDot.Color = clr
    else
        for i = 1, 4 do CrossLines[i].Visible = false end; CrossDot.Visible = false
    end

    if Settings.Fullbright then Lighting.Brightness = 2; Lighting.ClockTime = 14; Lighting.GlobalShadows = false; Lighting.Ambient = Settings.AmbientColor end
    if Settings.NoFog then Lighting.FogEnd = 999999; Lighting.FogStart = 999999 end
    if Settings.CustomTime then Lighting.ClockTime = Settings.TimeValue end

    pcall(function()
        local char = Player.Character
        local hum = char and char:FindFirstChildOfClass("Humanoid")
        local hrp = char and char:FindFirstChild("HumanoidRootPart")
        if hum then
            if Settings.SpeedEnabled then hum.WalkSpeed = Settings.SpeedValue end
            if Settings.JumpPower then hum.JumpPower = Settings.JumpValue end
        end
        if Settings.NoclipEnabled and char then
            for _, p in pairs(char:GetDescendants()) do
                if p:IsA("BasePart") then p.CanCollide = false end
            end
        end
        if Settings.FlyEnabled and hrp then
            local bp = hrp:FindFirstChild("FlickBP")
            local bg = hrp:FindFirstChild("FlickBG")
            if not bp then bp = Instance.new("BodyPosition") bp.Name = "FlickBP" bp.MaxForce = Vector3.new() bp.Parent = hrp end
            if not bg then bg = Instance.new("BodyGyro") bg.Name = "FlickBG" bg.MaxTorque = Vector3.new() bg.Parent = hrp end
            if UIS:IsKeyDown(Enum.KeyCode.Space) then
                bp.MaxForce = Vector3.new(9e4, 9e4, 9e4)
                bg.MaxTorque = Vector3.new(9e4, 9e4, 9e4)
                bg.CFrame = Camera.CFrame
                local md = Vector3.new()
                if UIS:IsKeyDown(Enum.KeyCode.W) then md = md + Camera.CFrame.LookVector end
                if UIS:IsKeyDown(Enum.KeyCode.S) then md = md - Camera.CFrame.LookVector end
                if UIS:IsKeyDown(Enum.KeyCode.A) then md = md - Camera.CFrame.RightVector end
                if UIS:IsKeyDown(Enum.KeyCode.D) then md = md + Camera.CFrame.RightVector end
                bp.Position = md.Magnitude > 0 and hrp.Position + md.Unit * (Settings.FlySpeed / 25) or hrp.Position + Vector3.new(0, 0.2, 0)
            else bp.MaxForce = Vector3.new(); bg.MaxTorque = Vector3.new() end
        end
    end)

    -- Render players ESP + Chams
    for _, p in pairs(Players:GetPlayers()) do
        if p ~= Player then
            local esp = GetESP(p)
            local char = p.Character
            if char and char:FindFirstChild("HumanoidRootPart") and char:FindFirstChild("Head") then
                local hum = char:FindFirstChildOfClass("Humanoid")
                if hum and hum.Health > 0 then
                    local hl = char:FindFirstChild("FlickHL")
                    if not hl then hl = Instance.new("Highlight") hl.Name = "FlickHL" hl.Parent = char end
                    hl.Enabled = Settings.ChamsEnabled or Settings.GlowEnabled
                    hl.FillColor = Settings.ChamColor
                    hl.OutlineColor = Settings.RainbowGlow and RGB or Settings.GlowColor
                    hl.FillTransparency = Settings.ChamsEnabled and Settings.ChamTransparency or 1
                    hl.OutlineTransparency = Settings.GlowEnabled and 0 or 1

                    local hrp = char.HumanoidRootPart
                    local head = char.Head
                    local pos, vis = Camera:WorldToViewportPoint(hrp.Position)
                    local headPos = Camera:WorldToViewportPoint(head.Position + Vector3.new(0, 0.5, 0))
                    local legPos = Camera:WorldToViewportPoint(hrp.Position - Vector3.new(0, 3, 0))

                    if vis then
                        local height = math.abs(headPos.Y - legPos.Y)
                        local width = height / 2
                        local topLeft = Vector2.new(pos.X - width / 2, headPos.Y)

                        esp.BoxOutline.Visible = Settings.Boxes
                        esp.BoxOutline.Size = Vector2.new(width, height)
                        esp.BoxOutline.Position = topLeft
                        esp.Box.Visible = Settings.Boxes
                        esp.Box.Size = Vector2.new(width, height)
                        esp.Box.Position = topLeft
                        esp.Box.Color = Settings.BoxColor

                        esp.Name.Visible = Settings.Names
                        esp.Name.Text = p.DisplayName
                        esp.Name.Position = Vector2.new(pos.X, headPos.Y - 18)
                        esp.Name.Color = Settings.NameColor

                        esp.Distance.Visible = Settings.Distance
                        if Player.Character and Player.Character:FindFirstChild("HumanoidRootPart") then
                            esp.Distance.Text = math.floor((Player.Character.HumanoidRootPart.Position - hrp.Position).Magnitude) .. "m"
                        end
                        esp.Distance.Position = Vector2.new(pos.X, legPos.Y + 4)
                        esp.Distance.Color = Settings.DistanceColor

                        esp.Tracer.Visible = Settings.Tracers
                        esp.Tracer.From = Vector2.new(VP.X / 2, VP.Y)
                        esp.Tracer.To = Vector2.new(pos.X, legPos.Y)
                        esp.Tracer.Color = Settings.TracerColor

                        if Settings.HealthBar then
                            local barW = 3; local barH = height
                            local barX = topLeft.X - barW - 3
                            local barY = math.min(headPos.Y, legPos.Y)  -- fix: always top of box
                            local healthPct = math.clamp(hum.Health / hum.MaxHealth, 0, 1)
                            esp.HealthBarBG.Visible = true
                            esp.HealthBarBG.Position = Vector2.new(barX, barY)
                            esp.HealthBarBG.Size = Vector2.new(barW, barH)
                            esp.HealthBar.Visible = true
                            -- заполняем снизу вверх: пустое сверху, полное снизу
                            local fillH = barH * healthPct
                            esp.HealthBar.Position = Vector2.new(barX, barY + (barH - fillH))
                            esp.HealthBar.Size = Vector2.new(barW, fillH)
                            esp.HealthBar.Color = Color3.fromRGB(math.floor(255 * (1 - healthPct)), math.floor(255 * healthPct), 0)
                        else esp.HealthBarBG.Visible = false; esp.HealthBar.Visible = false end

                        if Settings.SkeletonESP then
                            local function bonePos(name)
                                local b = char:FindFirstChild(name)
                                if b then local p2, v2 = Camera:WorldToViewportPoint(b.Position) if v2 then return Vector2.new(p2.X, p2.Y) end end return nil
                            end
                            local headP = bonePos("Head")
                            local torsoP = bonePos("UpperTorso") or bonePos("Torso") or bonePos("HumanoidRootPart")
                            local lArmP = bonePos("LeftUpperArm") or bonePos("Left Arm")
                            local rArmP = bonePos("RightUpperArm") or bonePos("Right Arm")
                            local lLegP = bonePos("LeftUpperLeg") or bonePos("Left Leg")
                            local rLegP = bonePos("RightUpperLeg") or bonePos("Right Leg")
                            local bones = {{headP, torsoP}, {torsoP, lArmP}, {torsoP, rArmP}, {torsoP, lLegP}, {torsoP, rLegP}}
                            for i = 1, 5 do
                                if bones[i][1] and bones[i][2] then
                                    esp.Skeleton[i].Visible = true; esp.Skeleton[i].From = bones[i][1]; esp.Skeleton[i].To = bones[i][2]; esp.Skeleton[i].Color = Settings.SkeletonColor
                                else esp.Skeleton[i].Visible = false end
                            end
                        else for i = 1, 5 do esp.Skeleton[i].Visible = false end end
                    else
                        esp.Box.Visible = false; esp.BoxOutline.Visible = false; esp.Name.Visible = false
                        esp.Distance.Visible = false; esp.Tracer.Visible = false
                        esp.HealthBar.Visible = false; esp.HealthBarBG.Visible = false
                        for i = 1, 5 do esp.Skeleton[i].Visible = false end
                    end
                else
                    esp.Box.Visible = false; esp.BoxOutline.Visible = false; esp.Name.Visible = false
                    esp.Distance.Visible = false; esp.Tracer.Visible = false
                    esp.HealthBar.Visible = false; esp.HealthBarBG.Visible = false
                    for i = 1, 5 do esp.Skeleton[i].Visible = false end
                    if char:FindFirstChild("FlickHL") then char.FlickHL.Enabled = false end
                end
            else
                esp.Box.Visible = false; esp.BoxOutline.Visible = false; esp.Name.Visible = false
                esp.Distance.Visible = false; esp.Tracer.Visible = false
                esp.HealthBar.Visible = false; esp.HealthBarBG.Visible = false
                for i = 1, 5 do esp.Skeleton[i].Visible = false end
            end
        end
    end

    -- Hand chams
    pcall(function()
        if Settings.HandsEnabled then
            local view = Camera:FindFirstChild("Viewmodel") or Player.Character
            if view then
                for _, obj in pairs(view:GetDescendants()) do
                    if obj:IsA("BasePart") and (obj.Name:lower():find("hand") or obj.Name:lower():find("arm")) then
                        obj.Color = Settings.HandColor
                        obj.Material = Settings.HandGlow and Enum.Material.ForceField or Enum.Material.Neon
                    end
                end
            end
        end
    end)

    -- PARTICLES
    pcall(function()
        local char = Player.Character
        if not char then return end
        local hrp = char:FindFirstChild("HumanoidRootPart")
        if not hrp then return end
        local RGB = Color3.fromHSV(tick() % 5 / 5, 1, 1)

        if Settings.SparklesEnabled then
            if not hrp:FindFirstChild("FlickSparkle") then
                local s = Instance.new("Sparkles") s.Name = "FlickSparkle" s.Parent = hrp
            end
            local sp = hrp:FindFirstChild("FlickSparkle")
            if sp then sp.SparkleColor = Settings.RainbowParticles and RGB or Settings.SparkleColor; sp.Enabled = true end
        end
        if Settings.FireEnabled then
            if not hrp:FindFirstChild("FlickFire") then
                local f = Instance.new("Fire") f.Name = "FlickFire" f.Parent = hrp
            end
            local fire = hrp:FindFirstChild("FlickFire")
            if fire then fire.Size = Settings.FireSize; fire.Color = Settings.FireColor; fire.SecondaryColor = Settings.RainbowParticles and RGB or Settings.FireColor end
        end
        if Settings.SmokeEnabled then
            if not hrp:FindFirstChild("FlickSmoke") then
                local sm = Instance.new("Smoke") sm.Name = "FlickSmoke" sm.Parent = hrp
            end
            local smoke = hrp:FindFirstChild("FlickSmoke")
            if smoke then smoke.Opacity = Settings.SmokeOpacity; smoke.Color = Settings.SmokeColor; smoke.Enabled = true end
        end
        if Settings.ParticlesEnabled then
            if not hrp:FindFirstChild("FlickParticle") then
                local pe = Instance.new("ParticleEmitter") pe.Name = "FlickParticle"
                pe.Texture = Settings.ParticleTexture
                pe.LightEmission = 1; pe.LightInfluence = 0
                pe.Parent = hrp
            end
            local pe = hrp:FindFirstChild("FlickParticle")
            if pe then
                pe.Rate = Settings.ParticleRate
                pe.Speed = NumberRange.new(Settings.ParticleSpeed)
                pe.Size = NumberSequence.new(Settings.ParticleSize)
                pe.Lifetime = NumberRange.new(0.5, 1.5)
                local pCol = Settings.RainbowParticles and RGB or Settings.ParticleColor
                pe.Color = ColorSequence.new(pCol)
                pe.Enabled = true
            end
        end
        if Settings.TrailEnabled then
            local head = char:FindFirstChild("Head")
            if hrp and head and not hrp:FindFirstChild("FlickTrail") then
                local a0 = Instance.new("Attachment") a0.Name = "FlickTrailA" a0.Position = Vector3.new(0, 1, 0) a0.Parent = hrp
                local a1 = Instance.new("Attachment") a1.Name = "FlickTrailA" a1.Position = Vector3.new(0, -2, 0) a1.Parent = hrp
                local tr = Instance.new("Trail") tr.Name = "FlickTrail"
                tr.Attachment0 = a0; tr.Attachment1 = a1
                tr.Lifetime = Settings.TrailLifetime; tr.LightEmission = 1
                tr.MinLength = 0; tr.FaceCamera = true
                tr.Parent = hrp
            end
            local tr = hrp:FindFirstChild("FlickTrail")
            if tr then
                tr.Lifetime = Settings.TrailLifetime
                local tCol = Settings.RainbowParticles and RGB or Settings.TrailColor
                tr.Color = ColorSequence.new(tCol)
                tr.Transparency = NumberSequence.new({NumberSequenceKeypoint.new(0, 0), NumberSequenceKeypoint.new(1, 1)})
                tr.Enabled = true
            end
        end
        if Settings.AuraEnabled then
            if not hrp:FindFirstChild("FlickAura") then
                local pe = Instance.new("ParticleEmitter") pe.Name = "FlickAura"
                pe.Texture = "rbxassetid://243098098"
                pe.Rate = 50; pe.Speed = NumberRange.new(0.5, 2)
                pe.Size = NumberSequence.new({NumberSequenceKeypoint.new(0, 1.5), NumberSequenceKeypoint.new(1, 0)})
                pe.Lifetime = NumberRange.new(0.5, 1); pe.LightEmission = 1; pe.LightInfluence = 0
                pe.SpreadAngle = Vector2.new(180, 180)
                pe.Parent = hrp
            end
            local aura = hrp:FindFirstChild("FlickAura")
            if aura then aura.Color = ColorSequence.new(Settings.RainbowParticles and RGB or Settings.AuraColor); aura.Enabled = true end
        end
    end)
end)

-- ══════════════════════════════════════════
--  HUD (Drawing API)
-- ══════════════════════════════════════════
local HUD = {}
HUD.WatermarkBG = Drawing.new("Square"); HUD.WatermarkBG.Filled = true; HUD.WatermarkBG.Color = Color3.fromRGB(15, 15, 20); HUD.WatermarkBG.Transparency = 0.15
HUD.WatermarkAccent = Drawing.new("Line"); HUD.WatermarkAccent.Thickness = 2
HUD.WatermarkText = Drawing.new("Text"); HUD.WatermarkText.Size = 14; HUD.WatermarkText.Font = Drawing.Fonts.Plex; HUD.WatermarkText.Outline = true

local HUDLines = {}
for i = 1, 6 do
    HUDLines[i] = Drawing.new("Text")
    HUDLines[i].Size = 13; HUDLines[i].Font = Drawing.Fonts.Plex; HUDLines[i].Outline = true; HUDLines[i].Visible = false
end

HUD.HealthBG = Drawing.new("Square"); HUD.HealthBG.Filled = true; HUD.HealthBG.Color = Color3.fromRGB(20, 20, 25); HUD.HealthBG.Transparency = 0.2
HUD.HealthFill = Drawing.new("Square"); HUD.HealthFill.Filled = true
HUD.HealthText = Drawing.new("Text"); HUD.HealthText.Size = 12; HUD.HealthText.Font = Drawing.Fonts.Plex; HUD.HealthText.Outline = true; HUD.HealthText.Center = true

local fpsValues = {}; local lastFPS = 60

RunService.RenderStepped:Connect(function(dt)
    table.insert(fpsValues, 1/dt)
    if #fpsValues > 30 then table.remove(fpsValues, 1) end
    local sum = 0; for _, v in pairs(fpsValues) do sum = sum + v end
    lastFPS = math.floor(sum / #fpsValues)

    if not Settings.HUDEnabled then
        HUD.WatermarkBG.Visible = false; HUD.WatermarkAccent.Visible = false; HUD.WatermarkText.Visible = false
        HUD.HealthBG.Visible = false; HUD.HealthFill.Visible = false; HUD.HealthText.Visible = false
        for i = 1, 6 do HUDLines[i].Visible = false end
        return
    end

    local VP = workspace.CurrentCamera.ViewportSize
    local accentCol = Settings.HUDColor

    if Settings.HUDWatermark then
        local wmText = "FlickSpeed v3.5"
        if Settings.HUDFPS then wmText = wmText .. " | " .. lastFPS .. " FPS" end
        wmText = wmText .. " | " .. Player.DisplayName
        local wmW = #wmText * 7.5 + 20
        HUD.WatermarkBG.Visible = true
        HUD.WatermarkBG.Position = Vector2.new(VP.X - wmW - 12, 8)
        HUD.WatermarkBG.Size = Vector2.new(wmW, 26)
        HUD.WatermarkAccent.Visible = true
        HUD.WatermarkAccent.From = Vector2.new(VP.X - wmW - 12, 8)
        HUD.WatermarkAccent.To = Vector2.new(VP.X - 12, 8)
        HUD.WatermarkAccent.Color = accentCol
        HUD.WatermarkText.Visible = true
        HUD.WatermarkText.Position = Vector2.new(VP.X - wmW - 2, 12)
        HUD.WatermarkText.Text = wmText
        HUD.WatermarkText.Color = Color3.fromRGB(230, 230, 240)
    else
        HUD.WatermarkBG.Visible = false; HUD.WatermarkAccent.Visible = false; HUD.WatermarkText.Visible = false
    end

    local infoLines = {}
    pcall(function()
        local char = Player.Character
        local hum = char and char:FindFirstChildOfClass("Humanoid")
        local hrp = char and char:FindFirstChild("HumanoidRootPart")
        if Settings.HUDSpeed and hum then table.insert(infoLines, "⚡ Speed: " .. math.floor(hum.WalkSpeed)) end
        if Settings.HUDCoords and hrp then
            local p = hrp.Position
            table.insert(infoLines, "📍 " .. string.format("X:%.0f Y:%.0f Z:%.0f", p.X, p.Y, p.Z))
        end
        if Settings.HUDTarget and CurrentTarget then
            table.insert(infoLines, "🎯 Target: " .. (CurrentTarget.Parent and CurrentTarget.Parent.Name or "?"))
        end
        if Settings.HUDPlayers then
            table.insert(infoLines, "👥 Players: " .. #Players:GetPlayers() .. "/" .. Players.MaxPlayers)
        end
    end)

    for i = 1, 6 do
        if i <= #infoLines then
            HUDLines[i].Visible = true
            HUDLines[i].Position = Vector2.new(12, VP.Y - 30 - (#infoLines - i) * 18)
            HUDLines[i].Text = infoLines[i]
            HUDLines[i].Color = Color3.fromRGB(220, 220, 230)
        else
            HUDLines[i].Visible = false
        end
    end

    if Settings.HUDHealth then
        pcall(function()
            local hum = Player.Character and Player.Character:FindFirstChildOfClass("Humanoid")
            if hum then
                local barW = 200; local barH = 6
                local barX = VP.X / 2 - barW / 2; local barY = VP.Y - 20
                local pct = math.clamp(hum.Health / hum.MaxHealth, 0, 1)
                HUD.HealthBG.Visible = true; HUD.HealthBG.Position = Vector2.new(barX - 1, barY - 1); HUD.HealthBG.Size = Vector2.new(barW + 2, barH + 2)
                HUD.HealthFill.Visible = true; HUD.HealthFill.Position = Vector2.new(barX, barY); HUD.HealthFill.Size = Vector2.new(barW * pct, barH)
                HUD.HealthFill.Color = Color3.fromRGB(255 * (1 - pct), 255 * pct, 0)
                HUD.HealthText.Visible = true; HUD.HealthText.Position = Vector2.new(VP.X / 2, barY - 16)
                HUD.HealthText.Text = math.floor(hum.Health) .. " / " .. math.floor(hum.MaxHealth) .. " HP"
                HUD.HealthText.Color = Color3.fromRGB(230, 230, 240)
            else
                HUD.HealthBG.Visible = false; HUD.HealthFill.Visible = false; HUD.HealthText.Visible = false
            end
        end)
    else HUD.HealthBG.Visible = false; HUD.HealthFill.Visible = false; HUD.HealthText.Visible = false end
end)

-- ══════════════════════════════════════════
--  DRAWING: HIT CHAMS POOL
-- ══════════════════════════════════════════
local HitChamsPool = {}
for i = 1, 30 do
    HitChamsPool[i] = {
        line = Drawing.new("Line"),
        circle = Drawing.new("Circle"),
        timer = 0,
        active = false,
        fromPos = Vector2.new(),
        toPos = Vector2.new(),
        hitPos = Vector2.new(),
    }
    HitChamsPool[i].line.Visible = false
    HitChamsPool[i].line.Thickness = 1.5
    HitChamsPool[i].circle.Visible = false
    HitChamsPool[i].circle.Filled = false
    HitChamsPool[i].circle.Thickness = 1.5
    HitChamsPool[i].circle.Radius = 8
end

local function SpawnHitChams(fromScreen, toScreen)
    for _, hc in pairs(HitChamsPool) do
        if not hc.active then
            hc.active = true
            hc.timer = tick()
            hc.fromPos = fromScreen
            hc.toPos = toScreen
            hc.hitPos = toScreen
            break
        end
    end
end

-- ══════════════════════════════════════════
--  3D HIT CHAMS SYSTEM
-- ══════════════════════════════════════════
local HitChams3DActive = {}  -- {target=char, timer=tick(), prevHP=n}

local function Spawn3DHitChams(targetChar, damageDone)
    if not Settings.HitChams3D then return end
    local hrp = targetChar:FindFirstChild("HumanoidRootPart")
    if not hrp then return end
    local dur = Settings.HitChams3DDuration
    local col = Settings.HitChams3DColor

    -- 1. HIGHLIGHT FLASH — быстрая вспышка Highlight
    if Settings.HitChams3DHighlight then
        task.spawn(function()
            pcall(function()
                local hl = Instance.new("Highlight")
                hl.FillColor = col
                hl.OutlineColor = col
                hl.FillTransparency = 0
                hl.OutlineTransparency = 0
                hl.Parent = targetChar
                -- Fade out
                local steps = 10
                for i = 1, steps do
                    task.wait(dur / steps)
                    pcall(function()
                        hl.FillTransparency = i / steps
                        hl.OutlineTransparency = i / steps
                    end)
                end
                pcall(function() hl:Destroy() end)
            end)
        end)
    end

    -- 2. BLOOD PARTICLES — кровяные частицы на месте попадания
    if Settings.HitChams3DBlood then
        task.spawn(function()
            pcall(function()
                local pe = Instance.new("ParticleEmitter")
                pe.Name = "FlickBlood"
                pe.Texture = "rbxassetid://284205403"  -- кровяная текстура
                pe.Color = ColorSequence.new(col)
                pe.LightEmission = 0.3
                pe.LightInfluence = 0.5
                pe.Rate = 0
                pe.Speed = NumberRange.new(8, 20)
                pe.Rotation = NumberRange.new(0, 360)
                pe.RotSpeed = NumberRange.new(-90, 90)
                pe.Size = NumberSequence.new({
                    NumberSequenceKeypoint.new(0, 0.2),
                    NumberSequenceKeypoint.new(0.5, 0.15),
                    NumberSequenceKeypoint.new(1, 0)
                })
                pe.Lifetime = NumberRange.new(0.2, 0.5)
                pe.SpreadAngle = Vector2.new(80, 80)
                pe.Transparency = NumberSequence.new({
                    NumberSequenceKeypoint.new(0, 0),
                    NumberSequenceKeypoint.new(1, 1)
                })
                pe.Parent = hrp
                pe:Emit(15)  -- выпустить 15 частиц разово
                task.wait(0.6)
                pcall(function() pe:Destroy() end)
            end)
        end)
    end

    -- 3. 3D BEAM — луч от нашего HRP до цели через Part+Beam
    if Settings.HitChams3DBeam then
        task.spawn(function()
            pcall(function()
                local myHRP = Player.Character and Player.Character:FindFirstChild("HumanoidRootPart")
                if not myHRP then return end

                local a0 = Instance.new("Attachment")
                a0.Position = Vector3.new(0, 0, 0)
                a0.Parent = myHRP

                local a1 = Instance.new("Attachment")
                a1.Position = Vector3.new(0, 0, 0)
                a1.Parent = hrp

                local beam = Instance.new("Beam")
                beam.Attachment0 = a0
                beam.Attachment1 = a1
                beam.Color = ColorSequence.new(col)
                beam.Width0 = 0.15
                beam.Width1 = 0.05
                beam.LightEmission = 1
                beam.LightInfluence = 0
                beam.FaceCamera = true
                beam.Segments = 1
                beam.CurveSize0 = 0
                beam.CurveSize1 = 0
                beam.Transparency = NumberSequence.new({
                    NumberSequenceKeypoint.new(0, 0.2),
                    NumberSequenceKeypoint.new(1, 0.8)
                })
                beam.Parent = myHRP

                -- Fade out по шагам
                local steps = 8
                for i = 1, steps do
                    task.wait(dur / steps)
                    pcall(function()
                        beam.Transparency = NumberSequence.new({
                            NumberSequenceKeypoint.new(0, i / steps),
                            NumberSequenceKeypoint.new(1, 1)
                        })
                    end)
                end
                pcall(function() beam:Destroy(); a0:Destroy(); a1:Destroy() end)
            end)
        end)
    end

    -- 4. BILLBOARD -HP над головой
    if Settings.HitChams3DBillboard then
        task.spawn(function()
            pcall(function()
                local head = targetChar:FindFirstChild("Head")
                if not head then return end

                local bb = Instance.new("BillboardGui")
                bb.Name = "FlickDmgBB"
                bb.AlwaysOnTop = true
                bb.Size = UDim2.new(0, 80, 0, 30)
                bb.StudsOffset = Vector3.new(
                    math.random(-10, 10) * 0.1,  -- небольшой рандом по X
                    2 + math.random(0, 10) * 0.1,
                    0
                )
                bb.Parent = head

                local lbl = Instance.new("TextLabel")
                lbl.BackgroundTransparency = 1
                lbl.Size = UDim2.new(1, 0, 1, 0)
                lbl.Font = Enum.Font.GothamBold
                lbl.TextScaled = true
                lbl.TextColor3 = col
                lbl.TextStrokeTransparency = 0.3
                lbl.TextStrokeColor3 = Color3.new(0, 0, 0)
                local dmgText = damageDone and ("-" .. math.floor(damageDone)) or "HIT"
                lbl.Text = dmgText
                lbl.Parent = bb

                -- Анимация: плывёт вверх и исчезает
                local steps = 15
                for i = 1, steps do
                    task.wait(dur / steps)
                    pcall(function()
                        bb.StudsOffset = bb.StudsOffset + Vector3.new(0, 0.12, 0)
                        lbl.TextTransparency = i / steps
                        lbl.TextStrokeTransparency = 0.3 + (0.7 * i / steps)
                    end)
                end
                pcall(function() bb:Destroy() end)
            end)
        end)
    end
end

-- Слушаем здоровье врагов для 3D Hit Chams
local function Watch3DHitChams(p)
    pcall(function()
        if p == Player then return end
        local char = p.Character
        if not char then return end
        local hum = char:FindFirstChildOfClass("Humanoid")
        if not hum then return end
        local lastHP = hum.Health
        hum.HealthChanged:Connect(function(newHP)
            if newHP < lastHP then
                local dmg = lastHP - newHP
                Spawn3DHitChams(char, dmg)
            end
            lastHP = newHP
        end)
    end)
end

-- Подключаем ко всем текущим и будущим игрокам
for _, p in pairs(Players:GetPlayers()) do
    Watch3DHitChams(p)
    p.CharacterAdded:Connect(function()
        task.wait(0.5)
        Watch3DHitChams(p)
    end)
end
Players.PlayerAdded:Connect(function(p)
    p.CharacterAdded:Connect(function()
        task.wait(0.5)
        Watch3DHitChams(p)
    end)
end)

-- ══════════════════════════════════════════
--  KEYBIND TOGGLE LOGIC + PANIC + BHOP
-- ══════════════════════════════════════════
UIS.InputBegan:Connect(function(input, proc)
    if proc then return end
    local k = input.KeyCode

    -- Panic Key
    if k == Settings.PanicKey then
        Settings.Enabled = false
        Settings.ChamsEnabled = false
        Settings.GlowEnabled = false
        Settings.Boxes = false
        Settings.Names = false
        Settings.Distance = false
        Settings.Tracers = false
        Settings.HealthBar = false
        Settings.SkeletonESP = false
        Settings.SpeedEnabled = false
        Settings.FlyEnabled = false
        Settings.NoclipEnabled = false
        Settings.HitMarker = false
        Settings.HitChamsEnabled = false
        Settings.ArrowsEnabled = false
        Settings.RadarEnabled = false
        Settings.CrosshairEnabled = false
        Settings.BHopEnabled = false
        print("[FlickSpeed] PANIC KEY — всё выключено")
        return
    end

    -- Keybind toggles
    if k == Settings.KeybindAimbot and k ~= Enum.KeyCode.Unknown then
        Settings.Enabled = not Settings.Enabled
    end
    if k == Settings.KeybindSpeed and k ~= Enum.KeyCode.Unknown then
        Settings.SpeedEnabled = not Settings.SpeedEnabled
    end
    if k == Settings.KeybindFly and k ~= Enum.KeyCode.Unknown then
        Settings.FlyEnabled = not Settings.FlyEnabled
    end
    if k == Settings.KeybindNoclip and k ~= Enum.KeyCode.Unknown then
        Settings.NoclipEnabled = not Settings.NoclipEnabled
    end
    if k == Settings.KeybindRadar and k ~= Enum.KeyCode.Unknown then
        Settings.RadarEnabled = not Settings.RadarEnabled
    end

    -- Hit Marker + Hit Chams trigger on LMB
    if input.UserInputType == Enum.UserInputType.MouseButton1 then
        if CurrentTarget then
            local pos, vis = Camera:WorldToViewportPoint(CurrentTarget.Position)
            if vis then
                local mousePos = UIS:GetMouseLocation()
                local screenTarget = Vector2.new(pos.X, pos.Y)
                if (screenTarget - mousePos).Magnitude < Settings.FOV then
                    -- Hit Marker
                    if Settings.HitMarker then
                        hitMarkerActive = true
                        hitMarkerTimer = tick()
                    end
                    -- Hit Chams
                    if Settings.HitChamsEnabled then
                        local VP2 = Camera.ViewportSize
                        local fromScr = Vector2.new(VP2.X / 2, VP2.Y / 2)
                        SpawnHitChams(fromScr, screenTarget)
                    end
                end
            end
        end
    end
end)

-- BunnyHop
UIS.JumpRequest:Connect(function()
    if Settings.BHopEnabled then
        pcall(function()
            local hum = Player.Character and Player.Character:FindFirstChildOfClass("Humanoid")
            if hum and hum:GetState() == Enum.HumanoidStateType.Landed then
                hum:ChangeState(Enum.HumanoidStateType.Jumping)
            end
        end)
    end
end)

-- ══════════════════════════════════════════
--  RENDER: HIT MARKER + ARROWS + RADAR
-- ══════════════════════════════════════════
RunService.RenderStepped:Connect(function(dt)
    local VP = workspace.CurrentCamera.ViewportSize
    local center = Vector2.new(VP.X / 2, VP.Y / 2)

    -- ── HIT MARKER ──
    if Settings.HitMarker and hitMarkerActive then
        local elapsed = tick() - hitMarkerTimer
        if elapsed < Settings.HitMarkerDuration then
            local t = elapsed / Settings.HitMarkerDuration  -- 0..1
            local alpha = 1 - t
            -- Стрелки расходятся от центра
            local expandOffset = t * 6
            local sz = Settings.HitMarkerSize
            local gap = 4 + expandOffset
            local clr = Settings.HitMarkerColor
            local thk = Settings.HitMarkerThickness
            HitMarkerLines[1].Visible = true
            HitMarkerLines[1].From = center - Vector2.new(0, gap)
            HitMarkerLines[1].To = center - Vector2.new(0, gap + sz)
            HitMarkerLines[1].Color = clr; HitMarkerLines[1].Thickness = thk; HitMarkerLines[1].Transparency = alpha
            HitMarkerLines[2].Visible = true
            HitMarkerLines[2].From = center + Vector2.new(0, gap)
            HitMarkerLines[2].To = center + Vector2.new(0, gap + sz)
            HitMarkerLines[2].Color = clr; HitMarkerLines[2].Thickness = thk; HitMarkerLines[2].Transparency = alpha
            HitMarkerLines[3].Visible = true
            HitMarkerLines[3].From = center - Vector2.new(gap, 0)
            HitMarkerLines[3].To = center - Vector2.new(gap + sz, 0)
            HitMarkerLines[3].Color = clr; HitMarkerLines[3].Thickness = thk; HitMarkerLines[3].Transparency = alpha
            HitMarkerLines[4].Visible = true
            HitMarkerLines[4].From = center + Vector2.new(gap, 0)
            HitMarkerLines[4].To = center + Vector2.new(gap + sz, 0)
            HitMarkerLines[4].Color = clr; HitMarkerLines[4].Thickness = thk; HitMarkerLines[4].Transparency = alpha
        else
            hitMarkerActive = false
            for i = 1, 4 do HitMarkerLines[i].Visible = false end
        end
    else
        for i = 1, 4 do HitMarkerLines[i].Visible = false end
    end

    -- ── HIT CHAMS ──
    for _, hc in pairs(HitChamsPool) do
        if hc.active then
            local elapsed = tick() - hc.timer
            if elapsed < Settings.HitChamsDuration then
                local alpha = 1 - (elapsed / Settings.HitChamsDuration)
                -- Линия от прицела до точки попадания
                hc.line.Visible = Settings.HitChamsEnabled
                hc.line.From = hc.fromPos
                hc.line.To = hc.toPos
                hc.line.Color = Settings.HitChamsLineColor
                hc.line.Thickness = Settings.HitChamsThickness
                hc.line.Transparency = alpha
                -- Круг на точке попадания (расширяется)
                hc.circle.Visible = Settings.HitChamsEnabled
                hc.circle.Position = hc.hitPos
                hc.circle.Radius = 6 + elapsed / Settings.HitChamsDuration * 14
                hc.circle.Color = Settings.HitChamsCircleColor
                hc.circle.Thickness = Settings.HitChamsThickness
                hc.circle.Transparency = alpha
            else
                hc.active = false
                hc.line.Visible = false
                hc.circle.Visible = false
            end
        else
            hc.line.Visible = false
            hc.circle.Visible = false
        end
    end

    -- ── OFF-SCREEN ARROWS ──
    local arrowIdx = 0
    if Settings.ArrowsEnabled then
        pcall(function()
            local myChar = Player.Character
            local myHRP = myChar and myChar:FindFirstChild("HumanoidRootPart")
            for _, p in pairs(Players:GetPlayers()) do
                if p ~= Player and p.Character then
                    local hum = p.Character:FindFirstChildOfClass("Humanoid")
                    local hrp = p.Character:FindFirstChild("HumanoidRootPart")
                    if hrp and hum and hum.Health > 0 then
                        local screenPos, onScreen = Camera:WorldToViewportPoint(hrp.Position)
                        if not onScreen then
                            arrowIdx = arrowIdx + 1
                            if arrowIdx > #ArrowPool then break end
                            local arrow = ArrowPool[arrowIdx]

                            -- Направление от центра к игроку
                            local dir = (Vector2.new(screenPos.X, screenPos.Y) - center).Unit
                            local angle = math.atan2(dir.Y, dir.X)
                            local radius = Settings.ArrowRadius
                            local sz = Settings.ArrowSize
                            local tipPos = center + Vector2.new(math.cos(angle), math.sin(angle)) * radius

                            -- Стрелка — треугольник
                            local perp = Vector2.new(-math.sin(angle), math.cos(angle))
                            local tip = tipPos
                            local base1 = tipPos - dir * sz + perp * (sz * 0.4)
                            local base2 = tipPos - dir * sz - perp * (sz * 0.4)

                            arrow.tri.Visible = true
                            arrow.tri.PointA = tip
                            arrow.tri.PointB = base1
                            arrow.tri.PointC = base2
                            arrow.tri.Color = Settings.ArrowColor
                            arrow.tri.Transparency = 0.85
                        end
                    end
                end
            end
        end)
    end
    -- Скрыть неиспользуемые стрелки
    for i = arrowIdx + 1, #ArrowPool do
        ArrowPool[i].tri.Visible = false
    end

    -- ── RADAR ──
    if Settings.RadarEnabled then
        pcall(function()
            local myChar = Player.Character
            local myHRP = myChar and myChar:FindFirstChild("HumanoidRootPart")
            if not myHRP then
                RadarBG.Visible = false; RadarBorder.Visible = false
                RadarSelfDot.Visible = false; RadarLabel.Visible = false
                for i = 1, #RadarDots do RadarDots[i].Visible = false end
                return
            end

            local rSize = Settings.RadarSize
            local rX = 20            -- отступ от левого края
            local rY = 20            -- отступ от верхнего края
            local rCenter = Vector2.new(rX + rSize / 2, rY + rSize / 2)

            -- Фон
            RadarBG.Visible = true
            RadarBG.Position = Vector2.new(rX, rY)
            RadarBG.Size = Vector2.new(rSize, rSize)
            RadarBG.Color = Settings.RadarBGColor

            -- Рамка
            RadarBorder.Visible = true
            RadarBorder.Position = Vector2.new(rX, rY)
            RadarBorder.Size = Vector2.new(rSize, rSize)
            RadarBorder.Color = Color3.fromRGB(80, 80, 100)

            -- Надпись
            RadarLabel.Visible = true
            RadarLabel.Position = Vector2.new(rX + 4, rY + 2)
            RadarLabel.Color = Color3.fromRGB(180, 180, 200)

            -- Точка себя
            RadarSelfDot.Visible = true
            RadarSelfDot.Position = rCenter
            RadarSelfDot.Color = Settings.RadarSelfColor

            -- Поворот камеры (для ориентации радара)
            local camYaw = Camera.CFrame:ToEulerAnglesYXZ()

            local dotIdx = 0
            for _, p in pairs(Players:GetPlayers()) do
                if p ~= Player and p.Character then
                    local hum = p.Character:FindFirstChildOfClass("Humanoid")
                    local hrp = p.Character:FindFirstChild("HumanoidRootPart")
                    if hrp and hum and hum.Health > 0 then
                        dotIdx = dotIdx + 1
                        if dotIdx > #RadarDots then break end

                        -- Относительная позиция
                        local relPos = hrp.Position - myHRP.Position
                        local scale = Settings.RadarScale

                        -- Поворачиваем относительно направления камеры
                        local rotX = relPos.X * math.cos(-camYaw) - relPos.Z * math.sin(-camYaw)
                        local rotZ = relPos.X * math.sin(-camYaw) + relPos.Z * math.cos(-camYaw)

                        local radarX = rCenter.X + rotX * scale * (rSize / 2)
                        local radarY = rCenter.Y + rotZ * scale * (rSize / 2)

                        -- Зажимаем в границы радара
                        radarX = math.clamp(radarX, rX + 4, rX + rSize - 4)
                        radarY = math.clamp(radarY, rY + 4, rY + rSize - 4)

                        RadarDots[dotIdx].Visible = true
                        RadarDots[dotIdx].Position = Vector2.new(radarX, radarY)
                        RadarDots[dotIdx].Color = Settings.RadarDotColor
                    end
                end
            end
            for i = dotIdx + 1, #RadarDots do RadarDots[i].Visible = false end
        end)
    else
        RadarBG.Visible = false; RadarBorder.Visible = false
        RadarSelfDot.Visible = false; RadarLabel.Visible = false
        for i = 1, #RadarDots do RadarDots[i].Visible = false end
    end
end)

Window:Init()
print("[FlickSpeed v3.5] Loaded! | Velocity 0.8.0 | HitMarker + Arrows + Radar")

Features & Information

this script made full by gemini 3 + sonnet 4.6 script tested on velocity executor only i hope yall like this

Community Comments (5)

smertni*qqsmertni*qqFeb 22, 2026

if u have any problems comment

poloduneufquatrepoloduneufquatreFeb 22, 2026

styler mais... rien ne marche

Replying to @poloduneufquatre
smertni*qqsmertni*qqFeb 22, 2026

@poloduneufquatre everything works for me what executor u use?

pr7251441pr7251441Feb 22, 2026

how did you even prompt this to make that....

brathuobrathuoFeb 23, 2026

russian schoolboy 2.0

More Scripts for [FPS] Flick