CCCPaste

35cf74a19bf33

--================================================================================--
--==  🛡️ BADR HUB - TITAN SECURITY EDITION V11 (No Key | Protected Core)      ==--
--==  💀 Features: Skeleton ESP | 🧱 Wall Check | ⚡ Optimized 0% Lag           ==--
--==  🔓 Status: UNLOCKED (No Key Required)                                   ==--
--================================================================================--

-- [1] SECURITY SHIELD & ENVIRONMENT CHECK | نظام الحماية البيئي
-- هذا الجزء يمنع السكربت من التعارض أو التشغيل المزدوج
if getgenv().TitanV11_Loaded then 
    game:GetService("StarterGui"):SetCore("SendNotification", {
        Title = "Titan Security", Text = "Script is already running!", Duration = 5
    })
    return 
end
getgenv().TitanV11_Loaded = true

-- دالة حماية لتنفيذ الأوامر بأمان دون تحطيم اللعبة
local function SafeCall(func, name)
    local success, result = pcall(func)
    if not success then
        warn("[TITAN SHIELD] Error in " .. name .. ": " .. tostring(result))
    end
    return result
end

-- [2] SERVICES | الخدمات
local Players = game:GetService("Players")
local CoreGui = game:GetService("CoreGui")
local RunService = game:GetService("RunService")
local UserInputService = game:GetService("UserInputService")
local Workspace = game:GetService("Workspace")
local Camera = Workspace.CurrentCamera
local LocalPlayer = Players.LocalPlayer
local Mouse = LocalPlayer:GetMouse()

-- [3] CONFIGURATION | الإعدادات
local Settings = {
    MainColor   = Color3.fromRGB(0, 255, 255), -- لون التيتان (أزرق سماوي)
    EnemyVisible = Color3.fromRGB(0, 255, 0),  -- أخضر (عدو مكشوف)
    EnemyHidden = Color3.fromRGB(255, 0, 0),   -- أحمر (عدو خلف جدار)
    TeamColor   = Color3.fromRGB(0, 100, 255)
}

local Config = {
    Visuals = {
        Enabled = true,
        Box = false,
        Skeleton = false, -- الميزة القوية
        Name = false,
        Health = false,
        Tracers = false,
        TeamCheck = true
    },
    Combat = {
        Enabled = false,
        WallCheck = true, -- فحص الجدار
        FOV = 120,
        Smoothness = 0.2, -- كلما قل الرقم زادت السرعة (0.1 سريع، 0.5 ناعم وواقعي)
        TargetPart = "Head",
        KeyBind = Enum.UserInputType.MouseButton2
    }
}

-- [4] ADVANCED UTILITIES | أدوات متقدمة
local function IsAlive(plr)
    if plr and plr.Character and plr.Character:FindFirstChild("Humanoid") and plr.Character.Humanoid.Health > 0 and plr.Character:FindFirstChild("HumanoidRootPart") then
        return true
    end
    return false
end

local function IsVisible(targetPart)
    -- نظام فحص الجدار باستخدام Raycasting
    local origin = Camera.CFrame.Position
    local direction = (targetPart.Position - origin).Unit * (targetPart.Position - origin).Magnitude
    local params = RaycastParams.new()
    params.FilterDescendantsInstances = {LocalPlayer.Character, Camera, Workspace:FindFirstChild("Ignore")} -- تجاهل النفس
    params.FilterType = Enum.RaycastFilterType.Exclude
    
    local result = Workspace:Raycast(origin, direction, params)
    if result then
        if result.Instance:IsDescendantOf(targetPart.Parent) then return true end -- يرى اللاعب
        return false -- يرى جدار
    end
    return true
end

-- [5] VISUALS ENGINE (DRAWING API) | محرك الرسومات
local ESP_Storage = {}

local function CreateDraw(type, props)
    local d = Drawing.new(type)
    for k, v in pairs(props) do d[k] = v end
    return d
end

local function AddESP(plr)
    local Objs = {
        Box = CreateDraw("Square", {Thickness = 1.5, Filled = false, Visible = false}),
        Tracer = CreateDraw("Line", {Thickness = 1, Visible = false}),
        Name = CreateDraw("Text", {Size = 15, Center = true, Outline = true, Color = Color3.White, Visible = false}),
        HPBar = CreateDraw("Line", {Thickness = 2, Visible = false}),
        Skeleton = {} -- مصفوفة للهيكل العظمي
    }
    -- إنشاء 15 خط للهيكل العظمي لتغطية R15 و R6
    for i = 1, 15 do 
        table.insert(Objs.Skeleton, CreateDraw("Line", {Thickness = 1.5, Color = Color3.White, Visible = false})) 
    end
    ESP_Storage[plr] = Objs
end

local function RemoveESP(plr)
    if ESP_Storage[plr] then
        for _, v in pairs(ESP_Storage[plr]) do
            if type(v) == "table" then for _, l in pairs(v) do l:Remove() end -- حذف الهيكل
            else v:Remove() end
        end
        ESP_Storage[plr] = nil
    end
end

-- حلقة تحديث الرسومات (محمية)
RunService.RenderStepped:Connect(function()
    SafeCall(function()
        for plr, ESP in pairs(ESP_Storage) do
            if plr ~= LocalPlayer and IsAlive(plr) then
                local char = plr.Character
                local hrp = char.HumanoidRootPart
                local hum = char.Humanoid
                local vec, onScreen = Camera:WorldToViewportPoint(hrp.Position)
                local isTeam = (Config.Visuals.TeamCheck and plr.Team == LocalPlayer.Team)
                
                -- منطق الألوان الذكي
                local color = Settings.EnemyHidden
                if Config.Combat.WallCheck then
                    if IsVisible(hrp) then color = Settings.EnemyVisible end
                else
                    color = Settings.EnemyVisible
                end
                if isTeam then color = Settings.TeamColor end

                if onScreen and not isTeam and Config.Visuals.Enabled then
                    local rootPos = hrp.Position
                    local headPos = char.Head.Position + Vector3.new(0, 0.5, 0)
                    local legPos = rootPos - Vector3.new(0, 3, 0)
                    local top = Camera:WorldToViewportPoint(headPos)
                    local bot = Camera:WorldToViewportPoint(legPos)
                    local height = math.abs(top.Y - bot.Y)
                    local width = height / 1.5

                    -- Box
                    if Config.Visuals.Box then
                        ESP.Box.Size = Vector2.new(width, height)
                        ESP.Box.Position = Vector2.new(top.X - width/2, top.Y)
                        ESP.Box.Color = color
                        ESP.Box.Visible = true
                    else ESP.Box.Visible = false end

                    -- Skeleton (The Heavy Logic)
                    if Config.Visuals.Skeleton then
                        local joints = {
                            {"Head", "UpperTorso"}, {"UpperTorso", "LowerTorso"}, -- Spine
                            {"LowerTorso", "LeftUpperLeg"}, {"LeftUpperLeg", "LeftLowerLeg"}, -- Left Leg
                            {"LowerTorso", "RightUpperLeg"}, {"RightUpperLeg", "RightLowerLeg"}, -- Right Leg
                            {"UpperTorso", "LeftUpperArm"}, {"LeftUpperArm", "LeftLowerArm"}, -- Left Arm
                            {"UpperTorso", "RightUpperArm"}, {"RightUpperArm", "RightLowerArm"} -- Right Arm
                        }
                        if hum.RigType == Enum.HumanoidRigType.R6 then
                            joints = {{"Head", "Torso"}, {"Torso", "Left Leg"}, {"Torso", "Right Leg"}, {"Torso", "Left Arm"}, {"Torso", "Right Arm"}}
                        end

                        for i, part in ipairs(joints) do
                            local p1, p2 = char:FindFirstChild(part[1]), char:FindFirstChild(part[2])
                            local line = ESP.Skeleton[i]
                            if p1 and p2 and line then
                                local v1, s1 = Camera:WorldToViewportPoint(p1.Position)
                                local v2, s2 = Camera:WorldToViewportPoint(p2.Position)
                                if s1 and s2 then
                                    line.From = Vector2.new(v1.X, v1.Y)
                                    line.To = Vector2.new(v2.X, v2.Y)
                                    line.Color = color
                                    line.Visible = true
                                else line.Visible = false end
                            elseif line then line.Visible = false end
                        end
                    else
                        for _, l in pairs(ESP.Skeleton) do l.Visible = false end
                    end

                    -- Name
                    if Config.Visuals.Name then
                        ESP.Name.Text = plr.Name
                        ESP.Name.Position = Vector2.new(top.X, top.Y - 18)
                        ESP.Name.Color = color
                        ESP.Name.Visible = true
                    else ESP.Name.Visible = false end

                    -- Health
                    if Config.Visuals.Health then
                        local hpH = height * (hum.Health / hum.MaxHealth)
                        ESP.HPBar.From = Vector2.new(top.X - width/2 - 6, bot.Y)
                        ESP.HPBar.To = Vector2.new(top.X - width/2 - 6, bot.Y - hpH)
                        ESP.HPBar.Color = Color3.fromRGB(0, 255, 0)
                        ESP.HPBar.Visible = true
                    else ESP.HPBar.Visible = false end

                    -- Tracers
                    if Config.Visuals.Tracers then
                        ESP.Tracer.From = Vector2.new(Camera.ViewportSize.X/2, Camera.ViewportSize.Y)
                        ESP.Tracer.To = Vector2.new(bot.X, bot.Y)
                        ESP.Tracer.Color = color
                        ESP.Tracer.Visible = true
                    else ESP.Tracer.Visible = false end
                else
                    for _, v in pairs(ESP) do if type(v)=="table" then for _, l in pairs(v) do l.Visible=false end else v.Visible=false end end
                end
            else
                 if ESP_Storage[plr] then for _, v in pairs(ESP) do if type(v)=="table" then for _, l in pairs(v) do l.Visible=false end else v.Visible=false end end end
            end
        end
    end, "ESP Loop")
end)

Players.PlayerAdded:Connect(AddESP)
Players.PlayerRemoving:Connect(RemoveESP)
for _, p in pairs(Players:GetPlayers()) do if p ~= LocalPlayer then AddESP(p) end end

-- [6] AIMBOT ENGINE | محرك التصويب
local FOVCircle = Drawing.new("Circle")
FOVCircle.Thickness = 1.5
FOVCircle.NumSides = 60
FOVCircle.Color = Settings.MainColor
FOVCircle.Filled = false

RunService.RenderStepped:Connect(function()
    FOVCircle.Position = Vector2.new(Mouse.X, Mouse.Y + 36)
    FOVCircle.Radius = Config.Combat.FOV
    FOVCircle.Visible = Config.Combat.Enabled

    if Config.Combat.Enabled and UserInputService:IsMouseButtonPressed(Config.Combat.KeyBind) then
        local closest = nil
        local minDst = math.huge

        for _, p in pairs(Players:GetPlayers()) do
            if p ~= LocalPlayer and IsAlive(p) then
                if Config.Visuals.TeamCheck and p.Team == LocalPlayer.Team then continue end
                
                local part = p.Character[Config.Combat.TargetPart]
                local pos, vis = Camera:WorldToViewportPoint(part.Position)
                
                if vis then
                    local dist = (Vector2.new(Mouse.X, Mouse.Y) - Vector2.new(pos.X, pos.Y)).Magnitude
                    if dist < Config.Combat.FOV and dist < minDst then
                        -- Wall Check Logic
                        if Config.Combat.WallCheck then
                            if IsVisible(part) then
                                minDst = dist
                                closest = part
                            end
                        else
                            minDst = dist
                            closest = part
                        end
                    end
                end
            end
        end

        if closest then
            local tPos = Camera:WorldToViewportPoint(closest.Position)
            local mLoc = Vector2.new(Mouse.X, Mouse.Y)
            local tLoc = Vector2.new(tPos.X, tPos.Y)
            local move = (tLoc - mLoc) * Config.Combat.Smoothness
            mousemoverel(move.X, move.Y)
        end
    end
end)

-- [7] UI SYSTEM (NO KEY) | واجهة المستخدم
local Screen = Instance.new("ScreenGui", CoreGui)
Screen.Name = "TitanV11_UI"

local Main = Instance.new("Frame", Screen)
Main.Size = UDim2.new(0, 500, 0, 350)
Main.Position = UDim2.new(0.5, -250, 0.5, -175)
Main.BackgroundColor3 = Color3.fromRGB(10, 10, 12)
Main.BorderSizePixel = 0
Instance.new("UICorner", Main).CornerRadius = UDim.new(0, 12)
local Stroke = Instance.new("UIStroke", Main)
Stroke.Color = Settings.MainColor
Stroke.Thickness = 2

-- Dragging Logic
local dragging, dragInput, dragStart, startPos
Main.InputBegan:Connect(function(input)
    if input.UserInputType == Enum.UserInputType.MouseButton1 then
        dragging = true
        dragStart = input.Position
        startPos = Main.Position
    end
end)
Main.InputChanged:Connect(function(input)
    if input.UserInputType == Enum.UserInputType.MouseMovement then dragInput = input end
end)
UserInputService.InputChanged:Connect(function(input)
    if input == dragInput and dragging then
        local delta = input.Position - dragStart
        Main.Position = UDim2.new(startPos.X.Scale, startPos.X.Offset + delta.X, startPos.Y.Scale, startPos.Y.Offset + delta.Y)
    end
end)
Main.InputEnded:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseButton1 then dragging = false end end)

-- UI Elements
local Title = Instance.new("TextLabel", Main)
Title.Size = UDim2.new(1, -40, 0, 40)
Title.Position = UDim2.new(0, 20, 0, 5)
Title.Text = "🛡️ TITAN SECURITY V11"
Title.Font = Enum.Font.GothamBlack
Title.TextColor3 = Settings.MainColor
Title.TextSize = 20
Title.TextXAlignment = Enum.TextXAlignment.Left
Title.BackgroundTransparency = 1

local Close = Instance.new("TextButton", Main)
Close.Size = UDim2.new(0, 30, 0, 30)
Close.Position = UDim2.new(1, -35, 0, 5)
Close.Text = "X"
Close.BackgroundColor3 = Color3.fromRGB(200, 50, 50)
Close.TextColor3 = Color3.White
Instance.new("UICorner", Close).CornerRadius = UDim.new(0, 6)
Close.MouseButton1Click:Connect(function() Screen:Destroy() end)

local TabHolder = Instance.new("Frame", Main)
TabHolder.Size = UDim2.new(0.25, 0, 0.85, 0)
TabHolder.Position = UDim2.new(0, 10, 0, 45)
TabHolder.BackgroundColor3 = Color3.fromRGB(20, 20, 25)
Instance.new("UICorner", TabHolder).CornerRadius = UDim.new(0, 8)

local ContentHolder = Instance.new("Frame", Main)
ContentHolder.Size = UDim2.new(0.7, 0, 0.85, 0)
ContentHolder.Position = UDim2.new(0.28, 0, 0, 45)
ContentHolder.BackgroundColor3 = Color3.fromRGB(20, 20, 25)
Instance.new("UICorner", ContentHolder).CornerRadius = UDim.new(0, 8)
local ContentLayout = Instance.new("UIListLayout", ContentHolder)
ContentLayout.Padding = UDim.new(0, 5)
ContentLayout.HorizontalAlignment = Enum.HorizontalAlignment.Center

-- Function to create Features
local function AddToggle(text, refTable, refVal)
    local btn = Instance.new("TextButton", ContentHolder)
    btn.Size = UDim2.new(0.95, 0, 0, 40)
    btn.BackgroundColor3 = Color3.fromRGB(35, 35, 40)
    btn.Text = text .. " [OFF]"
    btn.TextColor3 = Color3.fromRGB(200, 200, 200)
    btn.Font = Enum.Font.GothamBold
    btn.TextSize = 14
    Instance.new("UICorner", btn).CornerRadius = UDim.new(0, 6)
    
    btn.MouseButton1Click:Connect(function()
        refTable[refVal] = not refTable[refVal]
        if refTable[refVal] then
            btn.Text = text .. " [ON]"
            btn.BackgroundColor3 = Settings.MainColor
            btn.TextColor3 = Color3.Black
        else
            btn.Text = text .. " [OFF]"
            btn.BackgroundColor3 = Color3.fromRGB(35, 35, 40)
            btn.TextColor3 = Color3.fromRGB(200, 200, 200)
        end
    end)
end

local function AddTab(name, setupFunc)
    local tBtn = Instance.new("TextButton", TabHolder)
    tBtn.Size = UDim2.new(1, -10, 0, 40)
    tBtn.Position = UDim2.new(0, 5, 0, (#TabHolder:GetChildren()-1) * 45) -- Simple auto positioning
    tBtn.BackgroundColor3 = Color3.fromRGB(30, 30, 35)
    tBtn.Text = name
    tBtn.TextColor3 = Color3.White
    tBtn.Font = Enum.Font.GothamBold
    Instance.new("UICorner", tBtn).CornerRadius = UDim.new(0, 6)
    
    tBtn.MouseButton1Click:Connect(function()
        for _, c in pairs(ContentHolder:GetChildren()) do if c:IsA("TextButton") then c:Destroy() end end
        setupFunc()
    end)
end

-- Setup Tabs
AddTab("👁️ Visuals", function()
    AddToggle("Master Switch", Config.Visuals, "Enabled")
    AddToggle("Skeleton ESP (Strong)", Config.Visuals, "Skeleton")
    AddToggle("Box ESP", Config.Visuals, "Box")
    AddToggle("Name ESP", Config.Visuals, "Name")
    AddToggle("Health Bar", Config.Visuals, "Health")
    AddToggle("Tracers", Config.Visuals, "Tracers")
end)

AddTab("⚔️ Combat", function()
    AddToggle("Aimbot Enabled", Config.Combat, "Enabled")
    AddToggle("Wall Check 🧱", Config.Combat, "WallCheck")
    -- Dynamic Button for FOV
    local fovBtn = Instance.new("TextButton", ContentHolder)
    fovBtn.Size = UDim2.new(0.95, 0, 0, 40)
    fovBtn.BackgroundColor3 = Color3.fromRGB(50, 50, 60)
    fovBtn.Text = "Cycle FOV ("..Config.Combat.FOV..")"
    fovBtn.TextColor3 = Color3.White
    Instance.new("UICorner", fovBtn).CornerRadius = UDim.new(0,6)
    fovBtn.MouseButton1Click:Connect(function()
        Config.Combat.FOV = Config.Combat.FOV + 40
        if Config.Combat.FOV > 300 then Config.Combat.FOV = 40 end
        fovBtn.Text = "Cycle FOV ("..Config.Combat.FOV..")"
    end)
end)

-- إشعار نجاح
game:GetService("StarterGui"):SetCore("SendNotification", {
    Title = "TITAN V11 ACTIVE";
    Text = "Security Shield: ON | Key: REMOVED";
    Icon = "rbxassetid://12345678";
    Duration = 5;
})